[Haskell-cafe] Parsec float
Bartosz Wójcik
bartek at sudety.it
Fri May 29 18:38:31 EDT 2009
On Friday 29 May 2009 08:34:36 you wrote:
> myfloat = try (do{ symbol "-"; n <- float; return (negate n) }) <|>
> try float <|>
> do { i<-integer; return(fromIntegral i) }
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)
Best regards,
Bartek
More information about the Haskell-Cafe
mailing list