elm/compiler

Identity type alias causes problems

Heimdell opened this issue · 2 comments

Quick Summary:

I entered an identity type alias, but elm refuses to unify LHS and RHS of the type alias later.

SSCCE

module Both.Msg exposing (..)

type alias Msg a = a

make : a -> Msg a
make = identity

=>

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

6| make = identity
          ^^^^^^^^
This `identity` value is a:

    a -> a

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

    a -> Msg a
  • Elm: 0.19.1
  • Browser: irrelevant
  • Operating System: irrelevant

Additional Details

Msg a and a, for all a, by definition, have to be the same type. Yet, Elm refuses to acknowledge that anything a is also Msg a.

Funny thing, the code

module Both.Msg exposing (..)

type alias Msg a = a

make : Msg a -> a
make = identity

compiles just fine.

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.

Duplicate of #2252