From 0e2a0941cd32bb87ee9e7780882008b762cb8e2d Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Thu, 11 Mar 2021 23:44:47 +0100 Subject: [PATCH] Format unions --- create-dependency/src/DependencyCreator.elm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/create-dependency/src/DependencyCreator.elm b/create-dependency/src/DependencyCreator.elm index 21ceea5a..875059b6 100644 --- a/create-dependency/src/DependencyCreator.elm +++ b/create-dependency/src/DependencyCreator.elm @@ -67,6 +67,14 @@ formatAlias alias_ = }""" +formatUnion union = + "{ name = " ++ stringify union.name ++ """ + , args = """ ++ listOfThings stringify union.args ++ """ + , comment = """ ++ stringify union.comment ++ """ + , tags = """ ++ listOfThings (\( name, types ) -> "( " ++ stringify name ++ ", " ++ listOfThings formatType types ++ ")") union.tags ++ """ + }""" + + formatType : Elm.Type.Type -> String formatType type_ = case type_ of @@ -125,7 +133,7 @@ formatModule mod = "{ name = " ++ stringify mod.name ++ """ , comment = """ ++ stringify mod.comment ++ """ , aliases = """ ++ listOfThings formatAlias mod.aliases ++ """ - , unions = [] + , unions = """ ++ listOfThings formatUnion mod.unions ++ """ , binops = [] , values = [] }"""