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

Allow instance definitions with variables constrained on local classes #1394

Open
YarinHeffes opened this issue Feb 20, 2025 · 0 comments
Open
Labels
good first issue Good for newcomers type system The Coalton type system

Comments

@YarinHeffes
Copy link
Collaborator

Currently, the following block does not compile,

(coalton-toplevel
  (define-class (C :T)
    (m (:T -> :T -> Boolean)))
  (define-instance (C :T => Eq :T)
    (define (== x y) (m x y)))

because the instance definition must either be an instance of a class from the current package or refer to a type from the current package. However, it is not currently sufficient for the instance to refer to type variables constrained by classes from the current package.

error: Invalid orphan instance
...
instances must be defined in the same package as their class or reference one or more types in their defining package
@YarinHeffes YarinHeffes added good first issue Good for newcomers type system The Coalton type system labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type system The Coalton type system
Projects
None yet
Development

No branches or pull requests

1 participant