diff options
Diffstat (limited to 'ddl/Language.hs')
-rw-r--r-- | ddl/Language.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ddl/Language.hs b/ddl/Language.hs index 989314a..afa87fa 100644 --- a/ddl/Language.hs +++ b/ddl/Language.hs | |||
@@ -83,7 +83,17 @@ data Type | |||
83 | 83 | ||
84 | collectTypes :: AliasMap -> ModuleDef -> Set Type | 84 | collectTypes :: AliasMap -> ModuleDef -> Set Type |
85 | collectTypes aliasMap ModuleDef{..} = Set.fromList $ map (normalize aliasMap) $ concat | 85 | collectTypes aliasMap ModuleDef{..} = Set.fromList $ map (normalize aliasMap) $ concat |
86 | [Data dataName : [fieldType | ConstructorDef{..} <- constructors, Field{..} <- fields] | DataDef{..} <- definitions] | 86 | [Data dataName : concatMap flatType [fieldType | ConstructorDef{..} <- constructors, Field{..} <- fields] | DataDef{..} <- definitions] |
87 | where | ||
88 | flatType t = case t of | ||
89 | V2 a -> [t,a] | ||
90 | V3 a -> [t,a] | ||
91 | V4 a -> [t,a] | ||
92 | Array a -> [t,a] | ||
93 | List a -> [t,a] | ||
94 | Maybe a -> [t,a] | ||
95 | Map k v -> [t,k,v] | ||
96 | _ -> [t] | ||
87 | 97 | ||
88 | parens :: String -> String | 98 | parens :: String -> String |
89 | parens a | 99 | parens a |