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

Function signatures with trait dependencies and default arguments result in compiler error #2994

Closed
heueristik opened this issue Sep 4, 2024 · 1 comment · Fixed by #2998

Comments

@heueristik
Copy link

A function foo

foo {A} (value : A) {maybeValue : Maybe Nat := nothing} : Nat := 123;

using default arguments compiles, whereas a function bar

trait
type SomeTrait A := mkSomeTrait {baz : A -> Nat};

bar {A} {{SomeTrait A}} (value : A) {maybeValue : Maybe Nat := nothing} : Nat := 123;

requiring SomeTrait does not compile and throws an error

error:
The expression nothing {_} has type:
  Maybe _
but is expected to have type:
  A
  • OS: macOS
  • Juvix Version: v0.6.5-2b4520c
@janmasrovira
Copy link
Collaborator

I've fixed it in #2998.

Before the next release, one can workaround this problem by giving a name to the trait argument. E.g.

bar {A} {{dummy : SomeTrait A}} (value : A) {maybeValue : Maybe Nat := nothing} : Nat := 123;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants