elm-bridge 0.7.0 → 0.8.0
raw patch · 3 files changed
+20/−16 lines, 3 files
Files
- CHANGELOG.md +6/−2
- elm-bridge.cabal +1/−1
- src/Elm/Module.hs +13/−13
CHANGELOG.md view
@@ -1,11 +1,15 @@+# v0.8.0++ * Directly support integer keys in dictionnaries, thanks to odanoboru+ # v0.7.0 * Support for GHC 9 # v0.6.0 - * Support for Elm 0.19 - + * Support for Elm 0.19+ # v0.5.2 * Fix a bug about tuples.
elm-bridge.cabal view
@@ -1,5 +1,5 @@ name: elm-bridge-version: 0.7.0+version: 0.8.0 synopsis: Derive Elm types and Json code from Haskell types, using aeson's options description: Building the bridge from Haskell to Elm and back. Define types once, and derive the aeson and elm functions at the same time, using any aeson
src/Elm/Module.hs view
@@ -118,23 +118,23 @@ ETyApp (ETyCon (ETCon "Set")) s -> checkSet $ defaultTypeAlterations s ETyApp (ETyApp (ETyCon (ETCon "HashMap")) k) v -> checkMap (defaultTypeAlterations k) (defaultTypeAlterations v) ETyApp (ETyApp (ETyCon (ETCon "THashMap")) k) v -> checkMap (defaultTypeAlterations k) (defaultTypeAlterations v)+ ETyApp (ETyCon (ETCon "IntMap")) v -> checkMap int (defaultTypeAlterations v) ETyApp (ETyApp (ETyCon (ETCon "Map")) k) v -> checkMap (defaultTypeAlterations k) (defaultTypeAlterations v) ETyApp (ETyApp (ETyCon (ETCon "Tagged")) _) v -> defaultTypeAlterations v ETyApp x y -> ETyApp (defaultTypeAlterations x) (defaultTypeAlterations y)- ETyCon (ETCon "Integer") -> ETyCon (ETCon "Int")- ETyCon (ETCon "Natural") -> ETyCon (ETCon "Int")- ETyCon (ETCon "Text") -> ETyCon (ETCon "String")- ETyCon (ETCon "Vector") -> ETyCon (ETCon "List")- ETyCon (ETCon "Double") -> ETyCon (ETCon "Float")- ETyCon (ETCon "UTCTime") -> ETyCon (ETCon "Posix")+ ETyCon (ETCon "Integer") -> int+ ETyCon (ETCon "Natural") -> tc "Int"+ ETyCon (ETCon "Text") -> tc "String"+ ETyCon (ETCon "Vector") -> tc "List"+ ETyCon (ETCon "Double") -> tc "Float"+ ETyCon (ETCon "UTCTime") -> tc "Posix" _ -> t where- isString (ETyCon (ETCon "String")) = True- isString _ = False- isComparable (ETyCon (ETCon n)) = n `elem` ["String", "Int"]- isComparable _ = False -- TODO check what Elm actually uses+ int = tc "Int"+ isComparable (ETyCon (ETCon n)) = n `elem` ["String", "Int", "Float", "Posix", "Char"]+ isComparable _ = False -- TODO Lists and Tuples of comparable types tc = ETyCon . ETCon- checkMap k v | isString k = ETyApp (ETyApp (tc "Dict") k) v+ checkMap k v | isComparable k = ETyApp (ETyApp (tc "Dict") k) v | otherwise = ETyApp (tc "List") (ETyApp (ETyApp (ETyTuple 2) k) v)- checkSet s | isComparable s = ETyApp (ETyCon (ETCon "Set")) s- | otherwise = ETyApp (ETyCon (ETCon "List")) s+ checkSet s | isComparable s = ETyApp (tc "Set") s+ | otherwise = ETyApp (tc "List") s