packages feed

yamlparse-applicative 0.1.0.2 → 0.1.0.3

raw patch · 9 files changed

+32/−136 lines, 9 filesdep +safe-coloured-textdep −QuickCheckdep −genvalidity-aesondep −genvalidity-containersPVP ok

version bump matches the API change (PVP)

Dependencies added: safe-coloured-text

Dependencies removed: QuickCheck, genvalidity-aeson, genvalidity-containers, genvalidity-hspec, genvalidity-scientific, genvalidity-text, genvalidity-unordered-containers, hspec, yamlparse-applicative

API changes (from Hackage documentation)

Files

+ LICENSE view
@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2020-2021 Tom Sydney Kerckhove++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
src/YamlParse/Applicative/Class.hs view
@@ -14,8 +14,8 @@ import Data.Scientific import Data.Set (Set) import qualified Data.Set as S-import qualified Data.Text as T import Data.Text (Text)+import qualified Data.Text as T import Data.Vector (Vector) import qualified Data.Vector as V import Data.Word
src/YamlParse/Applicative/Explain.hs view
@@ -7,8 +7,8 @@  module YamlParse.Applicative.Explain where -import qualified Data.Text as T import Data.Text (Text)+import qualified Data.Text as T import Data.Validity import Data.Validity.Text () import GHC.Generics (Generic)
src/YamlParse/Applicative/Implement.hs view
@@ -8,7 +8,6 @@ module YamlParse.Applicative.Implement where  import Control.Applicative-import qualified Data.Aeson as Aeson import qualified Data.Aeson.Types as Aeson import qualified Data.HashMap.Strict as HM import qualified Data.Map as M@@ -66,17 +65,17 @@       ParseField key fp -> \o -> case fp of         FieldParserRequired p -> do           v <- o Yaml..: key-          go p v Aeson.<?> Aeson.Key key+          go p v         FieldParserOptional p -> do           mv <- o Yaml..:? key           case mv of             Nothing -> pure Nothing-            Just v -> Just <$> go p v Aeson.<?> Aeson.Key key+            Just v -> Just <$> go p v         FieldParserOptionalWithDefault p d -> do           mv <- o Yaml..:? key           case mv of             Nothing -> pure d-            Just v -> go p v Aeson.<?> Aeson.Key key+            Just v -> go p v       ParseList p -> mapM (go p)       ParseMap p -> HM.traverseWithKey $ \_ v -> go p v       ParseMapKeys p pm -> \val -> do
src/YamlParse/Applicative/Parser.hs view
@@ -11,8 +11,8 @@ import Data.HashMap.Strict (HashMap) import Data.Map (Map) import Data.Scientific-import qualified Data.Text as T import Data.Text (Text)+import qualified Data.Text as T import qualified Data.Text.Encoding as TE import Data.Validity.Text () import Data.Vector (Vector)
src/YamlParse/Applicative/Pretty.hs view
@@ -10,8 +10,8 @@ module YamlParse.Applicative.Pretty where  import Data.Maybe-import qualified Data.Text as T import Data.Text (Text)+import qualified Data.Text as T import Data.Text.Prettyprint.Doc import Data.Text.Prettyprint.Doc.Render.Text import Data.Text.Prettyprint.Doc.Render.Util.StackMachine
− test/Spec.hs
@@ -1,1 +0,0 @@-{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
− test/YamlParse/ApplicativeSpec.hs
@@ -1,96 +0,0 @@-{-# LANGUAGE AllowAmbiguousTypes #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeApplications #-}--module YamlParse.ApplicativeSpec where--import qualified Data.Aeson.Types as Aeson-import Data.GenValidity.Aeson ()-import Data.GenValidity.Containers ()-import Data.GenValidity.UnorderedContainers ()-import Data.HashMap.Strict (HashMap)-import Data.List.NonEmpty (NonEmpty)-import Data.Map (Map)-import Data.Scientific (Scientific)-import Data.Set (Set)-import Data.Text (Text)-import Data.Typeable-import GHC.Generics (Generic)-import Test.Hspec-import Test.QuickCheck-import Test.Validity-import Test.Validity.Utils-import YamlParse.Applicative as Yaml--spec :: Spec-spec =-  describe "implementParser" $ do-    implementationsSpec @Bool-    implementationsSpec @Char-    implementationsSpec @String-    implementationsSpec @Text-    implementationsSpec @Scientific-    implementationsSpec @Aeson.Array-    implementationsSpec @Aeson.Object-    implementationsSpec @Aeson.Value-    implementationsSpec @[Text]-    implementationsSpec @(NonEmpty Text)-    implementationsSpec @(Maybe Text)-    implementationsSpec @(Set Text)-    implementationsSpec @(Map Text Int)-    implementationsSpec @(HashMap Text Int)-    implementationsSpec @(Map String Int)-    implementationsSpec @Fruit--data Fruit = Apple | Banana | Melon-  deriving (Show, Eq, Generic)--instance Aeson.FromJSON Fruit--instance Aeson.ToJSON Fruit--instance YamlSchema Fruit where-  yamlSchema =-    alternatives-      [ literalShowValue Apple,-        literalShowValue Banana,-        literalShowValue Melon-      ]--instance Validity Fruit--instance GenUnchecked Fruit--instance GenValid Fruit--implementationsSpec ::-  forall a.-  ( Show a,-    Eq a,-    Typeable a,-    GenValid a,-    Aeson.FromJSON a,-    Aeson.ToJSON a,-    YamlSchema a-  ) =>-  Spec-implementationsSpec = specify ("The implementation of 'parseJSON' matches the implementation of 'implementParser yamlSchema' for " <> nameOf @a) $ implementationsMatch @a--implementationsMatch ::-  forall a.-  ( Show a,-    Eq a,-    GenValid a,-    Aeson.FromJSON a,-    Aeson.ToJSON a,-    YamlSchema a-  ) =>-  Property-implementationsMatch =-  forAllValid $-    \a -> do-      let v = Aeson.toJSON (a :: a)-      let aesonResult = Aeson.parseEither Aeson.parseJSON v :: Either String a-          yamlResult = Aeson.parseEither (implementParser yamlSchema) v-      yamlResult `shouldBe` aesonResult
yamlparse-applicative.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.2.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: ded1b4f5ee3db66fbcd6e3f4573306cbe3dd7edae1f55ae9ab6de42b25805e58  name:           yamlparse-applicative-version:        0.1.0.2+version:        0.1.0.3 synopsis:       Declaritive configuration parsing with free docs description:    See https://github.com/NorfairKing/yamlparse-applicative homepage:       https://github.com/NorfairKing/yamlparse-applicative#readme@@ -16,6 +14,7 @@ maintainer:     syd@cs-syd.eu copyright:      2020 Tom Sydney Kerckhove license:        MIT+license-file:   LICENSE build-type:     Simple  source-repository head@@ -45,6 +44,7 @@     , path     , path-io     , prettyprinter+    , safe-coloured-text     , scientific     , text     , unordered-containers@@ -52,31 +52,4 @@     , validity-text     , vector     , yaml-  default-language: Haskell2010--test-suite yamlparse-applicative-test-  type: exitcode-stdio-1.0-  main-is: Spec.hs-  other-modules:-      YamlParse.ApplicativeSpec-      Paths_yamlparse_applicative-  hs-source-dirs:-      test-  ghc-options: -threaded -rtsopts -with-rtsopts=-N-  build-depends:-      QuickCheck-    , aeson-    , base >=4.7 && <5-    , containers-    , genvalidity-aeson-    , genvalidity-containers-    , genvalidity-hspec-    , genvalidity-scientific-    , genvalidity-text-    , genvalidity-unordered-containers-    , hspec-    , scientific-    , text-    , unordered-containers-    , yamlparse-applicative   default-language: Haskell2010