Coder Social home page Coder Social logo

Comments (1)

dillonkearns avatar dillonkearns commented on June 25, 2024

Another use case to consider:

In elm-pages I'm using this pattern which some package authors use to keep some internals accessible within the package. I have a type alias that is in an "exposed module" in the package. It has the same name as the actual internal definition.

import DataSource.Internal.Glob exposing (Glob(..))

type alias Glob a =
    DataSource.Internal.Glob.Glob a

I get this error

(fix) NoModuleOnExposedNames: Module used on exposed type `Glob`.

224| type alias Glob a =
225|     DataSource.Internal.Glob.Glob a
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It is not necessary to use the module here as `Glob` was exposed on import.

You should remove the module from this call, or remove the name from the import
.. exposing list.

However, that would result in an invalid Elm module if I followed that fix:

-- ALIAS PROBLEM - elm-pages/src/DataSource/Glob.elm

This type alias is recursive, forming an infinite type!

224| type alias Glob a =
                ^^^^
When I expand a recursive type alias, it just keeps getting bigger and bigger.
So dealiasing results in an infinitely large type! Try this instead:

    type Glob a =
        Glob
            (Glob a)

Hint: This is kind of a subtle distinction. I suggested the naive fix, but I
recommend reading <https://elm-lang.org/0.19.1/recursive-alias> for ideas on how
to do better.

from elm-review-imports.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.