json-autotype 3.0.4 → 3.0.5
raw patch · 4 files changed
+20/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: displaySplitTypes :: Map Text Type -> Text
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: formatType :: Type -> DeclM Text
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: instance GHC.Classes.Eq Data.Aeson.AutoType.CodeGen.HaskellFormat.DeclState
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: instance GHC.Classes.Ord Data.Aeson.AutoType.CodeGen.HaskellFormat.DeclState
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: instance GHC.Generics.Generic Data.Aeson.AutoType.CodeGen.HaskellFormat.DeclState
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: instance GHC.Show.Show Data.Aeson.AutoType.CodeGen.HaskellFormat.DeclState
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: normalizeFieldName :: Text -> Text -> Text
+ Data.Aeson.AutoType.CodeGen.HaskellFormat: normalizeTypeName :: Text -> Text
Files
- changelog.md +6/−0
- json-autotype.cabal +4/−4
- src/Data/Aeson/AutoType/CodeGen/Haskell.hs +5/−1
- src/Data/Aeson/AutoType/CodeGen/HaskellFormat.hs +5/−4
changelog.md view
@@ -1,5 +1,11 @@ Changelog =========+ 3.0.5 Mar 2020+ * Using package import from `run-haskell-module` by default.+ * Expose commonly used functions for:+ - normalizing Haskell type names,+ - formatting JSON Autotype types in Haskell+ 3.0.4 Mar 2020 * Do not try to test compilation when module is written to stdout. * Update lens dependency bounds
json-autotype.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: af938ea296f62f09d60f03ea60cdfdde371fe189c480ae671ed0c9d1aeea86b5+-- hash: fb4adc71d7680a6ad92e8ac005c8302728f695d5a933e624e6b48ffb55d2787e name: json-autotype-version: 3.0.4+version: 3.0.5 synopsis: Automatic type declaration for JSON input data description: Generates datatype declarations with Aeson''s ''Data.Aeson.FromJSON'' .@@ -54,7 +54,7 @@ author: Michal J. Gajda maintainer: simons@cryp.to, mjgajda@gmail.com-copyright: Copyright by Michal J. Gajda '2014-'2019+copyright: Copyright by Migamake '2014-'2020 category: Data, Tools build-type: Simple extra-source-files:@@ -83,6 +83,7 @@ Data.Aeson.AutoType.CodeGen Data.Aeson.AutoType.Extract Data.Aeson.AutoType.Format+ Data.Aeson.AutoType.CodeGen.HaskellFormat Data.Aeson.AutoType.Pretty Data.Aeson.AutoType.Split Data.Aeson.AutoType.Type@@ -94,7 +95,6 @@ Data.Aeson.AutoType.CodeGen.ElmFormat Data.Aeson.AutoType.CodeGen.Generic Data.Aeson.AutoType.CodeGen.Haskell- Data.Aeson.AutoType.CodeGen.HaskellFormat Data.Aeson.AutoType.Plugin.Subtype Paths_json_autotype hs-source-dirs:
src/Data/Aeson/AutoType/CodeGen/Haskell.hs view
@@ -109,8 +109,12 @@ runHaskellModule :: FilePath -> [String] -> IO ExitCode runHaskellModule = Run.runHaskellModule +defaultHaskellOpts :: Run.RunOptions+defaultHaskellOpts = def { Run.additionalPackages = ["json-alt", "aeson"]+ }+ runHaskellModuleStrict :: FilePath -> [String] -> IO ExitCode runHaskellModuleStrict = Run.runHaskellModule' opts where- opts = def { Run.compileArgs = ["-Wall", "-Werror"] }+ opts = def { Run.compileArgs = ["-Wall", "-Werror"]}
src/Data/Aeson/AutoType/CodeGen/HaskellFormat.hs view
@@ -7,7 +7,8 @@ {-# LANGuaGE FlexibleContexts #-} -- | Formatting type declarations and class instances for inferred types. module Data.Aeson.AutoType.CodeGen.HaskellFormat(- displaySplitTypes, normalizeTypeName+ displaySplitTypes, normalizeTypeName,+ normalizeFieldName, formatType ) where import Control.Arrow ((&&&))@@ -155,10 +156,10 @@ -- from within a dictionary keyed with first argument, -- into a name of Haskell record field (hopefully distinct from other such selectors.) normalizeFieldName :: Text -> Text -> Text-normalizeFieldName identifier = escapeKeywords .- uncapitalize .+normalizeFieldName identifier = escapeKeywords .+ uncapitalize . (normalizeTypeName identifier `Text.append`) .- normalizeTypeName+ normalizeTypeName keywords :: Set Text keywords = Set.fromList ["kind", "type", "data", "module", "class", "where", "let", "do"]