[Haskell-cafe] serialized data structures (Was: Generalized, named, and exportable default declarations)
olf at aatal-apotheke.de
Tue Apr 13 19:36:35 UTC 2021
> We have seen a lot of effort of better integrating Text into Haskell
> programming. The only purpose of doing so is to replace String by
> something more space and time efficient. What would happen if we invest
> equally much time into making String as efficient as Text? At ICFP 2019 I
> attended a talk about Gibbon:
> The idea of the project is to serialize (Haskell's) tree data structures
> in memory as much as possible. Wouldn't this enable us to use String
> instead of Text, again, maybe even lists instead of Vectors? No more Text
> integration efforts, no more external library with GHC-specific manual
> optimizations. Unfortunately, the project is still in an early stage. So
> far, it only supports strict data structures.
> What if we would not complicate the language and generalize syntactic
> sugar for Text, but instead improve data layout for all Haskell types and
> eventually make a custom Text type unnecessary?
So essentially Gibbon's aim is to make String work like Text under the
hood, without me having to worry about it? +1 for that!
Probably I should not comment on this, because I know too little about
compilers and serialization. But having to expect something like
OverloadedStrings for arbitrary type classes, plus which effect import
statements have on this, puts extra cognitive load on the programmer.
In contrast, the direction taken by Gibbon removes worries, namely: How
much memory penalty do I pay by using this easy-to-understand algebraic
data type instead of a more low-level compact representation? I love
GHC specifically for its ability to perform many optimizations that Icould not have come up with.
Indeed the GHC devs should strive to make the default [*] types work
better, as this aligns with the mission of the Haskell Foundation to
promote and widen adoption of Haskell.
[*] "default" as dictated by the language report.
More information about the Haskell-Cafe