class Bpl::AST::MapType

Public Instance Methods

expand() click to toggle source

def eql?(ty)

ty.is_a?(MapType) &&
ty.domain.count == @domain.count &&
ty.domain.zip(@domain).all?{|t1,t2| t1.eql?(t2)} &&
ty.range.eql?(@range)

end

# File lib/bpl/ast/type.rb, line 67
def expand
  MapType.new(arguments: arguments,
    domain: domain.map(&:expand),
    range: range.map(&:expand))
end
show() click to toggle source
# File lib/bpl/ast/type.rb, line 72
def show
  args = @arguments.empty? ? "" : "<#{@arguments.map{|a| yield a} * ","}>"
  "#{args} [#{@domain.map{|a| yield a} * ","}] #{yield @range}".fmt
end