[E1017] CONSTRUCTOR CLASH

A bare constructor could mean two different constructors, and an import picked one of them without saying so.

-- CONSTRUCTOR CLASH ------------------------------- src/Main.sky:12:5 [E1017]

12 |     Error E.Io { message = "x", details = Nothing }
   |     ^^^^^ this `Error` has 2 meanings

The constructor `Error` here could mean the `Error` from `Sky.Config` or
`Sky.Core.Error` (the Prelude's `Error`). The import of `Sky.Config` puts its
`Error` in front of the other, so this reference would silently mean
`Sky.Config.Error`, and a program that meant the other one fails later with an
error that never names the import. Sky rejects it instead of picking one.
Qualify the reference: write `Config.Error` for the one from `Sky.Config` or
`E.Error` for the one from `Sky.Core.Error`. An import whose `Error` is never
written unqualified needs no change.

Added in v0.27.18.

What it covers

You wroteIt is an error because
import Sky.Config as Config exposing (LogLevel(..)), then a bare ErrorLogLevel has an Error constructor, and Error is also the Prelude's Error
import Lib.A exposing (Colour(..)) and import Lib.B exposing (..), both with a Red constructor, then a bare Redthe named import wins over the (..) import with no message

It fires in an expression (Error kind info) and in a pattern (Error ->).

What it does not cover

Why it is an error

Before v0.27.18 the import won silently. A program written for the Prelude's Error built a LogLevel instead, and the error the user saw was type mismatch: LogLevel vs ErrorKind -> _, which says nothing about the import that caused it. In a pattern the wrong constructor picks the wrong branch. Elm reports a constructor exposed twice as ambiguous.

How to fix it

Qualify the reference:

import Sky.Config as Config exposing (LogLevel(..))
import Sky.Core.Error as E


level : LogLevel
level =
    Config.Error


failure : E.Error
failure =
    E.Error E.Io { message = "disk full", details = Nothing }

A pattern takes the same qualified form: Config.Error ->.