Hal Daume [EMAIL PROTECTED] writes:
I know this has been written about way too much, but I was wondering
what people thought about using 'liftM f' as opposed to '= return . f'.
I would probably have written Andrew's code using liftM, but
I don't know if one is necessarily better than the
I know this has been written about way too much, but I was wondering what
people thought about using 'liftM f' as opposed to '= return . f'. I
would probably have written Andrew's code using liftM, but I don't know if
one is necessarily better than the other. Does anyone have strong
thoughts on
hi,
i personally think that one should use fmap instead. it tells
you exactly how much structure you need. having said that it is
sometimes annoying to get the extra Functor constraint (alas
Functor is not a super class of Moand)... so my preference is:
1. fmap
2. liftM
3. bind with return
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[To: [EMAIL PROTECTED]]
Is there a nicer way of writing the following sort of code?
case (number g) of
Just n - Just (show n)
Nothing -
case (fraction g) of
Just n - Just (show n)
Nothing -
case (nimber g) of
Just n - Just
On Sat, Sep 21, 2002 at 12:56:13PM -0700, Russell O'Connor wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
[To: [EMAIL PROTECTED]]
Is there a nicer way of writing the following sort of code?
case (number g) of
Just n - Just (show n)
Nothing -
case (fraction g) of
Just n
Russell O'Connor [EMAIL PROTECTED] writes:
[To: [EMAIL PROTECTED]]
Is there a nicer way of writing the following sort of code?
case (number g) of
Just n - Just (show n)
Nothing -
case (fraction g) of
Just n - Just (show n)
Nothing -
case (nimber g) of
Just n -
On 2002-09-21T12:56:13-0700, Russell O'Connor wrote:
case (number g) of
Just n - Just (show n)
Nothing -
case (fraction g) of
Just n - Just (show n)
Nothing -
case (nimber g) of
Just n - Just (*++(show n))
Nothing - Nothing
How about something like:
msum [
show g | Just n = number g = Just (show n)
| Just n = fraction g = Just (show n)
| Just n = nimber g = Just (*++show n)
| Nothing = Nothing
These should be Just n - number g, not =
- Hal
___
Haskell-Cafe