error-message-catalog icon indicating copy to clipboard operation
error-message-catalog copied to clipboard

Confusion between type name and variant name shadowing

Open wolfadex opened this issue 4 years ago • 0 comments

There are periodically users of Elm who write code like

type Change
    = Increment

type Increment
    = ByOne
    | ByTwo

and are confused that the type Increment doesn't correspond to the variant Increment. They don't realize that they actually need to write

type Change
    = Increment Increment

type Increment
    = ByOne
    | ByTwo

to get their intended result.

real world example from May 20th, 2021

wolfadex avatar May 20 '21 21:05 wolfadex