Hi all, Here I change the instances from
instance C (OR T r) T instance C (OR r T) T to instance C (OR T r) T instance C (OR T T) T
and it compiles when allow-overlapping-instances is turned on. now I understand that GHC in fact allow-overlapping-instances if one is more specific than the other. 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? I am confused. -Kenny --- H X <haskellmail@yahoo.com.sg> wrote: > Date: Mon, 29 Sep 2003 13:10:25 +0800 (CST)
From: H X <haskellmail@yahoo.com.sg> Subject: GHC allow-overlapping-instances To: haskell@haskell.org
Hi,
Does anyone have ever used this option? I see no difference when I present this program to ghc with -fallow-overlapping-instances on/off:
module Test where
data T = T data F = F
data OR a b = OR a b data AND a b = AND a b
class C a b | a -> b
instance C (OR T r) T instance C (OR r T) T
instance C (AND F r) F instance C (AND r F) F
-Kenny
__________________________________________________ Do You Yahoo!? A free party for the most "shiok" photo! http://sg.yahoo.com/shiok
__________________________________________________ Do You Yahoo!? A free party for the most "shiok" photo! http://sg.yahoo.com/shiok