Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading NaNs #188

Open
idontgetoutmuch opened this issue Nov 30, 2020 · 1 comment
Open

Reading NaNs #188

idontgetoutmuch opened this issue Nov 30, 2020 · 1 comment

Comments

@idontgetoutmuch
Copy link

I have a file with NaNs and Haskell should cope with NaNs: Prelude.read "NaN" :: Double

But if I use cassava then I get errors

Left "parse error (Failed reading: conversion error: expected Double, got \"NaN\" (Failed reading: takeWhile1)) at \n-20.885,-21.039,3.0853,NaN,4,5\n-20.885,-18.039,3.0853,NaN,4,5\n-20.885,-15.039,3.0853,NaN,4,5\n-20.88 (truncated)"

So I have this

newtype LaxDouble = LaxDouble { laxDouble :: Double }
  deriving Show
instance FromField LaxDouble where
  parseField s = do
    f <- parseField s
    return $ LaxDouble $ Prelude.read f

IMHO reading NaNs should just work(TM)

@idontgetoutmuch
Copy link
Author

Apparently a result of using attoparsec - should this be reported there or should we fix the problem here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant