On Wed, 30 Jan 2002, Kevin Glynn wrote:
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.
Ah, cool, both points sound
Oops,
Thanks to Kevin who pointed out:
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
So now I tend to use:
doIf :: Monad a = Bool - [a b] - a ()
On Wed, 30 Jan 2002, Bernard James POPE wrote:
(snip)
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
(snip)
That's cute. People post all sorts of handy
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.
cheers
k
Mark Carroll writes:
On Wed, 30 Jan 2002, Bernard James