Search code examples
elm

What does `exposing (..)` mean in Elm?


I'm trying to understand the very first Elm example and it has this:

import Graphics.Element exposing (..)

What does exposing (..) mean?


Solution

  • exposing (..) allows you to call all the functions in the package directly.

    For example, if SamplePackage had the functions x and y, import SamplePackage would let you call SamplePackage.x and SamplePackage.y, while import SamplePackage exposing (..) would let you call x and y without specifying their containing package.

    Note that import SamplePackage exposing (x) would let you call x directly, but you would still need to call y with SamplePackage.y. Likewise, import SamplePackage exposing (x, y) would let you call x and y, but not any other functions in the package.