Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 776
Jeremiah Willcock Avatar asked Nov 29 '11 17:11

Jeremiah Willcock


1 Answers

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.

like image 135
Nathan Howell Avatar answered Nov 08 '22 08:11

Nathan Howell