Search code examples
haskellboost-fusion

Haskell equivalent of Boost.Fusion


I have been playing with creating a fully typed DSEL in Haskell using GADTs and such for a fully type-safe AST, and it seems that doing a correctly typed compiler requires constructs such as maps from Haskell types to both types and values (typed environments) and such that can be understood by the Haskell type system. C++ has the Boost.Fusion library with constructs like these (type->value maps, vectors of typed values, etc.). Data.Tuple takes care of sequences, but are there Haskell versions of things like Boost.Fusion maps?


Solution

  • Look at the dependent-map package. I haven't used it myself, but it seems to do what you're asking for. If you need to really use type (and type-only) equality then you may need to agree on a default value or use a TypeRep as the key instead.