aeson-typescript 0.3.0.0 → 0.3.0.1
raw patch · 15 files changed
+34/−29 lines, 15 filesdep +string-interpolatedep −interpolatedep ~th-abstractionPVP ok
version bump matches the API change (PVP)
Dependencies added: string-interpolate
Dependencies removed: interpolate
Dependency ranges changed: th-abstraction
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−1
- README.md +1/−1
- aeson-typescript.cabal +7/−9
- src/Data/Aeson/TypeScript/Formatting.hs +2/−2
- src/Data/Aeson/TypeScript/Instances.hs +1/−1
- src/Data/Aeson/TypeScript/Lookup.hs +1/−1
- src/Data/Aeson/TypeScript/TH.hs +7/−3
- src/Data/Aeson/TypeScript/Util.hs +4/−4
- test/Basic.hs +1/−1
- test/Formatting.hs +1/−1
- test/HigherKind.hs +1/−1
- test/Live.hs +1/−1
- test/TestBoilerplate.hs +1/−1
- test/TypeFamilies.hs +1/−1
- test/Util.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Change log +## 0.3.0.1++* Support GHC 9.0.1+ ## 0.3.0.0 * Update th-abstraction dependency to < 0.5 to support working with newer Stack LTS.@@ -16,4 +20,3 @@ ## 0.1.0.0 * Initial release.-
README.md view
@@ -29,7 +29,7 @@ Now we can use the newly created instances. ```haskell->>> putStrLn $ formatTSDeclarations $ getTypeScriptDeclaration (Proxy :: Proxy D)+>>> putStrLn $ formatTSDeclarations $ getTypeScriptDeclaration (Proxy :: Proxy (D T)) type D<T> = "nullary" | IUnary<T> | IProduct<T> | IRecord<T>;
aeson-typescript.cabal view
@@ -3,11 +3,9 @@ -- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 73021b1b79e95ae7e4b67a45fafb5d452d8ab05ae59d4071098e8628cf8f29e4 name: aeson-typescript-version: 0.3.0.0+version: 0.3.0.1 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@@ -18,9 +16,9 @@ copyright: 2021 CodeDown license: BSD3 license-file: LICENSE-tested-with:- GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2 build-type: Simple+tested-with:+ GHC == 9.0.1, GHC == 8.10.4, GHC == 8.10.3, GHC == 8.8.4, GHC == 8.8.3 extra-source-files: README.md CHANGELOG.md@@ -51,11 +49,11 @@ aeson , base >=4.7 && <5 , containers- , interpolate , mtl+ , string-interpolate , template-haskell , text- , th-abstraction <0.5+ , th-abstraction , unordered-containers default-language: Haskell2010 @@ -104,12 +102,12 @@ , directory , filepath , hspec- , interpolate , mtl , process+ , string-interpolate , template-haskell , temporary , text- , th-abstraction <0.5+ , th-abstraction , unordered-containers default-language: Haskell2010
src/Data/Aeson/TypeScript/Formatting.hs view
@@ -3,7 +3,7 @@ module Data.Aeson.TypeScript.Formatting where import Data.Aeson.TypeScript.Types-import Data.String.Interpolate.IsString+import Data.String.Interpolate import qualified Data.Text as T #if !MIN_VERSION_base(4,11,0)@@ -26,7 +26,7 @@ alternatives = T.intercalate " | " (fmap T.pack names) alternativesEnum = T.intercalate ", " $ [toEnumName entry | entry <- T.pack <$> names] alternativesEnumWithType = T.intercalate ", " $ [toEnumName entry <> "=" <> entry | entry <- T.pack <$> names]- enumType = [i|\n\ntype #{name} = keyof typeof #{typeNameModifier name};|]+ enumType = [i|\n\ntype #{name} = keyof typeof #{typeNameModifier name};|] :: T.Text toEnumName = T.replace "\"" "" formatTSDeclaration (FormattingOptions {..}) (TSInterfaceDeclaration interfaceName genericVariables members) =
src/Data/Aeson/TypeScript/Instances.hs view
@@ -12,7 +12,7 @@ import Data.HashMap.Strict import qualified Data.List as L import Data.Set-import Data.String.Interpolate.IsString+import Data.String.Interpolate import qualified Data.Text as T import qualified Data.Text.Lazy as TL import Data.Void
src/Data/Aeson/TypeScript/Lookup.hs view
@@ -19,7 +19,7 @@ import Data.Aeson.TypeScript.Instances () import Data.Aeson.TypeScript.Types import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import Language.Haskell.TH hiding (stringE) import qualified Language.Haskell.TH.Lib as TH
src/Data/Aeson/TypeScript/TH.hs view
@@ -48,7 +48,7 @@ Now we can use the newly created instances. @->>> putStrLn $ 'formatTSDeclarations' $ 'getTypeScriptDeclarations' (Proxy :: Proxy D)+>>> putStrLn $ 'formatTSDeclarations' $ 'getTypeScriptDeclarations' (Proxy :: Proxy (D T)) type D\<T\> = INullary\<T\> | IUnary\<T\> | IProduct\<T\> | IRecord\<T\>; @@ -158,7 +158,7 @@ import qualified Data.Map as M import Data.Maybe import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import Data.Typeable import Language.Haskell.TH hiding (stringE) import Language.Haskell.TH.Datatype@@ -181,7 +181,7 @@ assertExtensionsTurnedOn datatypeInfo' -- Plug in generic variables for all star free variables- let starVars = [name | (isStarType -> Just name) <- getDataTypeVars datatypeInfo']+ let starVars = [name | (isStarType -> Just _) <- getDataTypeVars datatypeInfo'] let templateVarsToUse = case length starVars of 1 -> [ConT ''T] _ -> take (length starVars) allStarConstructors@@ -312,7 +312,11 @@ name' <- lift $ newName (nameBase typeFamilyName <> "'") f <- lift $ newName "f"+#if MIN_VERSION_template_haskell(2,17,0)+ let inst1 = DataD [] name' [PlainTV f ()] Nothing [] []+#else let inst1 = DataD [] name' [PlainTV f] Nothing [] []+#endif tell [ExtraTopLevelDecs [inst1]] imageTypes <- lift $ getClosedTypeFamilyImage eqns
src/Data/Aeson/TypeScript/Util.hs view
@@ -8,7 +8,7 @@ import Data.Aeson.TypeScript.Types import qualified Data.List as L import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import qualified Data.Text as T import Language.Haskell.TH hiding (stringE) import Language.Haskell.TH.Datatype@@ -35,7 +35,7 @@ dropLeadingIFromInterfaceName :: TSDeclaration -> TSDeclaration dropLeadingIFromInterfaceName decl@(TSInterfaceDeclaration {interfaceName=('I':xs)}) = decl { interfaceName = xs } dropLeadingIFromInterfaceName decl@(TSTypeAlternatives {typeName=('I':xs)}) = decl { typeName = xs }-dropLeadingIFromInterfaceName x = x +dropLeadingIFromInterfaceName x = x lastNameComponent :: String -> String lastNameComponent x = T.unpack $ last $ T.splitOn "." (T.pack x)@@ -92,8 +92,8 @@ -- Check that necessary language extensions are turned on scopedTypeVariablesEnabled <- isExtEnabled ScopedTypeVariables kindSignaturesEnabled <- isExtEnabled KindSignatures- when (not scopedTypeVariablesEnabled) $ error [i|The ScopedTypeVariables extension is required; please enable it before calling deriveTypeScript. (For example: put {-# LANGUAGE ScopedTypeVariables #-} at the top of the file.)|]- when ((not kindSignaturesEnabled) && (length datatypeVars > 0)) $ error [i|The KindSignatures extension is required since type #{datatypeName} is a higher order type; please enable it before calling deriveTypeScript. (For example: put {-# LANGUAGE KindSignatures #-} at the top of the file.)|]+ when (not scopedTypeVariablesEnabled) $ error [i|The ScopedTypeVariables extension is required; please enable it before calling deriveTypeScript. (For example: put {-\# LANGUAGE ScopedTypeVariables \#-} at the top of the file.)|]+ when ((not kindSignaturesEnabled) && (length datatypeVars > 0)) $ error [i|The KindSignatures extension is required since type #{datatypeName} is a higher order type; please enable it before calling deriveTypeScript. (For example: put {-\# LANGUAGE KindSignatures \#-} at the top of the file.)|] #else assertExtensionsTurnedOn _ = return () #endif
test/Basic.hs view
@@ -19,7 +19,7 @@ import Data.Aeson.TypeScript.TH import Data.Aeson.TypeScript.Types import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import Prelude hiding (Double) import Test.Hspec
test/Formatting.hs view
@@ -9,7 +9,7 @@ import Data.Aeson.TypeScript.TH import Data.Aeson.TypeScript.Types import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import Test.Hspec data D = S | F deriving (Eq, Show)
test/HigherKind.hs view
@@ -21,7 +21,7 @@ import Data.Aeson.TypeScript.Types import Data.Monoid import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import Prelude hiding (Double) import Test.Hspec import Util
test/Live.hs view
@@ -23,7 +23,7 @@ import Data.Functor.Identity import Data.Kind import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import qualified Data.Text as T import Prelude hiding (Double)
test/TestBoilerplate.hs view
@@ -21,7 +21,7 @@ import Data.Functor.Identity import Data.Kind import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import Language.Haskell.TH hiding (Type) import Test.Hspec import Util
test/TypeFamilies.hs view
@@ -22,7 +22,7 @@ import Data.Aeson.TypeScript.Types import Data.Functor.Identity import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import qualified Data.Text as T import Prelude hiding (Double) import Test.Hspec
test/Util.hs view
@@ -7,7 +7,7 @@ import Data.Aeson.TypeScript.TH import qualified Data.ByteString.Lazy as B import Data.Proxy-import Data.String.Interpolate.IsString+import Data.String.Interpolate import qualified Data.Text as T import System.Directory import System.Environment