Barney Hilken: > Similarly, it Lacks all the fields which r Lacks, except for N > itself. This is where we really need the ordering :<: to ensure that > m is not equal to N. There are two cases, m :<: N: > > > instance m :<: N, Lacks m r => Lacks m (N a r) where > > type Extend m b (N a r) = N a (Extend m b r) > > extend mm y (N x t) = N x (extend mm y t) > > and N :<: m: > > > instance N :<: m => Lacks m (N a r) where > > type Extend m b (N a r) = m b (N a r) > > extend mm y (N x t) = mm y (N x t)
This is problematic as the instance heads are distinguished only by the context; ie, both instances are for `Lacks m (N a r)'. Haskell's instance selection mechanism (with or without associated types) selects instances purely by looking at the arguments of the class; hence, you cannot use instance context as a kind of guard to guide instance selection. Manuel _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
