Sha256: 16687735cff4710bd58ef2d183016cbcec2189dcdfba5eed4e654a7a57e9c217
Contents?: true
Size: 982 Bytes
Versions: 2
Compression:
Stored size: 982 Bytes
Contents
module Finitio class HighOrderType < Type def initialize(vars, defn, name = nil, metadata = nil) super(name, metadata) @vars = vars @defn = defn end attr_reader :vars, :defn def default_name "Type<#{vars.join(',')}>" end def suppremum(other) raise NotImplementedError, "Suppremum is not defined on high order types" end def ==(other) super || other.is_a?(HighOrderType) \ && other.vars == self.vars \ && other.defn = self.defn end def resolve_proxies(system) self end def instantiate(compilation, sub_types) overrides = Hash[vars.zip(sub_types)] defn.resolve_proxies(compilation.with_scope(overrides)).dup.tap{|x| x.send(:name=, "#{name}<#{overrides.values.join(',')}>", true) } end def unconstrained HighOrderType.new(vars, defn.unconstrained, name, metadata) end end # class HighOrderType end # module Finitio
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finitio-0.12.0 | lib/finitio/type/high_order_type.rb |
finitio-0.11.4 | lib/finitio/type/high_order_type.rb |