oops (was: Re: if-then-else inside a "do")
Wed, 30 Jan 2002 00:19:34 -0500 (EST)
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?