Class: Monadt::ReaderM

Inherits:
Object
  • Object
show all
Defined in:
lib/monadt/reader.rb

Class Method Summary collapse

Class Method Details

.bind(m, &blk) ⇒ Object



4
5
6
7
8
9
# File 'lib/monadt/reader.rb', line 4

def bind(m, &blk)
  ->(e) {
    v = m.(e)
    blk.call(e, v)
  }
end

.return(val) ⇒ Object



11
12
13
# File 'lib/monadt/reader.rb', line 11

def return(val)
  ->(e) { val }
end