On Friday 29 May 2009 22:10:51 Bryan O'Sullivan wrote:
> > myFloat = try (symbol "-" >> float >>= return . negate)
> > <|> try float
> > <|> (integer >>= return . fromIntegral)
>
> Any time you see ">>= return .", something is being missed. Use liftM or
> <$> instead, i.e. "fromIntegral <$> integer" instead of "integer >>= return
> . fromIntegral".
I don't undersdand what is being missed.
liftM f m1 = do { x1 <- m1; return (f x1) }
so
liftM fromIntegral integer
will result the same. Is it then not just a convenience?
Bartek
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe