You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 the A 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) =oB
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 branch
f ::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::RWs=>Arrays-oInt
g arr =do..-- RW s constraint here()<- writeArray 00 arr
..-- RW s constraint might be the same or different()<- writeArray 00 arr -- - which RW dictionary?Return0-- problem: changing =o to => causes an ambiguity error-- in functions, changing ->. to -> doesn’t cause an error
The text was updated successfully, but these errors were encountered:
In current GHC, constaint resolution is parallel, so that in
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.
We need to be able to typecheck all branches of a
case
/if
with one occurrence of each linear constraint in each branchThe text was updated successfully, but these errors were encountered: