Method: Dhall::AsDhall::ExpressionList.for

Defined in:
lib/dhall/as_dhall.rb

.for(values, exprs) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/dhall/as_dhall.rb', line 147

def self.for(values, exprs)
  types = exprs.map(&TypeChecker.method(:type_of))

  if types.empty?
    Empty
  elsif types.include?(nil) && types.uniq.length <= 2
    Optional
  elsif types.uniq.length == 1
    Mono
  else
    Union
  end.new(values, exprs, types)
end