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

A silly mistake but the compiler wasn't helpful with type error #2337

Open
badlydrawnrob opened this issue Sep 6, 2024 · 1 comment
Open

Comments

@badlydrawnrob
Copy link

badlydrawnrob commented Sep 6, 2024

Quick Summary: Working too late into the night and stupidly used a type alias in the model record (without any arguments). The compiler caught the bug but error wasn't so useful (as in, I didn't know where to look when trying to fix it). Right now if you're not careful you're going to run into errors when you accidentally add a type to a record in certain cases (see below). A simple "This constructor function has no arguments" would've helped.

type SomeType
    = Nope | Yup Int

-- Throws a `I cannot find a `SomeType` variant:` error
{ test = SomeType }

-- Could silently fail (as it returns a function that takes an argument)
{ test = Yup }

Should some of these cases be disallowed?

SSCCE

Screenshot 2024-09-05 at 23 52 24 Screenshot 2024-09-05 at 23 52 08
  • Elm: 0.19.1
  • Browser: n/a
  • Operating System: MacOs Monterey 12.7.6

Additional Details

I caveat this with the fact that the Elm compiler is a godsend and has caught and helped me fix so many silly mistakes! That's so important, I've dabbled with Purescript and the repl errors are so unhelpful.

Copy link

github-actions bot commented Sep 6, 2024

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

@badlydrawnrob badlydrawnrob changed the title A silly mistake but the compiler wasn't helpful A silly mistake but the compiler wasn't helpful with type error Sep 6, 2024
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