type checker plugin does not affect inferred type signatures

adam vogt vogt.adam at gmail.com
Sat Feb 14 10:31:23 UTC 2015


Hello,

Using ghc-7.10 rc1, I am trying to write a type checker plugin that
adds wanted constraint which helps ghc to infer more types. However,
it seems that the wanted constraints I add don't get added to the
inferred type of the declaration, so that I get a type error like:

a.hs:1:1: Warning:
    Could not deduce (SameLength y x) arising from an application
    from the context (HLength x ~ HLength y)
      bound by the inferred type of
               p :: (HLength x ~ HLength y) => Proxy '(y, x)
      at a.hs:11:1-69

I think ghc should be able to figure out p :: (SameLength x y, HLength
x ~ HLength y) => Proxy '(x,y).

The code is self-contained:

git clone https://github.com/aavogt/HListPlugin

cd HListPlugin/ex

make


Is this approach supposed to be possible, or am I supposed to rewrite
things such that I only produce CtGivenS from the plugin?

Regards,
Adam


More information about the Glasgow-haskell-users mailing list