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

Incorrect resolution of foldLeft #3867

Open
gomain opened this issue Mar 15, 2023 · 3 comments
Open

Incorrect resolution of foldLeft #3867

gomain opened this issue Mar 15, 2023 · 3 comments

Comments

@gomain
Copy link

gomain commented Mar 15, 2023

For some reason, unqualified foldLeft resolved to Array.foldLeft

count : [a] -> Nat
count = foldLeft (n _ -> n + 1) 0 -- error expecting to find data.Array
count : [a] -> Nat
count = List.foldLeft (n _ -> n + 1) 0 -- ok
@aryairani
Copy link
Contributor

Thanks for reporting @gomain, it is meant to just work.

@gomain
Copy link
Author

gomain commented Mar 18, 2023

@aryairani I'm also experiencing, this

unique type SumType = A | B

isA : SumType -> Boolean
isA = cases
  A -> true -- don't need to qualify constructor
  _ -> false

but when

unique type SumType = A | B 
unique type AlsoSumType = A | B

isA : SumType -> Boolean
isA = cases
  A -> true  -- don't know constructor named A
  _ -> false
unique type SumType = A | B 
unique type AlsoSumType = A | B

isA : SumType -> Boolean
isA = cases
  SumType.A -> true -- qualify with type name, ok
  _ -> false

Not sure what to expect here.

@gomain
Copy link
Author

gomain commented Mar 19, 2023

Another case where TDNR fails

unique type Type = { name: Nat }
name : Text -> Text
name = cases _ -> "bla"
>name (Type 2) -- expected Text

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

No branches or pull requests

2 participants