Class: Dhall::AsDhall::AnnotatedExpressionList

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, exprs) ⇒ AnnotatedExpressionList

Returns a new instance of AnnotatedExpressionList.



40
41
42
43
# File 'lib/dhall/as_dhall.rb', line 40

def initialize(type, exprs)
	@type = type
	@exprs = exprs
end

Instance Attribute Details

#exprsObject (readonly)

Returns the value of attribute exprs.



30
31
32
# File 'lib/dhall/as_dhall.rb', line 30

def exprs
  @exprs
end

#typeObject (readonly)

Returns the value of attribute type.



29
30
31
# File 'lib/dhall/as_dhall.rb', line 29

def type
  @type
end

Class Method Details

.from(type_annotation) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/dhall/as_dhall.rb', line 32

def self.from(type_annotation)
	if type_annotation.nil?
		new(nil, [nil])
	else
		new(type_annotation.type, [type_annotation.value])
	end
end

Instance Method Details

#+(other) ⇒ Object



45
46
47
48
# File 'lib/dhall/as_dhall.rb', line 45

def +(other)
	raise "#{type} != #{other.type}" if type != other.type
	self.class.new(type, exprs + other.exprs)
end