Open ocharles opened 8 years ago
Avoiding the singletons
dep would be good, but the part that reads the worst to me is having to mention ElfTypeSym0
. We would have to improve that, either by not providing the TH to generate it, or having a more rigid and predictable name generation mechanism (eg changing the splice generating function to something like genTypeSymbol
and dropping the numeric suffix of the result).
We have
ElField
, but that works with a huge universe - namely, anything that is aKnownSymbol
. The tutorial hints at a way to work with smaller universes, but has to define(=::)
andAttr
itself. I think these can be exported byvinyl
, reducing the amount of boiler plate users have to write:This is using
Apply
fromsingletons
, so I suppose you might have to incur that as a dependency - but maybe it can be defined locally. The idea is to write an interpretation type family as normal, and then generate defunctionalisation symbols from that type family in order to use withApply
.The tutorial then becomes:
The only downside is that
jon
now needs a type annotation, because we can't infer what defunctionalisation symbol to use withApply
.Thinking out loud, feel free to close this if it's outside the scope of
vinyl
itself.