[Haskell-cafe] Re: what does @ mean?.....

Achim Schneider barsoap at web.de
Fri Dec 28 11:58:46 EST 2007


Achim Schneider <barsoap at web.de> wrote:

> zeroIf :: MonadPlus m => (a -> Bool) -> m a -> m a
> zeroIf f m = m >>= (\nz -> if f nz then mzero else m)
> 
> zeroZero :: (MonadPlus m, Num a) => m a -> m a
> zeroZero = zeroIf (==0)
> 
> makes it interesting again as you can't construct a Just value with
> it.

d'oh. return nz.

/me hides under a monad.



More information about the Haskell-Cafe mailing list