oops (was: Re: if-then-else inside a "do")
Wed, 30 Jan 2002 17:16:57 +1100
I think the Haskell Wiki was going to be the place to collect
interesting code fragments.
However, I must add that these functions are already part of the
Haskell 98 standard. See the Monad module in the Library Report.
Mark Carroll writes:
> On Wed, 30 Jan 2002, Bernard James POPE wrote:
> > when :: (Monad m) => Bool -> m () -> m ()
> > when p s = if p then s else return ()
> > unless :: (Monad m) => Bool -> m () -> m ()
> > unless p s = when (not p) s
> That's cute. People post all sorts of handy little code fragments here.
> Does anyone collect them together into a sort of "here's some useful stuff
> that's worth looking at" library?
> -- Mark
> Haskell-Cafe mailing list