
Hi Adam,
I've added a README which tries to explain things:
https://github.com/aavogt/HListPlugin
When I produce a wanted constraint from a wanted constraint, things
work as I wanted. Thanks for the suggestion!
Regards,
Adam
On Mon, Feb 16, 2015 at 4:36 AM, Adam Gundry
Hi Adam,
It's great to hear that you are trying the plugins functionality, this is exactly the kind of experimentation it's designed for! I'm a little confused about what you're trying to achieve, though. Can you give some examples of code you'd like to be able to write?
In general, GHC's type inference algorithm isn't expecting wanted constraints to be produced from givens; confusing things will happen if they are, and it's likely that *less* things will be typeable rather than *more*. Perhaps the plugin infrastructure should prevent you from doing so.
It makes sense to produce givens from givens or wanteds from wanteds though. I'd imagine you might want to look for *wanted* constraints (HLength x ~ HLength y) and add an additional *wanted* (SameLength x y).
One other thing to note is that plugins are called twice, once to simplify the givens (with empty wanteds), and once to solve the wanteds (https://ghc.haskell.org/trac/ghc/wiki/Plugins/TypeChecker#Callingpluginsfrom...).
Hope this helps,