The documentation on double states that it loses accuracy on some inputs, but using rational will fix this. I understood this to mean that if one simply used rational :: Reader Double, then one would get completely accurate results, but this doesn't appear to be the case. For instance, given the input string "5.781884674518029e-2", double :: Reader Double and rational :: Reader Double both produce an output of "5.7818846745180286e-2", whereas Prelude.read :: String -> Double produces "5.781884674518029e-2".
Perhaps the documentation means that one should actually use rational :: Reader Rational and then convert to Double with fromRational? If so, that isn't clear from the documentation.
The documentation on
doublestates that it loses accuracy on some inputs, but usingrationalwill fix this. I understood this to mean that if one simply usedrational :: Reader Double, then one would get completely accurate results, but this doesn't appear to be the case. For instance, given the input string"5.781884674518029e-2",double :: Reader Doubleandrational :: Reader Doubleboth produce an output of"5.7818846745180286e-2", whereasPrelude.read :: String -> Doubleproduces"5.781884674518029e-2".Perhaps the documentation means that one should actually use
rational :: Reader Rationaland then convert toDoublewithfromRational? If so, that isn't clear from the documentation.