Superclass Equality constraints cp FunDeps

Anthony Clayden anthony_clayden at clear.net.nz
Sun Apr 30 10:37:43 UTC 2017


> On at Apr 29 05:55:14 UTC 2017, Anthony Clayden wrote:  
> ...
> So should I reasonably have known that
> a superclass constraint 
> with FunDeps on the superclass
> induces FunDeps on the sub-class
> without explicitly needing to declare so?
> 
> (I'm not complaining, more surprised/impressed.)
> 

>From experimenting, FunDeps seem to come through
from a superclass of a superclass of a superclass of the
class.

This from David Feuer says
http://stackoverflow.com/questions/35252562/find-an-element-in-an-hlist/35260970#35260970

"superclass context is critical ....
 GHC always commits to an instance before checking the
instance constraints,
 but it doesn't even try to find an instance
 until after solving the superclass constraints.
 So we need to use the superclass constraint to fix ..."

Presumably that's the mechanism that induces FunDeps
from supeclass constraints.

Is that behaviour officially documented somewhere?

(I remember when Type Families and (~) Constraints
 were first released, they weren't available superclass.
 Then there were a couple of releases
 you could put superclass constraints,
 but they weren't effective.)


AntC


More information about the Glasgow-haskell-users mailing list