Module | Prelude::Monad |
In: |
lib/prelude/monad.rb
|
State | = | {} |
# File lib/prelude/monad.rb, line 45 45: def Monad.join(arr) 46: r = [] 47: arr.each {|a| r.push *a} 48: r 49: end
# File lib/prelude/monad.rb, line 51 51: def bind(f=nil) 52: case 53: when f.kind_of?(Symbol) || f.kind_of?(Method) || f.kind_of?(Proc) : 54: State[object_id] = f.to_proc.call(State[object_id]) 55: self 56: 57: # when f.kind_of?(Proc) : 58: # State[object_id] = f.call(State[object_id]) 59: # self 60: 61: else 62: f 63: end # case 64: end