Is this a weird compiler bug or am I missing something?

Sorry that this isn’t the smallest repro example you’ve ever seen. I’ve got a compiler error that I don’t think should be an error:


If I switch the order of my successfulAttempts/failedAttempts binding and wasSuccessful, then it compiles, but I get a warning:

but of course if I replace yes: successfulAttempts with yes: _, I get another error

My understanding is that either of the top two images should have compiled without any errors or warnings. Can somebody help me understand what’s going on?
The repro can be found at purs-syntax-err/Main.purs at main · ntwilson/purs-syntax-err · GitHub

I’m able to get it working without any warnings at all with this very specific setup:

I think this is another instance of this compiler bug.

3 Likes

Is the warning for “name … introduced but not used” part of that same bug? I can’t get the warning to go away just by reordering statements (I did get it to go away by splitting my declarations between let bindings and where bindings)

1 Like

I think that warning would be this bug, which should now be fixed for the next release thanks to @nwolverson.

2 Likes

The warning is indeed the issue just fixed; if the binding ordering is considered to be a bug and fixed that warning will need to be fixed again, to my shame - I’ll make a note on that issue.

2 Likes