Sha256: 287fd5676ccfb8c08e68158a4d3ca51a3aa57df580647248e15708407bfa4c6d

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

#--
#     This file is part of the Prelude library that provides tools to
#     enable Haskell style functional programming in Ruby.
#
#     http://prelude.rubyforge.org 
#     
#     Copyright (C) 2006 APP Design, Inc.
#
#     This program is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2 of the License, or
#     (at your option) any later version.
#
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
#
#     You should have received a copy of the GNU General Public License along
#     with this program; if not, write to the Free Software Foundation, Inc.,
#     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#++

module Prelude

  # $Id: monad.rb 2 2006-08-25 00:11:17Z prelude $
  #
  # Monad implementation is inspired by the following sources: 
  #
  # * article "Late to the Party" posted at http://cwilliams.textdriven.com/pages/monads, I could not detect
  #   the author's name
  # * writings by MenTaLguY, see http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html
  #
  class Monad
    def bind(&block)
      collect(&block).flatten
    end
  end # Monad
end # Prelude

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prelude-0.0.1 lib/prelude/monad.rb