Search code examples
elm

Module import in Elm with and without (..)


I have seen a couple of examples using either syntax of:

import Browser exposing (..)

or

import Browser

Are these equivalent? Does the second syntax implicitly exposes everything?


Solution

  • No those are not equivalent.

    import Browser
    

    is a qualified import where

    import Browser exposing (..)
    

    is an unqualified import.

    When using qualified imports you still have to use the fully qualified names of the imported functions and types. With unqualified imports those become available without having to fully qualify them.

    See Elm Modules and Imports for a good introduction.