elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Importing union tag as a type #219

Open mgold opened 7 years ago

mgold commented 7 years ago

If I try to import a union tag as if it was a type, I'm told the module doesn't expose it.

SSCCE. Option.elm:

module Option exposing (Option(Some, None))

type Option a
    = Some a
    | None

Import statement in another file:

import Option exposing (Option, None)

The correct syntax is of course import Option exposing (Option(None)), but the incorrect version produces:

-- NAMING ERROR --------------------------------------------------- Main.elm

Module `Option` does not expose `None`

3| import Option exposing (Option, None)

Ideally, the compiler would recognize what I'm trying to do and suggest import Option exposing (Option, None) (or perhaps with Some in there, or both). But it would be an improvement if it said "the type None", which would be a clue.