Haskell's read
is a bit too strict about floating point numbers:
$ ghci
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
Prelude> read "-1E34" :: Double
-1.0e34
Prelude> read "-1.E34" :: Double
*** Exception: Prelude.read: no parse
Prelude>
Is there a version of read that accepts the second form? It is quite common in physical sciences. For example, Fortran reads and writes such forms.
Another example that Haskell doesn't support is ".1" for "0.1". This one is even more common. I just don't want to convert the input ascii file. . . .
read
. Fortunately, defining a numbers parser yourself is easy (and better than preprocessing forRead
). – Bomke