Class: Dhall::TypeChecker::Function
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::Function
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(func) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(func) ⇒ Function
Returns a new instance of Function.
821 822 823 824 825 826 827 828 829 |
# File 'lib/dhall/typecheck.rb', line 821 def initialize(func) @func = func @type = Dhall::Forall.new( var: func.var, type: func.type, body: Dhall::Variable["UNKNOWN"] ) @output = TypeChecker.for(func.body) end |
Instance Method Details
#annotate(context) ⇒ Object
831 832 833 834 835 836 837 838 839 840 |
# File 'lib/dhall/typecheck.rb', line 831 def annotate(context) abody = @output.annotate(context.add(@type)) Dhall::TypeAnnotation.new( value: @func.with(body: abody), type: TypeChecker.for( @type.with(body: abody.type) ).annotate(context).value ) end |