-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
-
In current GHC, constaint resolution is parallel, so that in
f :: A =o X f = (methA, methA)
both holes are solved independently (in fact, in this case, they are even the same hole!). But we really can't do that, because the use of the
A
dictionary in one precludes the use of theA
dictionary in the other. -
The constraint solver needs to be careful not to duplicate linear constraints (that is, it's not only an issue of constraint generation). e.g.
instance (A, A) =o B f :: A =o X f = methB -- should fail!
-
We need to be able to typecheck all branches of a
case
/if
with one occurrence of each linear constraint in each branchf :: A =o Bool -> X f b = if b then methA else methA -- ok! g :: A =o Bool -> X g b = if b then methA else noA -- should fail!
-
g :: RW s => Array s -o Int g arr = do .. -- RW s constraint here () <- writeArray 0 0 arr .. -- RW s constraint might be the same or different () <- writeArray 0 0 arr -- - which RW dictionary? Return 0 -- problem: changing =o to => causes an ambiguity error -- in functions, changing ->. to -> doesn’t cause an error
Metadata
Metadata
Assignees
Labels
No labels