Sha256: 9ed588bf774c9e1db4ce4306c887d629971015a6b32c9d8977612b0cf865d647
Contents?: true
Size: 518 Bytes
Versions: 2
Compression:
Stored size: 518 Bytes
Contents
require 'rumonade/monad' module Rumonade module ArrayExtensions module ClassMethods def unit(value) [value] end def empty [] end end module InstanceMethods def bind(lam = nil, &blk) f = lam || blk inject([]) { |arr, elt| arr + f.call(elt).to_a } end end end end Array.send(:extend, Rumonade::ArrayExtensions::ClassMethods) Array.send(:include, Rumonade::ArrayExtensions::InstanceMethods) Array.send(:include, Rumonade::Monad)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rumonade-0.1.1 | lib/rumonade/array.rb |
rumonade-0.1.0 | lib/rumonade/array.rb |