Class: Dhall::TypeChecker::LetIn
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::LetIn
- Defined in:
- lib/dhall/typecheck.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(letin) ⇒ LetIn
constructor
A new instance of LetIn.
Constructor Details
#initialize(letin) ⇒ LetIn
Returns a new instance of LetIn.
876 877 878 879 |
# File 'lib/dhall/typecheck.rb', line 876 def initialize(letin) @letin = letin @let = @letin.let end |
Class Method Details
.for(letin) ⇒ Object
868 869 870 871 872 873 874 |
# File 'lib/dhall/typecheck.rb', line 868 def self.for(letin) if letin.let.type LetInAnnotated.new(letin) else LetIn.new(letin) end end |
Instance Method Details
#annotate(context) ⇒ Object
881 882 883 884 885 886 887 888 889 |
# File 'lib/dhall/typecheck.rb', line 881 def annotate(context) alet = @let.with(type: assign_type(context)) type = TypeChecker.for(@letin.eliminate).annotate(context).type abody = Dhall::TypeAnnotation.new(value: @letin.body, type: type) Dhall::TypeAnnotation.new( value: @letin.with(let: alet, body: abody), type: type ) end |