[Haskell-cafe] Parsec float
Bartosz Wójcik
bartek at sudety.it
Fri May 29 20:04:29 EDT 2009
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
More information about the Haskell-Cafe
mailing list