Sha256: f6ccc13691a692350be02a80d73aeb7589923268ce9389dd500be4103e87c25c

Contents?: true

Size: 386 Bytes

Versions: 2

Compression:

Stored size: 386 Bytes

Contents

# '>=' is left-associative ...
# List like LISP or Hash may be better.
class TypeList
  attr_accessor :list

  def initialize(l, r)
    @list = [l, r]
  end

  def >=(r)
    @list << r
    self
  end

  def args
    @list[0..-2]
  end

  def rtn
    @list.last
  end

  def to_s
    @list.map(&:to_s).join(' -> ')
  end
end

class Module
  def >=(r)
    TypeList.new(self, r)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
haskell-0.0.3 lib/haskell/type_list.rb
haskell-0.0.2 lib/haskell/type_list.rb