Class: TypeList

Inherits:
Object
  • Object
show all
Defined in:
lib/haskell/type_list.rb

Overview

‘>=’ is left-associative … List like LISP or Hash may be better.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(l, r) ⇒ TypeList

Returns a new instance of TypeList.



6
7
8
# File 'lib/haskell/type_list.rb', line 6

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

Instance Attribute Details

#listObject

Returns the value of attribute list.



4
5
6
# File 'lib/haskell/type_list.rb', line 4

def list
  @list
end

Instance Method Details

#>=(r) ⇒ Object



10
11
12
13
# File 'lib/haskell/type_list.rb', line 10

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

#argsObject



15
16
17
# File 'lib/haskell/type_list.rb', line 15

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

#rtnObject



19
20
21
# File 'lib/haskell/type_list.rb', line 19

def rtn
  @list.last
end

#to_sObject



23
24
25
# File 'lib/haskell/type_list.rb', line 23

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