You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not urgent by any means, but I'm bringing this up so that it's not buried in old commit messages.
The GF codebase includes a modified version of Haskell's Data.Binary from 2008. According to Grégoire's commit from 2010, this modification was necessary, because the binary representation of doubles in Data.Binary was (is?) not compliant with IEEE 754.
The standard binary package has improved efficiency and error handling [1], so
in the long run we should consider switching to it.
Is this still the case? The code from 2008 contains some unsafe IO operations (inlinePerformIO is deprecated and has a newer, more accurate name accursedUnutterablePerformIO). Later versions of Data.Binary don't contain accursedUnutterable…, at least not in those functions I checked.
No real changes: Keep the modified Data.Binary from 2008 with all its curses, accursedUnutterablePerformIO is actually necessary in our code (for performance reasons?).
Keep the modified Data.Binary from 2008, but replace accursed unutterable functions with something safer, like unsafePerformIO.
If Data.Binary has fixed its representation of doubles and any other issues for which the custom module was used: Switch to the latest version of Data.Binary library. (+Write some proper property-based tests to make sure that the change doesn't break GF.)
The text was updated successfully, but these errors were encountered:
IEEE-754 compliance is not the only problem. The standard Binary package
produces very bloated binary files. Our implementation uses variable length
integers which makes the files a lot shorter.
We can switch to the standard Binary package but only if we don't use their
type classes. We can use for instance custom functions like putString and
getString which store string lengths in variable length integers instead of
the standard overloaded put/get. In this way we at least reuse backend
machinery from the standard package.
inariksit
changed the title
Is custom version of Data.Binary still needed? It uses accursedUnutterablePerformIO 😨
Is custom version of Data.Binary still needed?
Aug 24, 2021
This is not urgent by any means, but I'm bringing this up so that it's not buried in old commit messages.
The GF codebase includes a modified version of Haskell's Data.Binary from 2008. According to Grégoire's commit from 2010, this modification was necessary, because the binary representation of doubles in Data.Binary was (is?) not compliant with IEEE 754.
In the commit history, you can see a comment from 2013:
Is this still the case? The code from 2008 contains some unsafe IO operations (
inlinePerformIO
is deprecated and has a newer, more accurate nameaccursedUnutterablePerformIO
). Later versions of Data.Binary don't contain accursedUnutterable…, at least not in those functions I checked.Maybe more interesting, the implementation of the Get monad has changed, see current version of Binary vs. old version used in GF.
Ways to proceed
From least work to most work:
accursedUnutterablePerformIO
is actually necessary in our code (for performance reasons?).unsafePerformIO
.The text was updated successfully, but these errors were encountered: