compiler icon indicating copy to clipboard operation
compiler copied to clipboard

error on correct code using `Identity a = a`

Open lue-bird opened this issue 3 years ago • 1 comments

When a function annotation includes a type that contains

type alias Identity a =
    a

with an inferred type variable

map : (a -> b) -> Identity a -> Identity b
map change =
    change

elm falsely throws an error

Something is off with the body of the `map` definition:

    map change = change
                 ^^^^^^
This `change` value is a:

    a -> b

But the type annotation on `map` says it should be:

    Identity a -> Identity b

(on "why and when would you could want Identity")

lue-bird avatar Apr 08 '22 15:04 lue-bird

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.

github-actions[bot] avatar Apr 08 '22 15:04 github-actions[bot]