Re: oops (was: Re: if-then-else inside a do)

2002-01-30 Thread Mark Carroll
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 (was: Re: if-then-else inside a do)

2002-01-29 Thread Bernard James POPE
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 ()

Re: oops (was: Re: if-then-else inside a do)

2002-01-29 Thread Mark Carroll
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

Re: oops (was: Re: if-then-else inside a do)

2002-01-29 Thread Kevin Glynn
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