goldfirere / ghc

Mirror of ghc repository. DO NOT SUBMIT PULL REQUESTS HERE
http://www.haskell.org/ghc/
Other
25 stars 1 forks source link

Order matters in `forall` #46

Closed goldfirere closed 8 years ago

goldfirere commented 9 years ago

When I say

foo :: forall a l k. l ~ Maybe k => Proxy (a :: l) -> Bool
foo (_ :: Proxy (b :: l)) = undefined

I get an error.

But when I say

foo :: forall l a k. l ~ Maybe k => Proxy (a :: l) -> Bool
foo (_ :: Proxy (b :: l)) = undefined

it works. The only difference is order of arguments.

int-index commented 8 years ago

Is this really a bug? The error is pretty meaningful:

Main.hs:6:8: error:
    • These kind and type variables: a l k
      are out of dependency order. Perhaps try this ordering:
        l (a :: l) k
    • In the type signature:
        foo :: forall a l k. l ~ Maybe k => Proxy (a :: l) -> Bool
goldfirere commented 8 years ago

Yes, that's right. The error you're seeing did not exist on Sep 15, though. It must have been some sort of panic. But the behavior today is good. Thanks for confirming this!