Closed crockeea closed 10 years ago
I think you want Typeable (Internal a)
instead of Typeable a
in the type of share
. Then you don't need Typeable
for the various Syntactic types (but of course it doesn't hurt to add the instances).
A better type for share
is:
share :: (Let :<: dom,
BindingT :<: dom,
Typeable (Internal a),
dom ~ Domain b, dom ~ Domain a,
Syntactic a, Syntactic b)
=> a -> (a -> b) -> b
share = sugarSym Let
Thanks, I should have asked the expert first!
When writing a domain-agnostic
share
, I needed to deriveTypeable
instances for severalsyntactic
data types: https://gist.github.com/crockeea/07ea03c24aaea3efec81I had to derive instances for
Construct
,BindingT
,AST
, and(:+:)
, but there are probably more that should be madeTypeable
. Perhaps using-XAutoDeriveTypeable
would be a good solution.