packages feed

binary-tagged 0.1.2.0 → 0.1.3.0

raw patch · 4 files changed

+47/−17 lines, 4 filesdep ~generics-sop

Dependency ranges changed: generics-sop

Files

CHANGELOG.md view
@@ -1,3 +1,5 @@+- 0.1.3.0 (2015-10-24)+    - Support `generics-sop-0.2` - 0.1.2.0 (2015-10-06)     - Add tuple `HasSemanticVersion` instances     - Add instances for
README.md view
@@ -2,6 +2,9 @@  [![Build Status](https://travis-ci.org/phadej/binary-tagged.svg?branch=master)](https://travis-ci.org/phadej/binary-tagged) [![Hackage](https://img.shields.io/hackage/v/binary-tagged.svg)](http://hackage.haskell.org/package/binary-tagged)+[![Stackage LTS 2](http://stackage.org/package/binary-tagged/badge/lts-2)](http://stackage.org/lts-2/package/binary-tagged)+[![Stackage LTS 3](http://stackage.org/package/binary-tagged/badge/lts-3)](http://stackage.org/lts-3/package/binary-tagged)+[![Stackage Nightly](http://stackage.org/package/binary-tagged/badge/nightly)](http://stackage.org/nightly/package/binary-tagged)  Structurally tag binary serialisation stream. 
binary-tagged.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.7.0.+-- This file has been generated from package.yaml by hpack version 0.8.0. -- -- see: https://github.com/sol/hpack  name:           binary-tagged-version:        0.1.2.0+version:        0.1.3.0 synopsis:       Tagged binary serialisation. description:    Check <https://github.com/phadej/binary-tagged#readme README on Github> category:       Web@@ -31,7 +31,7 @@   ghc-options: -Wall   build-depends:       base                     >=4.7  && <4.9-    , generics-sop             >=0.1  && <0.2+    , generics-sop             >=0.1  && <0.3     , SHA                      >=1.6  && <1.7     , array                    >=0.5  && <0.6     , aeson                    >=0.8  && <0.11@@ -57,7 +57,7 @@   ghc-options: -Wall   build-depends:       base                     >=4.7  && <4.9-    , generics-sop             >=0.1  && <0.2+    , generics-sop             >=0.1  && <0.3     , SHA                      >=1.6  && <1.7     , array                    >=0.5  && <0.6     , aeson                    >=0.8  && <0.11@@ -91,7 +91,7 @@   ghc-options: -Wall   build-depends:       base                     >=4.7  && <4.9-    , generics-sop             >=0.1  && <0.2+    , generics-sop             >=0.1  && <0.3     , SHA                      >=1.6  && <1.7     , array                    >=0.5  && <0.6     , aeson                    >=0.8  && <0.11
src/Data/Binary/Tagged.hs view
@@ -103,6 +103,10 @@ import           Generics.SOP as SOP import           Generics.SOP.GGP as SOP +#if MIN_VERSION_generics_sop(0,2,0)+import           Generics.SOP.Constraint as SOP+#endif+ #if !MIN_VERSION_base(4,8,0) import           Data.Foldable (Foldable) import           Data.Traversable (Traversable)@@ -247,7 +251,15 @@ class HasStructuralInfo a where   structuralInfo :: Proxy a -> StructuralInfo -  default structuralInfo :: (GHC.Generic a, All2 HasStructuralInfo (GCode a), GDatatypeInfo a, SingI (GCode a)) => Proxy a -> StructuralInfo+  default structuralInfo :: ( GHC.Generic a+                            , All2 HasStructuralInfo (GCode a)+                            , GDatatypeInfo a+#if MIN_VERSION_generics_sop(0,2,0)+                            , SListI2 (GCode a)+#else+                            , SingI (GCode a)+#endif+                            ) => Proxy a -> StructuralInfo   structuralInfo = ghcStructuralInfo  -- | A helper type family for 'encodeTaggedFile' and 'decodeTaggedFile'.@@ -268,7 +280,17 @@  -- Generic derivation -ghcStructuralInfo :: (GHC.Generic a, All2 HasStructuralInfo (GCode a), GDatatypeInfo a, SingI (GCode a)) => Proxy a -> StructuralInfo+ghcStructuralInfo :: ( GHC.Generic a+                     , All2 HasStructuralInfo (GCode a)+                     , GDatatypeInfo a+#if MIN_VERSION_generics_sop(0,2,0)+                     , SListI2 (GCode a)+#else+                     , SingI (GCode a)+#endif+                     )+                  => Proxy a+                  -> StructuralInfo ghcStructuralInfo proxy = sopStructuralInfoS (gdatatypeInfo proxy)  ghcNominalType ::  (GHC.Generic a,  GDatatypeInfo a) => Proxy a -> StructuralInfo@@ -282,13 +304,24 @@ sopStructuralInfo :: forall a. (Generic a, HasDatatypeInfo a, All2 HasStructuralInfo (Code a)) => Proxy a -> StructuralInfo sopStructuralInfo proxy = sopStructuralInfoS (datatypeInfo proxy) -sopStructuralInfoS :: forall xss. (All2 HasStructuralInfo xss, SingI xss) => DatatypeInfo xss -> StructuralInfo+sopStructuralInfoS :: forall xss. ( All2 HasStructuralInfo xss+#if MIN_VERSION_generics_sop(0,2,0)+                                  , SListI2 xss+#else+                                  , SingI xss+#endif+                                  )+                   => DatatypeInfo xss+                   -> StructuralInfo sopStructuralInfoS di@(Newtype _ _ ci)  = NominalNewtype (datatypeName di) (sopNominalNewtype ci)-sopStructuralInfoS di@(ADT _ _ _)       = StructuralInfo (datatypeName di) (sopNominalAdt (toNP' (sing :: Sing xss)))+sopStructuralInfoS di@(ADT _ _ _)       = StructuralInfo (datatypeName di) (sopNominalAdtPOP (hpure Proxy :: POP Proxy xss))  sopNominalNewtype :: forall x. HasStructuralInfo x => ConstructorInfo '[x] -> StructuralInfo sopNominalNewtype _ = structuralInfo (Proxy :: Proxy x) +sopNominalAdtPOP :: (All2 HasStructuralInfo xss) => POP Proxy xss -> [[StructuralInfo]]+sopNominalAdtPOP (POP np2) = sopNominalAdt np2+ sopNominalAdt :: (All2 HasStructuralInfo xss) => NP (NP Proxy) xss -> [[StructuralInfo]] sopNominalAdt Nil          = [] sopNominalAdt (p :* ps)  = sopStructuralInfoP p : sopNominalAdt ps@@ -314,14 +347,6 @@ datatypeName :: DatatypeInfo xss -> DatatypeName datatypeName (Newtype _ d _)  = d datatypeName (ADT _ d _)      = d--toNP :: Sing xs -> NP Proxy xs-toNP SNil = Nil-toNP SCons = Proxy :* toNP sing--toNP' :: Sing xss -> NP (NP Proxy) xss-toNP' SNil = Nil-toNP' SCons = toNP sing :* toNP' sing  -- | Interleaving --