Sha256: 2cef88a763c36337ceb175e0a687e9c0f394530ded1039c10c3b77da1a43abf5

Contents?: true

Size: 422 Bytes

Versions: 7

Compression:

Stored size: 422 Bytes

Contents

module Funkr
  module Categories
    # Monoids are types that can be added and have a zero element.
    module Monoid

      def mplus
        raise "Monoid#mplus not implemented"
      end
      
      module ClassMethods
        def mzero
          raise "Monoid#mzero not implemented"
        end
        
        def mconcat(list)
          list.inject(mzero){|a,e| a.mplus(e)}
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
funkr-0.0.40 lib/funkr/categories/monoid.rb
funkr-0.0.30 lib/funkr/categories/monoid.rb
funkr-0.0.28 lib/funkr/categories/monoid.rb
funkr-0.0.27 lib/funkr/categories/monoid.rb
funkr-0.0.26 lib/funkr/categories/monoid.rb
funkr-0.0.25 lib/funkr/categories/monoid.rb
funkr-0.0.24 lib/funkr/categories/monoid.rb