@@ -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{- | -}
285292type CustomTypeBuilder case_ make_
286293 = CustomTypeBuilder
@@ -295,9 +302,9 @@ type CustomTypeBuilder case_ make_
295302
296303{- | -}
297304customTypeAdvanced : 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