Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some difficulties to keep track of #4

Open
aspiwack opened this issue Jan 17, 2019 · 0 comments
Open

Some difficulties to keep track of #4

aspiwack opened this issue Jan 17, 2019 · 0 comments

Comments

@aspiwack
Copy link
Member

aspiwack commented Jan 17, 2019

  • 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) =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 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 :: 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant