packages feed

aeson-typescript 0.1.2.0 → 0.1.3.0

raw patch · 2 files changed

+20/−4 lines, 2 filesdep ~th-abstractionPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: th-abstraction

API changes (from Hackage documentation)

Files

aeson-typescript.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 83048fde34ef53f89f474bee2dd196c419df594d19b72601088cc9694dd4be82+-- hash: c6fb058c83889fc039a860d05177c52295c974f6ccb536cad58fdd015c161359  name:           aeson-typescript-version:        0.1.2.0+version:        0.1.3.0 synopsis:       Generate TypeScript definition files from your ADTs description:    Please see the README on Github at <https://github.com/codedownio/aeson-typescript#readme> category:       Text, Web, JSON@@ -43,7 +43,7 @@     , mtl     , template-haskell     , text-    , th-abstraction <0.3+    , th-abstraction <0.4     , unordered-containers   exposed-modules:       Data.Aeson.TypeScript.TH@@ -76,7 +76,7 @@     , template-haskell     , temporary     , text-    , th-abstraction <0.3+    , th-abstraction <0.4     , unordered-containers   other-modules:       HigherKind
src/Data/Aeson/TypeScript/TH.hs view
@@ -197,9 +197,15 @@         1 -> [ConT ''T]         n -> take (length datatypeVars) [ConT ''T1, ConT ''T2, ConT ''T3, ConT ''T4, ConT ''T5, ConT ''T6, ConT ''T7, ConT ''T8, ConT ''T9, ConT ''T10] +#if MIN_VERSION_th_abstraction(0,3,0)+  let subMap = M.fromList $ zip (catMaybes $ fmap getFreeVariableName datatypeInstTypes) templateVarsToUse+  let fullyQualifiedDatatypeInfo = (datatypeInfo {datatypeInstTypes = templateVarsToUse+                                                 , datatypeCons = fmap (applySubstitution subMap) datatypeCons})+#else   let subMap = M.fromList $ zip (catMaybes $ fmap getFreeVariableName datatypeVars) templateVarsToUse   let fullyQualifiedDatatypeInfo = (datatypeInfo {datatypeVars = templateVarsToUse                                                  , datatypeCons = fmap (applySubstitution subMap) datatypeCons})+#endif   getTypeFn <- getTypeExpression fullyQualifiedDatatypeInfo >>= \expr -> return $ FunD 'getTypeScriptType [Clause [WildP] (NormalB expr) []]   getDeclarationFn <- getDeclarationFunctionBody options name fullyQualifiedDatatypeInfo   let fullyGenericInstance = mkInstance [] (AppT (ConT ''TypeScript) (ConT name)) [getTypeFn, getDeclarationFn]@@ -207,7 +213,11 @@   otherInstances <- case length datatypeVars > 0 of     True -> do       otherGetTypeFn <- getTypeExpression datatypeInfo >>= \expr -> return $ FunD 'getTypeScriptType [Clause [WildP] (NormalB expr) []]+#if MIN_VERSION_th_abstraction(0,3,0)+      return [mkInstance (fmap getDatatypePredicate datatypeInstTypes) (AppT (ConT ''TypeScript) (foldl (\x y -> AppT x y) (ConT name) datatypeInstTypes)) [otherGetTypeFn]]+#else       return [mkInstance (fmap getDatatypePredicate datatypeVars) (AppT (ConT ''TypeScript) (foldl (\x y -> AppT x y) (ConT name) datatypeVars)) [otherGetTypeFn]]+#endif     False -> return []    return $ fullyGenericInstance : otherInstances@@ -297,9 +307,15 @@ -- | Get an expression to be used for getTypeScriptType. -- For datatypes of kind * this is easy, since we can just evaluate the string literal in TH. -- For higher-kinded types, we need to make an expression which evaluates the template types and fills it in.+#if MIN_VERSION_th_abstraction(0,3,0) getTypeExpression :: DatatypeInfo -> Q Exp+getTypeExpression (DatatypeInfo {datatypeInstTypes=[], ..}) = return $ stringE $ getTypeName datatypeName+getTypeExpression (DatatypeInfo {datatypeInstTypes=vars, ..}) = do+#else+getTypeExpression :: DatatypeInfo -> Q Exp getTypeExpression (DatatypeInfo {datatypeVars=[], ..}) = return $ stringE $ getTypeName datatypeName getTypeExpression (DatatypeInfo {datatypeVars=vars, ..}) = do+#endif   let baseName = stringE $ getTypeName datatypeName   let typeNames = ListE [getTypeAsStringExp typ | typ <- vars]   let headType = AppE (VarE 'head) typeNames