Skip to content

Instantly share code, notes, and snippets.

@mthadley
Last active October 31, 2019 07:02
Show Gist options
  • Save mthadley/16e7ff2a2503554c8101638e49896f9f to your computer and use it in GitHub Desktop.
Save mthadley/16e7ff2a2503554c8101638e49896f9f to your computer and use it in GitHub Desktop.
Elm <-> Haskell Import Cheatsheet

Elm <-> Haskell Import Cheatsheet

A small cheatsheet to help you translate between Haskell and Elm style imports.

Elm Haskell
import Foo.Bar import qualified Foo.Bar
import Foo.Bar as Bar import qualified Foo.Bar as Bar
import Foo.Bar exposing (foo) import Foo.Bar (foo)
import Foo.Bar exposing (..) import Foo.Bar
Elm does not have anything like hiding import Foo.Bar hiding (foo)

Best Practices

You should generally avoid polluting the namespace of a module using exposing (..) or the Haskell equivalent. When you have multiple imports of this style, it can make it harder to track down where certain symbols are coming from. Some common exceptions are making use of a specific DSL (like Html or Css in Elm), or using a different prelude in Haskell (like protolude).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment