[Haskell-cafe] Automatic derivation (TemplateHaskell?)
Joel Reymont
joelr1 at gmail.com
Thu Apr 5 11:14:05 EDT 2007
Shouldn't this work just as well?
numExpr =
choice [ try $ float >>= return . Num
, integer >>= return . Int
]
It works on "Foo(10.345)" but not on "Bar(10, 103.34)".
On Apr 5, 2007, at 4:09 PM, Stefan O'Rear wrote:
>> numExpr :: GenParser Char a NumExpr
>> numExpr = do sg <- lexeme sign
>> nf <- natOrFloat
>> return $ either (Int . sg) (Nat . sg) nf
>
> It seems silly that there is no signed version of natOrFloat
> predefined, any Parsec experts?
>
> Stefan
--
http://wagerlabs.com/
More information about the Haskell-Cafe
mailing list