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

Ambiguous method error in class definition when method doesn't include both parameterized types #1273

Open
Izaakwltn opened this issue Oct 1, 2024 · 0 comments

Comments

@Izaakwltn
Copy link
Collaborator

When defining a class with multiple parameterized types, each method must employ both types.:

(coalton-toplevel

  (define-class (C :a :b)
    (m1 :a)
    (m2 (:a -> :b))))

Compiling returns:

  error: 
    (during macroexpansion of (COALTON-TOPLEVEL
      (DEFINE-CLASS #
        ...)))
    error: Ambiguous method
      --> <macroexpansion>:3:4
       |
     3 |      (M1 :A)
       |      ^^^^^^^ the method is ambiguous

This also errors:

(define-class (C :a :b)
    (m1 (Unit -> :a))
    (m2 (:a -> :b)))

This may be just a Hindley-Milner rule that I'm not yet privy to.

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