packages feed

bcp47-orphans 0.1.0.6 → 0.1.1.0

raw patch · 9 files changed

+68/−30 lines, 9 filesdep +aesondep ~QuickCheckdep ~bcp47dep ~cassavaPVP ok

version bump matches the API change (PVP)

Dependencies added: aeson

Dependency ranges changed: QuickCheck, bcp47, cassava, errors, esqueleto, hashable, hspec, http-api-data, path-pieces, persistent, serialise, text

API changes (from Hackage documentation)

+ Data.BCP47.Aeson: instance Data.Aeson.Types.FromJSON.FromJSON Data.BCP47.BCP47
+ Data.BCP47.Aeson: instance Data.Aeson.Types.ToJSON.ToJSON Data.BCP47.BCP47

Files

ChangeLog.md view
@@ -1,8 +1,12 @@-## [*Unreleased*](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.0.6...main)+## [*Unreleased*](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.1.0...main)  None -## [v0.1.0.5](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.0.5...bcp47-orphans-v0.1.0.6)+## [v0.1.1.0](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.0.6...bcp47-orphans-v0.1.1.0)++- Add `FromJSON` and `ToJSON` instances (removed from `bcp47-0.3.0.0`)++## [v0.1.0.6](https://github.com/freckle/bcp47/compare/bcp47-orphans-v0.1.0.5...bcp47-orphans-v0.1.0.6)  - Add support for Serialise and the CBOR format 
bcp47-orphans.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.12 name:               bcp47-orphans-version:            0.1.0.6+version:            0.1.1.0 license:            MIT license-file:       LICENSE copyright:          2019 Freckle Education@@ -22,6 +22,7 @@  library     exposed-modules:+        Data.BCP47.Aeson         Data.BCP47.Csv         Data.BCP47.Esqueleto         Data.BCP47.Hashable@@ -34,23 +35,25 @@     other-modules:    Paths_bcp47_orphans     default-language: Haskell2010     build-depends:+        aeson >=1.3.1.1,         base >=4.7 && <5,-        bcp47,-        cassava,-        errors,-        esqueleto,-        hashable,-        http-api-data,-        path-pieces,-        persistent,-        serialise,-        text+        bcp47 >=0.3.0.0,+        cassava >=0.5.1.0,+        errors >=2.3.0,+        esqueleto >=3.4.0.1,+        hashable >=1.2.7.0,+        http-api-data >=0.3.8.1,+        path-pieces >=0.2.1,+        persistent >=2.11.0.1,+        serialise >=0.2.6.0,+        text >=1.2.3.1  test-suite spec     type:             exitcode-stdio-1.0     main-is:          Main.hs     hs-source-dirs:   tests     other-modules:+        Data.BCP47.AesonSpec         Data.BCP47.CsvSpec         Data.BCP47.PathPiecesSpec         Data.BCP47.PersistSpec@@ -60,12 +63,13 @@      default-language: Haskell2010     build-depends:-        QuickCheck,+        QuickCheck >=2.11.3,+        aeson >=1.3.1.1,         base >=4.7 && <5,-        bcp47,+        bcp47 >=0.3.0.0,         bcp47-orphans,-        cassava,-        hspec,-        path-pieces,-        persistent,-        serialise+        cassava >=0.5.1.0,+        hspec >=2.5.5,+        path-pieces >=0.2.1,+        persistent >=2.11.0.1,+        serialise >=0.2.6.0
+ library/Data/BCP47/Aeson.hs view
@@ -0,0 +1,14 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Data.BCP47.Aeson () where++import Data.Aeson+import Data.BCP47+import Data.Text (unpack)++instance ToJSON BCP47 where+  toEncoding = toEncoding . toText+  toJSON = toJSON . toText++instance FromJSON BCP47 where+  parseJSON = withText "BCP47" $ either (fail . unpack) pure . fromText
library/Data/BCP47/Csv.hs view
@@ -3,7 +3,7 @@ module Data.BCP47.Csv () where  import Data.BCP47 (BCP47, fromText, toText)-import Data.Csv (FromField(..), ToField(..))+import Data.Csv (FromField (..), ToField (..)) import Data.Text (unpack)  instance ToField BCP47 where
library/Data/BCP47/Hashable.hs view
@@ -3,7 +3,7 @@ module Data.BCP47.Hashable () where  import Data.BCP47 (BCP47, toText)-import Data.Hashable (Hashable(..))+import Data.Hashable (Hashable (..))  instance Hashable BCP47 where   hashWithSalt i = hashWithSalt i . toText
library/Data/BCP47/HttpApiData.hs view
@@ -1,11 +1,10 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -module Data.BCP47.HttpApiData-  ()+module Data.BCP47.HttpApiData () where  import Data.BCP47 (BCP47, fromText, toText)-import Web.HttpApiData (FromHttpApiData(..), ToHttpApiData(..))+import Web.HttpApiData (FromHttpApiData (..), ToHttpApiData (..))  instance ToHttpApiData BCP47 where   toUrlPiece = toText
library/Data/BCP47/PathPieces.hs view
@@ -4,7 +4,7 @@  import Control.Error.Util (hush) import Data.BCP47 (BCP47, fromText, toText)-import Web.PathPieces (PathPiece(..))+import Web.PathPieces (PathPiece (..))  instance PathPiece BCP47 where   fromPathPiece = hush . fromText
library/Data/BCP47/Persist.hs view
@@ -1,14 +1,14 @@-{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE TypeApplications #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}  module Data.BCP47.Persist () where  import Control.Monad ((<=<)) import Data.BCP47 (BCP47, fromText, toText)-import Data.Proxy (Proxy(..))+import Data.Proxy (Proxy (..)) import Data.Text (Text)-import Database.Persist.Class (PersistField(..))-import Database.Persist.Sql (PersistFieldSql(..))+import Database.Persist.Class (PersistField (..))+import Database.Persist.Sql (PersistFieldSql (..))  instance PersistField BCP47 where   toPersistValue = toPersistValue . toText
+ tests/Data/BCP47/AesonSpec.hs view
@@ -0,0 +1,17 @@+{-# LANGUAGE TypeApplications #-}++module Data.BCP47.AesonSpec+  ( spec+  ) where++import Data.Aeson+import Data.BCP47+import Data.BCP47.Aeson ()+import Test.Hspec+import Test.Hspec.QuickCheck++spec :: Spec+spec = do+  describe "ToJSON/FromJSON" $ do+    prop "roundtrips" $ \x ->+      decode (encode @BCP47 x) `shouldBe` Just x