Re: [Haskell-cafe] [Haskell] ANN: monad-bool 0.1

2013-01-22 Thread Henning Thielemann


On Tue, 22 Jan 2013, John Wiegley wrote:


Use 'onlyIf' with AndM and AndMT to guard later statements, which are only
evaluated if every preceding 'onlyIf' evaluates to True.  For example:

   foo :: AndM Int
   foo = do onlyIf (True == True)
return 100
onlyIf (True == True)
return 150
onlyIf (True == False)
return 200

When run with `evalAndM foo (-1)` (where (-1) provides a default value), 'foo'
returns 150.


Does the And monad fulfill the monad laws? In a proper monad an interim 
(return x) (without a '-') is a no-op.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
 Henning Thielemann lemm...@henning-thielemann.de writes:

 Does the And monad fulfill the monad laws? In a proper monad an interim
 (return x) (without a '-') is a no-op.

You are very right.  I will make the necessary changes.

-- 
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com   johnw on #haskell/irc.freenode.net

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe