Class: Dhall::TypeChecker::Application
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::Application
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(app) ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize(app) ⇒ Application
Returns a new instance of Application.
911 912 913 914 915 |
# File 'lib/dhall/typecheck.rb', line 911 def initialize(app) @app = app @func = TypeChecker.for(app.function) @arg = app.argument end |
Instance Method Details
#annotate(context) ⇒ Object
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
# File 'lib/dhall/typecheck.rb', line 917 def annotate(context) afunc = @func.annotate(context) TypeChecker.assert afunc.type, Dhall::Forall, "Application LHS is not a function" aarg = TypeChecker.for( Dhall::TypeAnnotation.new(value: @arg, type: afunc.type.type) ).annotate(context) Dhall::TypeAnnotation.new( value: @app.with(function: afunc, argument: aarg), type: afunc.type.call(aarg.value) ) end |