Skip to content

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

@badlydrawnrob

Description

@badlydrawnrob

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions