On Jun 5, 2012, at 9:57 AM, Johan Tibell wrote: > I don't think applying == to something that contains floating point > values at the leaves makes much sense. You want some approxEq function > that uses approximate equality on floating point value or you want to > equality function that ignores the floating point values. Probably not > the answer you like, but I don't know how to define Eq in a robust way > for types that include floating point values.
I buy that in general for comparing floats (those that result from arithmetic operations), but this is a case where attoparsec's parser is munging the value. I would like to have a law that says "parse . print == id" ... which is why this seems more like a bug than the usual floating point concerns. This law seems to hold for haskell's double parser: quickCheck (\d -> read (show d) == d) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe