Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module exposing in Elm 0.18

Tags:

types

elm

I have an elm module of Types that consists of types and type aliases Foo, Bar and Baz. When I export everything like so, the code works:

module Types exposing (..)

However, if I include all of the types explicitly, the code breaks.

module Types exposing (Foo, Bar, Baz)

This is also true of the import statements on the consuming file; both need to be exposing (..)

What is the difference between these two approaches?

like image 670
Mark Karavan Avatar asked Sep 10 '17 00:09

Mark Karavan


1 Answers

I'm only learning Elm myself very recently but it sounds like since one of your types (Msg) is being defined as a union type that you will need to use the Msg(..) syntax when exporting this type.

module Types exposing (Msg (..))

type Msg = FirstAction | SecondAction | ThirdAction

Or in the case of importing the union type.

import Types exposing (Msg (..))

Please see GitHub issue #968 for an explanation of why this is required for union types.

like image 131
jpierson Avatar answered Oct 09 '22 12:10

jpierson