Class: Dhall::TypeChecker::Literal

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

Instance Method Summary collapse

Constructor Details

#initialize(lit) ⇒ Literal

Returns a new instance of Literal.



104
105
106
107
108
# File 'lib/dhall/typecheck.rb', line 104

def initialize(lit)
  @lit = lit
  @type = Dhall::Variable[lit.class.name.split(/::/).last]
  @type = Builtins[@type.name.to_sym] || @type
end

Instance Method Details

#annotateObject



110
111
112
113
114
115
# File 'lib/dhall/typecheck.rb', line 110

def annotate(*)
  Dhall::TypeAnnotation.new(
    value: @lit,
    type:  @type
  )
end