Currently xlsx seems to build on the Data.Text.Read module, which provide polymorphic functions like
rational :: Fractional a => Text -> Either String (a,Text)
This is however used to parse a decimal number from the XML into a Double value (note that CellDouble :: Double -> CellValue) which for most values can not represent the rational number exactly. This is especially annoying when the decimal number represents a LocalTime, because rounding errors can shift the time into a different day, thus affecting the displayed value quite a lot.
My proposed change is that
CellValue gets an additional CellDecimal constructor for implementing and testing the rational parsing to Scientific.
- When this is established,
CellDouble is deprecated.
To limit breakage, one could provide a view pattern named CellDouble that uses Data.Scientific.toRealFloat for the transition phase.
Currently
xlsxseems to build on the Data.Text.Read module, which provide polymorphic functions likeThis is however used to parse a decimal number from the XML into a Double value (note that
CellDouble :: Double -> CellValue) which for most values can not represent the rational number exactly. This is especially annoying when the decimal number represents aLocalTime, because rounding errors can shift the time into a different day, thus affecting the displayed value quite a lot.My proposed change is that
CellValuegets an additionalCellDecimalconstructor for implementing and testing therationalparsing toScientific.CellDoubleis deprecated.To limit breakage, one could provide a view pattern named
CellDoublethat usesData.Scientific.toRealFloatfor the transition phase.