Module: Finitio::Syntax::HighOrderTypeInstantiation
- Includes:
- Node
- Defined in:
- lib/finitio/syntax/type/high_order_type_instantiation.rb
Instance Method Summary
collapse
Methods included from Node
included, #metadata, #resolve_ruby_const, #unique_names!
Instance Method Details
#compile(system) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/finitio/syntax/type/high_order_type_instantiation.rb', line 9
def compile(system)
target = system.fetch(high.to_s){
raise Error, "No such type `#{high.to_s}`"
}
raise "#{high} is not a high order type" unless target.is_a?(HighOrderType)
subs = vars.compile(system).map{|low|
system.fetch(low.to_s) {
raise Error, "No such type `#{low.to_s}`"
}
}
target.instantiate(system, subs)
end
|
#to_ast ⇒ Object
23
24
25
|
# File 'lib/finitio/syntax/type/high_order_type_instantiation.rb', line 23
def to_ast
[:high_order_type_instantiation, high.to_s, lows.to_s]
end
|