[Haskell-cafe] Parsing floating point numbers

Bjorn Buckwalter bjorn.buckwalter at gmail.com
Sun Mar 8 20:34:29 EDT 2009


Hi all,

What is your preferred method of parsing floating point numbers (from
String to Float/Double)? Parsec it seems only does positive floats out
of the box and PolyParse requires the float to be on scientific form
(exponential). While I've worked around these shortcomings in the past
I feel that I am reinventing the wheel as surely I am not the only to
run into these limitations. How do you parse your floats? Can you
recommend a parsing library that handles them solidly?

(For my current needs the formats accepted by "read" are sufficient,
but I want reasonable error handling (Maybe or Either) instead of an
exception on bad inputs.)

Thanks,
Bjorn Buckwalter


More information about the Haskell-Cafe mailing list