[Haskell-cafe] Parsec float
Bryan O'Sullivan
bos at serpentine.com
Fri May 29 17:10:51 EDT 2009
On Fri, May 29, 2009 at 3:38 PM, Bartosz Wójcik <bartek at sudety.it> wrote:
> Thank you, this is an easy and nice solution. I've made it a bit prettier
> optically:
>
> 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".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090529/d430803e/attachment.html
More information about the Haskell-Cafe
mailing list