[Haskell-cafe] Modelling structurally subtyped and cyclic data in type safe Haskell
Aura Kelloniemi
kaura.dev at sange.fi
Tue Dec 13 20:35:43 UTC 2016
Dear Heinrich, and all others!
Heinrich Apfelmus <apfelmus at quantentunnel.de> writes:
> Second, it may helpful to look at how others do it. Your writing
> indicates that are already very knowledgeable, so this advice may be not
> very helpful, but for the sake of completeness, I would like to mention
> it anyway. For example, the `haskell-src-exts` package implements a
> syntax tree for Haskell, maybe it can offer an inspiration or two.
Yes, I have looked it up, and iss design is very clean. Unfrotunately my data
is not purely a syntax tree, but it contains lots of information related to
data layout, code generation, etc. For example haskell-src-exts does not need
to track type information, and it can refer to declared entities simply by
their name. If I did the same, I would also need to implement full-blown C++
name lookup with symbol tables, which I don't want to do.
GHC's sources might be useful though, but I haven't been corageous enough to
try my teeth on them.
Anyways, I'm very grateful for your pointers! I learned about anonymous sum
types and about vault.
GADTs composed with phantom types and type families seem to offer countless
possibilities. I'm missing some introductory documentation though - something
that is more practical than theoretical. (Yes, GADTs are quite well covered,
but I haven't found a tutorial for practical use of data families or
-XTypeInType, probably because they are quite new features.)
--
Aura
More information about the Haskell-Cafe
mailing list