
On 2 February 2016 7:22:31 AM AEDT, "Wojtek Narczyński"
On 01.02.2016 20:19, Imants Cekusins wrote:
in instance (Eq a, Eq q, Typeable a, Typeable q, AtmAcct a, Against q) => Match a q where
ANY is q because instance Against ANY
But I require q to be Eq and Typeable, and ANY is none of those two?
-- Wojtek _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
But there *could* be other instances the compiler just can't see at the moment (because it's in another module that's not imported). Someone else could then import this module and that other module and observe inconsistent instances. To avoid that problem, the type class system *never* commits to "negative" information; if an instance choice is only valid because there *isn't* a possible instance in scope then that instance choice is not valid after all. A consequence is that constraints on an instance have to be ignored when choosing an instance (they still might make the choice be an error after it is chosen, but they don't affect which instance is selected). And so an instance like: ... => Match a q is the *only* possible instance you can write, since it will match everything regardless of the ... (unless you use overlapping instances).