Class: TypeList
- Inherits:
-
Object
- Object
- TypeList
- Defined in:
- lib/haskell/type_list.rb
Overview
‘>=’ is left-associative … List like LISP or Hash may be better.
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
Instance Method Summary collapse
- #>=(r) ⇒ Object
- #args ⇒ Object
-
#initialize(l, r) ⇒ TypeList
constructor
A new instance of TypeList.
- #rtn ⇒ Object
- #to_s ⇒ Object
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
#list ⇒ Object
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 |
#args ⇒ Object
15 16 17 |
# File 'lib/haskell/type_list.rb', line 15 def args @list[0..-2] end |
#rtn ⇒ Object
19 20 21 |
# File 'lib/haskell/type_list.rb', line 19 def rtn @list.last end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/haskell/type_list.rb', line 23 def to_s @list.map(&:to_s).join(' -> ') end |