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

Generate a given quantified constraint? #6

Closed
gelisam opened this issue Jun 6, 2020 · 1 comment
Closed

Generate a given quantified constraint? #6

gelisam opened this issue Jun 6, 2020 · 1 comment

Comments

@gelisam
Copy link
Owner

gelisam commented Jun 6, 2020

According to this note, it's possible for a plugin to generate new given constraints. Can we simply add quantified constraints like forall xs ys zs. ((xs ++ ys) ++ zs) ~ (xs ++ (ys ++ zs)) and then let ghc figure out whether it needs to apply them and avoid cycles? If that works, that would make using this library much safer, would make the implementation a lot simpler, and would probably support tricky wanted/given cases like in #3 !

@gelisam
Copy link
Owner Author

gelisam commented Jun 12, 2020

Manually adding such a quantified constraint is illegal:

-- Illegal type synonym family application ‘ys ++ '[]’ in
-- instance ((ys ++ '[]) ~ ys) in the quantified constraint
-- ‘forall (ys :: [*]). (ys ++ '[]) ~ ys’
foo :: (forall ys. (ys ++ '[]) ~ ys)
    => ((xs ++ '[]) ~ xs => r)
    -> r
foo r = r

So adding it automatically will be illegal too. Closing.

@gelisam gelisam closed this as completed Jun 12, 2020
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