Monaden mit Null

import Control.Monad ( guard )
do a <- [ 1 .. 4 ] 
   b <- [ 2 .. 3 ]
   guard $ even (a + b)
   return ( a * b )
[ 1 .. 4 ] >>= \ a -> 
     [ 2 .. 3 ] >>= \ b ->
        if ( even (a+b) ) 
        then return ( a * b ) else mzero
class Monad m => MonadPlus m where 
    mzero :: m a ; ...
instance MonadPlus [] where mzero = []



2009-11-20