Sha256: ecf97810494b0537921bc1ba4f5c13402cf93091912904c5d6f770ca573ab209

Contents?: true

Size: 733 Bytes

Versions: 9

Compression:

Stored size: 733 Bytes

Contents

module Finitio
  module Syntax
    module HighOrderTypeInstantiation
      include Node

      capture :high
      capture :vars

      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

      def to_ast
        [:high_order_type_instantiation, high.to_s, lows.to_s]
      end

    end # module HighOrderTypeInstantiation
  end # module Syntax
end # module Finitio

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
finitio-0.12.0 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.11.4 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.11.3 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.11.2 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.11.1 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.10.0 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.9.1 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.9.0 lib/finitio/syntax/type/high_order_type_instantiation.rb
finitio-0.8.0 lib/finitio/syntax/type/high_order_type_instantiation.rb