Sha256: 86a22ef44108231ec81ee6042405e3727a75ad3c47cd539fba85aedee55e037c

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

$:.unshift(File.dirname(File.dirname(File.expand_path(__FILE__))) + '/lib')
require "rubygems"
require "test/unit"
require "rr"
require "rumonade"

# see http://stackoverflow.com/questions/2709361/monad-equivalent-in-ruby
module MonadAxiomTestHelpers
  def assert_monad_axiom_1(monad_class, value, f)
    assert_equal f[value], monad_class.unit(value).bind(f)
  end

  def assert_monad_axiom_2(monad)
    assert_equal monad, monad.bind(lambda { |v| monad.class.unit(v) })
  end

  def assert_monad_axiom_3(monad, f, g)
    assert_equal monad.bind(f).bind(g), monad.bind { |x| f[x].bind(g) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rumonade-0.1.1 test/test_helper.rb
rumonade-0.1.0 test/test_helper.rb