Class: Finitio::HighOrderType

Inherits:
Type
  • Object
show all
Defined in:
lib/finitio/type/high_order_type.rb

Constant Summary

Constants included from Metadata

Metadata::EMPTY_METADATA

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#anonymous?, #dress, #include?, #name, #name=, #named?, #to_s

Methods included from Metadata

#metadata, #metadata=, #metadata?

Constructor Details

#initialize(vars, defn, name = nil, metadata = nil) ⇒ HighOrderType

Returns a new instance of HighOrderType.



4
5
6
7
8
# File 'lib/finitio/type/high_order_type.rb', line 4

def initialize(vars, defn, name = nil,  = nil)
  super(name, )
  @vars = vars
  @defn = defn
end

Instance Attribute Details

#defnObject (readonly)

Returns the value of attribute defn.



9
10
11
# File 'lib/finitio/type/high_order_type.rb', line 9

def defn
  @defn
end

#varsObject (readonly)

Returns the value of attribute vars.



9
10
11
# File 'lib/finitio/type/high_order_type.rb', line 9

def vars
  @vars
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
22
23
# File 'lib/finitio/type/high_order_type.rb', line 19

def ==(other)
  super || other.is_a?(HighOrderType) \
        && other.vars == self.vars \
        && other.defn = self.defn
end

#default_nameObject



11
12
13
# File 'lib/finitio/type/high_order_type.rb', line 11

def default_name
  "Type<#{vars.join(',')}>"
end

#instantiate(compilation, sub_types) ⇒ Object



29
30
31
32
# File 'lib/finitio/type/high_order_type.rb', line 29

def instantiate(compilation, sub_types)
  overrides = Hash[vars.zip(sub_types)]
  defn.resolve_proxies(compilation.with_scope(overrides))
end

#resolve_proxies(system) ⇒ Object



25
26
27
# File 'lib/finitio/type/high_order_type.rb', line 25

def resolve_proxies(system)
  self
end

#suppremum(other) ⇒ Object

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/finitio/type/high_order_type.rb', line 15

def suppremum(other)
  raise NotImplementedError, "Suppremum is not defined on high order types"
end

#unconstrainedObject



34
35
36
# File 'lib/finitio/type/high_order_type.rb', line 34

def unconstrained
  HighOrderType.new(vars, defn.unconstrained, name, )
end