GHC allow-overlapping-instances (PART II)

Wolfgang Jeltsch wolfgang at jeltsch.net
Fri Oct 3 13:33:53 EDT 2003


Am Freitag, 3. Oktober 2003, 10:22 schrieb Kenny:
> [...]

> But how about
> instance C (AND (OR r1 r2) (OR r1 r2)) (OR r1 r2)
> --[1]
>
> instance ( C (AND r1 r3) r5
> 	 , C (AND r2 r4) r6
> 	 ) => C (AND (OR r1 r2) (OR r3 r4)) (OR r5 r6) --[2]
>
> GHC allows this with -fallow-overlapping-instances flag on, but why? Is [1]
> more specific than [2] or the other way round?

RTFM, i.e., the GHC User's Guide. Which instance is considered more special 
depends only on what comes after the class identifier, i.e., it does not 
depend on the context. So [1] is more special.

> [...]

Wolfgang



More information about the Haskell mailing list