seemingly inconsistent behavior for "kind-indexed" type constraints in GHC 7.6

Nicolas Frisby nicolas.frisby at gmail.com
Mon Oct 8 08:52:54 CEST 2012


On Fri, Oct 5, 2012 at 9:25 PM, Richard Eisenberg <eir at cis.upenn.edu> wrote:
> For similar reasons, GHC does not bring the constraints on an instance into the context when an instance matches. So, even if GHC did select the instance you want, it would not bring ('[] ~ ps) into the context.

Ah, of course. I was naively letting myself regarding NLong by its
semantics and not by its instances. Silly mistake.

Part of the reason I made that mistake is that NLong is having the
desired effect on my program in other situations (as my second gist
demonstrates). I still need to characterize how that's working for me
there, but I'm sure your clarification here will surely guide me when
doing so. Thank you.

In past situations like this one, I have effected the desired
implication (to the instance context as instead of to the superclass)
via a coercion, which I make into a rank2 method of the class. It's
just rather tricky to express the type of the coercion in this case,
because of the involved Nat. I'm working on it now.



More information about the Glasgow-haskell-users mailing list