Sha256: f598ed10f33cda95357f68d57a859e8227098c535cac1d2a7110ec69ac598a64

Contents?: true

Size: 588 Bytes

Versions: 8

Compression:

Stored size: 588 Bytes

Contents

$:.unshift(File.dirname(File.dirname(File.expand_path(__FILE__))) + '/lib')
require "rubygems"
require "test/unit"
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

8 entries across 8 versions & 1 rubygems

Version Path
rumonade-0.4.2 test/test_helper.rb
rumonade-0.4.1 test/test_helper.rb
rumonade-0.4.0 test/test_helper.rb
rumonade-0.3.0 test/test_helper.rb
rumonade-0.2.2 test/test_helper.rb
rumonade-0.2.1 test/test_helper.rb
rumonade-0.2.0 test/test_helper.rb
rumonade-0.1.2 test/test_helper.rb