Skip to content

Commit 7a7b218

Browse files
authored
Merge pull request #123 from miniBill/expose-constructor
Add Elm.Declare.exposeConstructor
2 parents 5d6bc4f + 89068d5 commit 7a7b218

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/Elm/Declare.elm

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Elm.Declare exposing
55
, Value, value
66
, function
77
, Module, module_, with, withUnexposed
8-
, Annotation, alias, customType
8+
, Annotation, alias, customType, exposeConstructor
99
, toFile, include, withSubmodule
1010
, customTypeAdvanced, CustomType
1111
, variant0, variant1, variant2, variant3, variant4
@@ -110,7 +110,7 @@ And handle the imports and everything.
110110
111111
@docs Module, module_, with, withUnexposed
112112
113-
@docs Annotation, alias, customType
113+
@docs Annotation, alias, customType, exposeConstructor
114114
115115
@docs toFile, include, withSubmodule
116116
@@ -281,6 +281,13 @@ customType name variants =
281281
}
282282

283283

284+
{-| Expose the constructors of a custom type.
285+
-}
286+
exposeConstructor : Annotation -> Annotation
287+
exposeConstructor unexposed =
288+
{ unexposed | declaration = Elm.exposeConstructor unexposed.declaration }
289+
290+
284291
{-| -}
285292
type CustomTypeBuilder case_ make_
286293
= CustomTypeBuilder
@@ -295,9 +302,9 @@ type CustomTypeBuilder case_ make_
295302

296303
{-| -}
297304
customTypeAdvanced : String -> { exposeConstructor : Bool } -> make_ -> CustomTypeBuilder case_ make_
298-
customTypeAdvanced name { exposeConstructor } make_ =
305+
customTypeAdvanced name options make_ =
299306
CustomTypeBuilder
300-
{ exposeConstructor = exposeConstructor
307+
{ exposeConstructor = options.exposeConstructor
301308
, name = name
302309
, variants = []
303310
, make_ = make_

0 commit comments

Comments
 (0)