Class: Dhall::TypeChecker::Forall

Inherits:
Object
  • Object
show all
Defined in:
lib/dhall/typecheck.rb

Defined Under Namespace

Modules: FunctionKind

Instance Method Summary collapse

Constructor Details

#initialize(expr) ⇒ Forall

Returns a new instance of Forall.



871
872
873
874
875
876
877
# File 'lib/dhall/typecheck.rb', line 871

def initialize(expr)
	@expr = expr
	@var = expr.var
	@var_type = expr.type
	@input = TypeChecker.for(expr.type)
	@output = TypeChecker.for(expr.body)
end

Instance Method Details

#annotate(context) ⇒ Object



910
911
912
913
914
915
916
917
918
# File 'lib/dhall/typecheck.rb', line 910

def annotate(context)
	inkind = KINDS.index(@input.annotate(context).type)
	outkind = KINDS.index(@output.annotate(context.add(@expr)).type)

	Dhall::TypeAnnotation.new(
		value: @expr,
		type:  FunctionKind.for(inkind, outkind).kind
	)
end