packages feed

exinst 0.5 → 0.6

raw patch · 12 files changed

+298/−213 lines, 12 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,15 @@+# Version 0.6++* The `binary` and `deepseq` Cabal flags were removed since these two packages+  are always included with the GHC distribution, so it doesn't make sense to+  make them optional.++* The optional dependencies hidden behind Cabal flags now apply to the test+  suite as well.++* Builds with GHC 8.4.++ # Version 0.5  * BREAKING: Depend on `singletons == 2.3.*`.
exinst.cabal view
@@ -1,5 +1,5 @@ name:                exinst-version:             0.5+version:             0.6 author:              Renzo Carbonara maintainer:          renzoλcarbonara.com.ar copyright:           Renzo Carbonara 2015-2018@@ -24,9 +24,13 @@       Exinst.Internal.Product       Exinst.Internal.Sum       Exinst.Instances.Base+      Exinst.Instances.Binary+      Exinst.Instances.DeepSeq   build-depends:       base >=4.9 && <5.0+    , binary     , constraints >=0.4+    , deepseq     , profunctors >=5.0     , singletons >=2.3.1   ghcjs-options: -Wall -O3@@ -36,10 +40,6 @@     build-depends: aeson     other-modules: Exinst.Instances.Aeson     cpp-options: -DHAS_aeson-  if flag(binary) || flag(bytes)-    build-depends: binary-    other-modules: Exinst.Instances.Binary-    cpp-options: -DHAS_binary   if flag(bytes)     build-depends: bytes >=0.15     other-modules: Exinst.Instances.Bytes@@ -48,10 +48,6 @@     build-depends: cereal     other-modules: Exinst.Instances.Cereal     cpp-options: -DHAS_cereal-  if flag(deepseq)-    build-depends: deepseq-    other-modules: Exinst.Instances.DeepSeq-    cpp-options: -DHAS_deepseq   if flag(hashable)     build-depends: hashable     other-modules: Exinst.Instances.Hashable@@ -71,32 +67,36 @@   hs-source-dirs: tests lib   main-is: Main.hs   build-depends:-     aeson-   , base+     base    , binary-   , bytes    , bytestring-   , cborg-   , cereal    , constraints    , deepseq-   , hashable    , profunctors    , QuickCheck-   , serialise    , singletons    , tasty    , tasty-hunit    , tasty-quickcheck+  ghcjs-options: -Wall -O0+  ghc-options: -Wall -O0   cpp-options:-    -DHAS_aeson-    -DHAS_binary-    -DHAS_bytes-    -DHAS_cereal-    -DHAS_deepseq-    -DHAS_hashable     -DHAS_quickcheck-    -DHAS_serialise+  if flag(aeson)+    build-depends: aeson+    cpp-options: -DHAS_aeson+  if flag(bytes)+    build-depends: bytes+    cpp-options: -DHAS_bytes+  if flag(cereal) || flag(bytes)+    build-depends: cereal+    cpp-options: -DHAS_cereal+  if flag(hashable)+    build-depends: hashable+    cpp-options: -DHAS_hashable+  if flag(serialise)+    build-depends: cborg, serialise+    cpp-options: -DHAS_serialise  flag aeson   description: Provide instances for @aeson@@@ -106,16 +106,8 @@   description: Provide instances for @bytes@ (implies @ceral@ and @binary@).   default: True   manual: True-flag binary-  description: Provide instances for @binary@.-  default: True-  manual: True flag cereal   description: Provide instances for @cereal@.-  default: True-  manual: True-flag deepseq-  description: Provide instances for @deepseq@   default: True   manual: True flag hashable
lib/Exinst.hs view
@@ -118,25 +118,19 @@ import Exinst.Internal.Sum  import Exinst.Instances.Base ()+import Exinst.Instances.Binary ()+import Exinst.Instances.DeepSeq ()  #ifdef HAS_aeson import Exinst.Instances.Aeson () #endif -#ifdef HAS_binary-import Exinst.Instances.Binary ()-#endif- #ifdef HAS_bytes import Exinst.Instances.Bytes () #endif  #ifdef HAS_cereal import Exinst.Instances.Cereal ()-#endif--#ifdef HAS_deepseq-import Exinst.Instances.DeepSeq () #endif  #ifdef HAS_hashable
lib/Exinst/Instances/Aeson.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -15,6 +16,7 @@  import qualified Data.Aeson as Ae import Data.Constraint+import Data.Kind (Type) import Data.Singletons import Prelude @@ -22,7 +24,7 @@  -------------------------------------------------------------------------------- -instance forall (f :: k1 -> *)+instance forall (f :: k1 -> Type)   . ( SingKind k1     , Ae.ToJSON (Demote k1)     , Dict1 Ae.ToJSON f@@ -33,7 +35,7 @@        case dict1 sa1 :: Dict (Ae.ToJSON (f a1)) of           Dict -> Ae.toJSON (fromSing sa1, x) -instance forall (f :: k2 -> k1 -> *)+instance forall (f :: k2 -> k1 -> Type)   . ( SingKind k2     , SingKind k1     , Ae.ToJSON (Demote k2)@@ -46,7 +48,7 @@        case dict2 sa2 sa1 :: Dict (Ae.ToJSON (f a2 a1)) of           Dict -> Ae.toJSON ((fromSing sa2, fromSing sa1), x) -instance forall (f :: k3 -> k2 -> k1 -> *)+instance forall (f :: k3 -> k2 -> k1 -> Type)   . ( SingKind k3     , SingKind k2     , SingKind k1@@ -61,7 +63,7 @@        case dict3 sa3 sa2 sa1 :: Dict (Ae.ToJSON (f a3 a2 a1)) of           Dict -> Ae.toJSON ((fromSing sa3, fromSing sa2, fromSing sa1), x) -instance forall (f :: k4 -> k3 -> k2 -> k1 -> *)+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type)   . ( SingKind k4     , SingKind k3     , SingKind k2@@ -80,7 +82,7 @@  -------------------------------------------------------------------------------- -instance forall (f :: k1 -> *)+instance forall (f :: k1 -> Type)   . ( SingKind k1     , Ae.FromJSON (Demote k1)     , Dict1 Ae.FromJSON f@@ -95,7 +97,7 @@                x :: f a1 <- Ae.parseJSON v'                pure (Some1 sa1 x) -instance forall (f :: k2 -> k1 -> *)+instance forall (f :: k2 -> k1 -> Type)   . ( SingKind k2     , SingKind k1     , Ae.FromJSON (Demote k2)@@ -113,7 +115,7 @@                   x :: f a2 a1 <- Ae.parseJSON v'                   pure (Some2 sa2 sa1 x) -instance forall (f :: k3 -> k2 -> k1 -> *)+instance forall (f :: k3 -> k2 -> k1 -> Type)   . ( SingKind k3     , SingKind k2     , SingKind k1@@ -134,7 +136,7 @@                      x :: f a3 a2 a1 <- Ae.parseJSON v'                      pure (Some3 sa3 sa2 sa1 x) -instance forall (f :: k4 -> k3 -> k2 -> k1 -> *)+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type)   . ( SingKind k4     , SingKind k3     , SingKind k2
lib/Exinst/Instances/Binary.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -15,6 +16,7 @@  import qualified Data.Binary as Bin import Data.Constraint+import Data.Kind (Type) import Data.Singletons import Prelude @@ -25,7 +27,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k1 -> *).+instance forall (f :: k1 -> Type).   ( SingKind k1   , Bin.Binary (Demote k1)   , Dict1 Bin.Binary f@@ -49,7 +51,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k2 -> k1 -> *).+instance forall (f :: k2 -> k1 -> Type).   ( SingKind k2   , SingKind k1   , Bin.Binary (Demote k2)@@ -76,7 +78,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k3 -> k2 -> k1 -> *).+instance forall (f :: k3 -> k2 -> k1 -> Type).   ( SingKind k3   , SingKind k2   , SingKind k1@@ -106,7 +108,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k4 -> k3 -> k2 -> k1 -> *).+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type).   ( SingKind k4   , SingKind k3   , SingKind k2
lib/Exinst/Instances/Bytes.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -15,6 +16,7 @@  import qualified Data.Bytes.Serial as By import Data.Constraint+import Data.Kind (Type) import Data.Singletons import Prelude @@ -25,7 +27,7 @@ -- | Compatible with the 'Data.Binary.Binary' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k1 -> *).+instance forall (f :: k1 -> Type).   ( SingKind k1   , By.Serial (Demote k1)   , Dict1 By.Serial f@@ -49,7 +51,7 @@ -- | Compatible with the 'Data.Binary.Binary' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k2 -> k1 -> *).+instance forall (f :: k2 -> k1 -> Type).   ( SingKind k2   , SingKind k1   , By.Serial (Demote k2)@@ -76,7 +78,7 @@ -- | Compatible with the 'Data.Binary.Binary' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k3 -> k2 -> k1 -> *).+instance forall (f :: k3 -> k2 -> k1 -> Type).   ( SingKind k3   , SingKind k2   , SingKind k1@@ -106,7 +108,7 @@ -- | Compatible with the 'Data.Binary.Binary' instance and -- 'Data.Serialize.Serialize' instance, provided all of the 'Demote's and the -- fully applied @f@ instances are compatible as well.-instance forall (f :: k4 -> k3 -> k2 -> k1 -> *).+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type).   ( SingKind k4   , SingKind k3   , SingKind k2
lib/Exinst/Instances/Cereal.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -15,6 +16,7 @@  import qualified Data.Serialize as Cer import Data.Constraint+import Data.Kind (Type) import Data.Singletons import Prelude @@ -25,7 +27,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Binary.Binary' instance, provided all of the 'Demote's and the fully -- applied @f@ instances are compatible as well.-instance forall (f :: k1 -> *).+instance forall (f :: k1 -> Type).   ( SingKind k1   , Cer.Serialize (Demote k1)   , Dict1 Cer.Serialize f@@ -49,7 +51,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Binary.Binary' instance, provided all of the 'Demote's and the fully -- applied @f@ instances are compatible as well.-instance forall (f :: k2 -> k1 -> *).+instance forall (f :: k2 -> k1 -> Type).   ( SingKind k2   , SingKind k1   , Cer.Serialize (Demote k2)@@ -76,7 +78,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Binary.Binary' instance, provided all of the 'Demote's and the fully -- applied @f@ instances are compatible as well.-instance forall (f :: k3 -> k2 -> k1 -> *).+instance forall (f :: k3 -> k2 -> k1 -> Type).   ( SingKind k3   , SingKind k2   , SingKind k1@@ -106,7 +108,7 @@ -- | Compatible with the 'Data.Bytes.Serial.Serial' instance and -- 'Data.Binary.Binary' instance, provided all of the 'Demote's and the fully -- applied @f@ instances are compatible as well.-instance forall (f :: k4 -> k3 -> k2 -> k1 -> *).+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type).   ( SingKind k4   , SingKind k3   , SingKind k2
lib/Exinst/Instances/Hashable.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -15,6 +16,7 @@  import Data.Hashable (Hashable(hashWithSalt)) import Data.Constraint+import Data.Kind (Type) import Data.Singletons import Prelude @@ -28,7 +30,7 @@  -------------------------------------------------------------------------------- -instance forall (f :: k1 -> *)+instance forall (f :: k1 -> Type)   . ( SingKind k1     , Hashable (Demote k1)     , Dict1 Hashable f@@ -41,7 +43,7 @@                        `hashWithSalt` fromSing sa1                        `hashWithSalt` x -instance forall (f :: k2 -> k1 -> *)+instance forall (f :: k2 -> k1 -> Type)   . ( SingKind k2     , SingKind k1     , Hashable (Demote k2)@@ -57,7 +59,7 @@                        `hashWithSalt` fromSing sa1                        `hashWithSalt` x -instance forall (f :: k3 -> k2 -> k1 -> *)+instance forall (f :: k3 -> k2 -> k1 -> Type)   . ( SingKind k3     , SingKind k2     , SingKind k1@@ -76,7 +78,7 @@                        `hashWithSalt` fromSing sa1                        `hashWithSalt` x -instance forall (f :: k4 -> k3 -> k2 -> k1 -> *)+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type)   . ( SingKind k4     , SingKind k3     , SingKind k2
lib/Exinst/Instances/Serialise.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeInType #-} {-# LANGUAGE UndecidableInstances #-}  {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -17,6 +18,7 @@ import Codec.Serialise import Codec.Serialise.Decoding (decodeListLenOf) import Data.Constraint+import Data.Kind (Type) import Data.Singletons import Prelude @@ -24,7 +26,7 @@  -------------------------------------------------------------------------------- -instance forall (f :: k1 -> *)+instance forall (f :: k1 -> Type)   . ( SingKind k1     , Serialise (Demote k1)     , Dict1 Serialise f@@ -44,7 +46,7 @@                x :: f a1 <- decode                pure (Some1 sa1 x) -instance forall (f :: k2 -> k1 -> *)+instance forall (f :: k2 -> k1 -> Type)   . ( SingKind k2     , SingKind k1     , Serialise (Demote k2)@@ -69,7 +71,7 @@                   x :: f a2 a1 <- decode                   pure (Some2 sa2 sa1 x) -instance forall (f :: k3 -> k2 -> k1 -> *)+instance forall (f :: k3 -> k2 -> k1 -> Type)   . ( SingKind k3     , SingKind k2     , SingKind k1@@ -95,7 +97,7 @@                      x :: f a3 a2 a1 <- decode                      pure (Some3 sa3 sa2 sa1 x) -instance forall (f :: k4 -> k3 -> k2 -> k1 -> *)+instance forall (f :: k4 -> k3 -> k2 -> k1 -> Type)   . ( SingKind k4     , SingKind k3     , SingKind k2
lib/Exinst/Internal/Product.hs view
@@ -9,16 +9,14 @@  , P4(P4)  ) where +import Control.DeepSeq (NFData)+import qualified Data.Binary as Bin import GHC.Generics (Generic)  #ifdef HAS_aeson import Data.Aeson (FromJSON, ToJSON) #endif -#ifdef HAS_binary-import qualified Data.Binary as Bin-#endif- #ifdef HAS_bytes import qualified Data.Bytes.Serial as By #endif@@ -27,9 +25,6 @@ import qualified Data.Serialize as Cer #endif -#ifdef HAS_deepseq-import Control.DeepSeq (NFData)-#endif  #ifdef HAS_hashable import Data.Hashable (Hashable)@@ -82,12 +77,10 @@ #endif  ---------------------------------------------------------------------------------#ifdef HAS_deepseq instance (NFData (l a1), NFData (r a1)) => NFData (P1 l r a1) instance (NFData (l a2 a1), NFData (r a2 a1)) => NFData (P2 l r a2 a1) instance (NFData (l a3 a2 a1), NFData (r a3 a2 a1)) => NFData (P3 l r a3 a2 a1) instance (NFData (l a4 a3 a2 a1), NFData (r a4 a3 a2 a1)) => NFData (P4 l r a4 a3 a2 a1)-#endif  -------------------------------------------------------------------------------- #ifdef HAS_aeson@@ -119,12 +112,10 @@ #endif  ---------------------------------------------------------------------------------#ifdef HAS_binary instance (Bin.Binary (l a1), Bin.Binary (r a1)) => Bin.Binary (P1 l r a1) instance (Bin.Binary (l a2 a1), Bin.Binary (r a2 a1)) => Bin.Binary (P2 l r a2 a1) instance (Bin.Binary (l a3 a2 a1), Bin.Binary (r a3 a2 a1)) => Bin.Binary (P3 l r a3 a2 a1) instance (Bin.Binary (l a4 a3 a2 a1), Bin.Binary (r a4 a3 a2 a1)) => Bin.Binary (P4 l r a4 a3 a2 a1)-#endif  -------------------------------------------------------------------------------- #ifdef HAS_quickcheck
lib/Exinst/Internal/Sum.hs view
@@ -9,16 +9,14 @@  , S4(S4L,S4R)  ) where +import Control.DeepSeq (NFData)+import qualified Data.Binary as Bin import GHC.Generics (Generic)  #ifdef HAS_aeson import Data.Aeson (FromJSON, ToJSON) #endif -#ifdef HAS_binary-import qualified Data.Binary as Bin-#endif- #ifdef HAS_bytes import qualified Data.Bytes.Serial as By #endif@@ -27,10 +25,6 @@ import qualified Data.Serialize as Cer #endif -#ifdef HAS_deepseq-import Control.DeepSeq (NFData)-#endif- #ifdef HAS_hashable import Data.Hashable (Hashable) #endif@@ -82,12 +76,10 @@ #endif  ---------------------------------------------------------------------------------#ifdef HAS_deepseq instance (NFData (l a1), NFData (r a1)) => NFData (S1 l r a1) instance (NFData (l a2 a1), NFData (r a2 a1)) => NFData (S2 l r a2 a1) instance (NFData (l a3 a2 a1), NFData (r a3 a2 a1)) => NFData (S3 l r a3 a2 a1) instance (NFData (l a4 a3 a2 a1), NFData (r a4 a3 a2 a1)) => NFData (S4 l r a4 a3 a2 a1)-#endif  -------------------------------------------------------------------------------- #ifdef HAS_aeson@@ -119,12 +111,10 @@ #endif  ---------------------------------------------------------------------------------#ifdef HAS_binary instance (Bin.Binary (l a1), Bin.Binary (r a1)) => Bin.Binary (S1 l r a1) instance (Bin.Binary (l a2 a1), Bin.Binary (r a2 a1)) => Bin.Binary (S2 l r a2 a1) instance (Bin.Binary (l a3 a2 a1), Bin.Binary (r a3 a2 a1)) => Bin.Binary (S3 l r a3 a2 a1) instance (Bin.Binary (l a4 a3 a2 a1), Bin.Binary (r a4 a3 a2 a1)) => Bin.Binary (S4 l r a4 a3 a2 a1)-#endif  -------------------------------------------------------------------------------- #ifdef HAS_quickcheck
tests/Main.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-}@@ -9,18 +11,10 @@ module Main where  import Control.DeepSeq (NFData(rnf))-import qualified Codec.Serialise as Cborg-import qualified Data.Aeson as Aeson import qualified Data.Binary as Bin import qualified Data.ByteString.Lazy as BSL-import qualified Data.Bytes.Get as Bytes-import qualified Data.Bytes.Put as Bytes-import qualified Data.Bytes.Serial as Bytes-import Data.Hashable (Hashable(hash)) import Data.Int (Int32) import Data.Kind (Type)-import Data.Proxy (Proxy)-import qualified Data.Serialize as Cer import qualified GHC.Generics as G import qualified Test.Tasty as Tasty import qualified Test.Tasty.Runners as Tasty@@ -28,8 +22,28 @@ import qualified Test.Tasty.QuickCheck as QC import Text.Read (readMaybe) -import Data.Singletons (SingKind, Sing, Demote, withSomeSing)+#ifdef HAS_aeson+import qualified Data.Aeson as Aeson+#endif +#ifdef HAS_bytes+import qualified Data.Bytes.Get as Bytes+import qualified Data.Bytes.Put as Bytes+import qualified Data.Bytes.Serial as Bytes+#endif++#ifdef HAS_cereal+import qualified Data.Serialize as Cer+#endif++#ifdef HAS_hashable+import Data.Hashable (Hashable(hash))+#endif++#ifdef HAS_serialise+import qualified Codec.Serialise as Cborg+#endif+ import Exinst  --------------------------------------------------------------------------------@@ -42,33 +56,172 @@  -------------------------------------------------------------------------------- +data family X1 :: Bool -> Type+data instance X1 'False = XF1 | XF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X1 'True = XT1 | XT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)++data family X2 :: Bool -> Bool -> Type+data instance X2 'False 'False = XFF1 | XFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X2 'False 'True = XFT1 | XFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X2 'True 'False = XTF1 | XTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X2 'True 'True = XTT1 | XTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)++data family X3 :: Bool -> Bool -> Bool -> Type+data instance X3 'False 'False 'False = XFFF1 | XFFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'False 'False 'True = XFFT1 | XFFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'False 'True 'False = XFTF1 | XFTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'False 'True 'True = XFTT1 | XFTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'True 'False 'False = XTFF1 | XTFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'True 'False 'True = XTFT1 | XTFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'True 'True 'False = XTTF1 | XTTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X3 'True 'True 'True = XTTT1 | XTTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)++data family X4 :: Bool -> Bool -> Bool -> Bool -> Type+data instance X4 'False 'False 'False 'False = XFFFF1 | XFFFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'False 'False 'True = XFFFT1 | XFFFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'False 'True 'False = XFFTF1 | XFFTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'False 'True 'True = XFFTT1 | XFFTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'True 'False 'False = XFTFF1 | XFTFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'True 'False 'True = XFTFT1 | XFTFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'True 'True 'False = XFTTF1 | XFTTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'False 'True 'True 'True = XFTTT1 | XFTTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'False 'False 'False = XTFFF1 | XTFFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'False 'False 'True = XTFFT1 | XTFFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'False 'True 'False = XTFTF1 | XTFTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'False 'True 'True = XTFTT1 | XTFTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'True 'False 'False = XTTFF1 | XTTFF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'True 'False 'True = XTTFT1 | XTTFT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'True 'True 'False = XTTTF1 | XTTTF2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)+data instance X4 'True 'True 'True 'True = XTTTT1 | XTTTT2 Int32 deriving (Eq, Show, Read, G.Generic, Bin.Binary, NFData)++#define INSTANCETRON(c) \+  instance c (X1 'False); \+  instance c (X1 'True); \+  instance c (X2 'False 'False); \+  instance c (X2 'False 'True); \+  instance c (X2 'True 'False); \+  instance c (X2 'True 'True); \+  instance c (X3 'False 'False 'False); \+  instance c (X3 'False 'False 'True); \+  instance c (X3 'False 'True 'False); \+  instance c (X3 'False 'True 'True); \+  instance c (X3 'True 'False 'False); \+  instance c (X3 'True 'False 'True); \+  instance c (X3 'True 'True 'False); \+  instance c (X3 'True 'True 'True); \+  instance c (X4 'False 'False 'False 'False); \+  instance c (X4 'False 'False 'False 'True); \+  instance c (X4 'False 'False 'True 'False); \+  instance c (X4 'False 'False 'True 'True); \+  instance c (X4 'False 'True 'False 'False); \+  instance c (X4 'False 'True 'False 'True); \+  instance c (X4 'False 'True 'True 'False); \+  instance c (X4 'False 'True 'True 'True); \+  instance c (X4 'True 'False 'False 'False); \+  instance c (X4 'True 'False 'False 'True); \+  instance c (X4 'True 'False 'True 'False); \+  instance c (X4 'True 'False 'True 'True); \+  instance c (X4 'True 'True 'False 'False); \+  instance c (X4 'True 'True 'False 'True); \+  instance c (X4 'True 'True 'True 'False); \+  instance c (X4 'True 'True 'True 'True)++--------------------------------------------------------------------------------+-- Arbitrary instances++instance QC.Arbitrary (X1 'False) where arbitrary = QC.oneof [ pure XF1, fmap XF2 QC.arbitrary ]+instance QC.Arbitrary (X1 'True) where arbitrary = QC.oneof [ pure XT1, fmap XT2 QC.arbitrary ]++instance QC.Arbitrary (X2 'False 'False) where arbitrary = QC.oneof [ pure XFF1, fmap XFF2 QC.arbitrary ]+instance QC.Arbitrary (X2 'False 'True) where arbitrary = QC.oneof [ pure XFT1, fmap XFT2 QC.arbitrary ]+instance QC.Arbitrary (X2 'True 'False) where arbitrary = QC.oneof [ pure XTF1, fmap XTF2 QC.arbitrary ]+instance QC.Arbitrary (X2 'True 'True) where arbitrary = QC.oneof [ pure XTT1, fmap XTT2 QC.arbitrary ]++instance QC.Arbitrary (X3 'False 'False 'False) where arbitrary = QC.oneof [ pure XFFF1, fmap XFFF2 QC.arbitrary ]+instance QC.Arbitrary (X3 'False 'False 'True) where arbitrary = QC.oneof [ pure XFFT1, fmap XFFT2 QC.arbitrary ]+instance QC.Arbitrary (X3 'False 'True 'False) where arbitrary = QC.oneof [ pure XFTF1, fmap XFTF2 QC.arbitrary ]+instance QC.Arbitrary (X3 'False 'True 'True) where arbitrary = QC.oneof [ pure XFTT1, fmap XFTT2 QC.arbitrary ]+instance QC.Arbitrary (X3 'True 'False 'False) where arbitrary = QC.oneof [ pure XTFF1, fmap XTFF2 QC.arbitrary ]+instance QC.Arbitrary (X3 'True 'False 'True) where arbitrary = QC.oneof [ pure XTFT1, fmap XTFT2 QC.arbitrary ]+instance QC.Arbitrary (X3 'True 'True 'False) where arbitrary = QC.oneof [ pure XTTF1, fmap XTTF2 QC.arbitrary ]+instance QC.Arbitrary (X3 'True 'True 'True) where arbitrary = QC.oneof [ pure XTTT1, fmap XTTT2 QC.arbitrary ]++instance QC.Arbitrary (X4 'False 'False 'False 'False) where arbitrary = QC.oneof [ pure XFFFF1, fmap XFFFF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'False 'False 'True) where arbitrary = QC.oneof [ pure XFFFT1, fmap XFFFT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'False 'True 'False) where arbitrary = QC.oneof [ pure XFFTF1, fmap XFFTF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'False 'True 'True) where arbitrary = QC.oneof [ pure XFFTT1, fmap XFFTT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'True 'False 'False) where arbitrary = QC.oneof [ pure XFTFF1, fmap XFTFF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'True 'False 'True) where arbitrary = QC.oneof [ pure XFTFT1, fmap XFTFT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'True 'True 'False) where arbitrary = QC.oneof [ pure XFTTF1, fmap XFTTF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'False 'True 'True 'True) where arbitrary = QC.oneof [ pure XFTTT1, fmap XFTTT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'False 'False 'False) where arbitrary = QC.oneof [ pure XTFFF1, fmap XTFFF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'False 'False 'True) where arbitrary = QC.oneof [ pure XTFFT1, fmap XTFFT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'False 'True 'False) where arbitrary = QC.oneof [ pure XTFTF1, fmap XTFTF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'False 'True 'True) where arbitrary = QC.oneof [ pure XTFTT1, fmap XTFTT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'True 'False 'False) where arbitrary = QC.oneof [ pure XTTFF1, fmap XTTFF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'True 'False 'True) where arbitrary = QC.oneof [ pure XTTFT1, fmap XTTFT2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'True 'True 'False) where arbitrary = QC.oneof [ pure XTTTF1, fmap XTTTF2 QC.arbitrary ]+instance QC.Arbitrary (X4 'True 'True 'True 'True) where arbitrary = QC.oneof [ pure XTTTT1, fmap XTTTT2 QC.arbitrary ]++--------------------------------------------------------------------------------+ tt :: Tasty.TestTree tt =   Tasty.testGroup "main"-  [ tt_id "Identity through Show/Read" id_show_read+  [ tt_nfdata+  , tt_id "Identity through Show/Read" id_show_read   , tt_id "Identity through GHC's Generic" id_generic+  , tt_id "Identity through Binary's Binary" id_binary++#ifdef HAS_aeson   , tt_id "Identity through Aeson's ToJSON/FromJSON" id_aeson+#endif++#ifdef HAS_bytes   , tt_id "Identity through Bytes's Serial" id_bytes-  , tt_id "Identity through Cereal's Serialize" id_cereal-  , tt_id "Identity through Binary's Binary" id_binary-  , tt_id "Identity through serialise's Serialise" id_serialise-  , tt_id "Identity from Cereal's Serialize to Binary's Binary" id_cereal_to_binary-  , tt_id "Identity from Cereal's Serialize to Bytes's Serial" id_cereal_to_bytes-  , tt_id "Identity from Binary's Binary to Cereal's Serialize" id_binary_to_cereal   , tt_id "Identity from Binary's Binary to Bytes's Serial" id_binary_to_bytes   , tt_id "Identity from Bytes's Serial to Binary's Binary" id_bytes_to_binary+#ifdef HAS_cereal+  , tt_id "Identity from Cereal's Serialize to Bytes's Serial" id_cereal_to_bytes   , tt_id "Identity from Bytes's Serial to Cereal's Serialize" id_bytes_to_cereal-  , tt_nfdata+#endif+#endif++#ifdef HAS_cereal+  , tt_id "Identity through Cereal's Serialize" id_cereal+  , tt_id "Identity from Binary's Binary to Cereal's Serialize" id_binary_to_cereal+  , tt_id "Identity from Cereal's Serialize to Binary's Binary" id_cereal_to_binary+#endif++#ifdef HAS_serialise+  , tt_id "Identity through serialise's Serialise" id_serialise+#endif   ] +type MegaCtx a =+  ( G.Generic a+  , Show a+  , Read a+  , Bin.Binary a+#ifdef HAS_aeson+  , Aeson.FromJSON a+  , Aeson.ToJSON a+#endif+#ifdef HAS_bytes+  , Bytes.Serial a+#endif+#ifdef HAS_cereal+  , Cer.Serialize a+#endif+#ifdef HAS_serialise+  , Cborg.Serialise a+#endif+  )+ tt_id   :: String-  -> (forall a.-        ( G.Generic a, Aeson.FromJSON a, Aeson.ToJSON a-        , Bytes.Serial a, Bin.Binary a, Cer.Serialize a-        , Cborg.Serialise a, Show a, Read a-        ) => a -> Maybe a-     ) -- ^ It's easier to put all the constraints here.+  -> (forall a. MegaCtx a => a -> Maybe a)+  -- ^ It's easier to put all the constraints here in the 'MegaCtx' monster.   -> Tasty.TestTree tt_id = \title id' -> Tasty.testGroup title   [ QC.testProperty "Some1 X1" $@@ -125,6 +278,9 @@       QC.forAll QC.arbitrary $ \(x :: Some4 (S4 X4 X4)) -> () === rnf x   ] +#ifdef HAS_hashable+INSTANCETRON(Hashable)+ tt_hashable :: Tasty.TestTree tt_hashable = Tasty.testGroup "Hashable"   [ QC.testProperty "Some1 X1" $@@ -152,6 +308,7 @@   , QC.testProperty "Some4 (S4 X4 X4)" $       QC.forAll QC.arbitrary $ \(x :: Some4 (S4 X4 X4)) -> () === (hash x `seq` ())   ]+#endif  -------------------------------------------------------------------------------- @@ -161,32 +318,53 @@ id_generic :: G.Generic a => a -> Maybe a id_generic = Just . G.to . G.from +#ifdef HAS_aeson+INSTANCETRON(Aeson.ToJSON)+INSTANCETRON(Aeson.FromJSON) id_aeson :: (Aeson.FromJSON a, Aeson.ToJSON a) => a -> Maybe a id_aeson = Aeson.decode . Aeson.encode+#endif +#ifdef HAS_bytes+INSTANCETRON(Bytes.Serial) id_bytes :: Bytes.Serial a => a -> Maybe a id_bytes = \a ->   case Bytes.runGetS Bytes.deserialize (Bytes.runPutS (Bytes.serialize a)) of      Left _ -> Nothing      Right a' -> Just a' +id_binary_to_bytes :: (Bin.Binary a, Bytes.Serial a) => a -> Maybe a+id_binary_to_bytes = \a ->+   case Bytes.runGetS Bytes.deserialize (BSL.toStrict (Bin.encode a)) of+     Left _ -> Nothing+     Right a' -> Just a'++id_bytes_to_binary :: (Bytes.Serial a, Bin.Binary a) => a -> Maybe a+id_bytes_to_binary = \a ->+   case Bin.decodeOrFail (Bytes.runPutL (Bytes.serialize a)) of+      Right (z,_,a') | BSL.null z -> Just a'+      _ -> Nothing+#endif+ id_binary :: Bin.Binary a => a -> Maybe a id_binary = \a ->   case Bin.decodeOrFail (Bin.encode a) of       Right (z,_,a') | BSL.null z -> Just a'       _ -> Nothing +#ifdef HAS_cereal+INSTANCETRON(Cer.Serialize) id_cereal :: Cer.Serialize a => a -> Maybe a id_cereal = \a ->   case Cer.decodeLazy (Cer.encodeLazy a) of      Right a' -> Just a'      Left _ -> Nothing -id_serialise :: Cborg.Serialise a => a -> Maybe a-id_serialise = \a ->-  case Cborg.deserialiseOrFail (Cborg.serialise a) of-    Right a' -> Just a'-    Left _   -> Nothing+id_binary_to_cereal :: (Bin.Binary a, Cer.Serialize a) => a -> Maybe a+id_binary_to_cereal = \a ->+  case Cer.decodeLazy (Bin.encode a) of+     Right a' -> Just a'+     Left _ -> Nothing  id_cereal_to_binary :: (Bin.Binary a, Cer.Serialize a) => a -> Maybe a id_cereal_to_binary = \a ->@@ -194,110 +372,26 @@       Right (z,_,a') | BSL.null z -> Just a'       _ -> Nothing +#ifdef HAS_bytes id_cereal_to_bytes :: (Cer.Serialize a, Bytes.Serial a) => a -> Maybe a id_cereal_to_bytes = \a ->    case Bytes.runGetS Bytes.deserialize (Cer.encode a) of      Left _ -> Nothing      Right a' -> Just a' -id_binary_to_cereal :: (Bin.Binary a, Cer.Serialize a) => a -> Maybe a-id_binary_to_cereal = \a ->-  case Cer.decodeLazy (Bin.encode a) of-     Right a' -> Just a'-     Left _ -> Nothing--id_binary_to_bytes :: (Bin.Binary a, Bytes.Serial a) => a -> Maybe a-id_binary_to_bytes = \a ->-   case Bytes.runGetS Bytes.deserialize (BSL.toStrict (Bin.encode a)) of-     Left _ -> Nothing-     Right a' -> Just a'--id_bytes_to_binary :: (Bytes.Serial a, Bin.Binary a) => a -> Maybe a-id_bytes_to_binary = \a ->-   case Bin.decodeOrFail (Bytes.runPutL (Bytes.serialize a)) of-      Right (z,_,a') | BSL.null z -> Just a'-      _ -> Nothing- id_bytes_to_cereal :: (Bytes.Serial a, Cer.Serialize a) => a -> Maybe a id_bytes_to_cereal = \a ->   case Cer.decodeLazy (Bytes.runPutL (Bytes.serialize a)) of      Right a' -> Just a'      Left _ -> Nothing------------------------------------------------------------------------------------data family X1 :: Bool -> Type-data instance X1 'False = XF1 | XF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X1 'True = XT1 | XT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)--data family X2 :: Bool -> Bool -> Type-data instance X2 'False 'False = XFF1 | XFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X2 'False 'True = XFT1 | XFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X2 'True 'False = XTF1 | XTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X2 'True 'True = XTT1 | XTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)--data family X3 :: Bool -> Bool -> Bool -> Type-data instance X3 'False 'False 'False = XFFF1 | XFFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'False 'False 'True = XFFT1 | XFFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'False 'True 'False = XFTF1 | XFTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'False 'True 'True = XFTT1 | XFTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'True 'False 'False = XTFF1 | XTFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'True 'False 'True = XTFT1 | XTFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'True 'True 'False = XTTF1 | XTTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X3 'True 'True 'True = XTTT1 | XTTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)--data family X4 :: Bool -> Bool -> Bool -> Bool -> Type-data instance X4 'False 'False 'False 'False = XFFFF1 | XFFFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'False 'False 'True = XFFFT1 | XFFFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'False 'True 'False = XFFTF1 | XFFTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'False 'True 'True = XFFTT1 | XFFTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'True 'False 'False = XFTFF1 | XFTFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'True 'False 'True = XFTFT1 | XFTFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'True 'True 'False = XFTTF1 | XFTTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'False 'True 'True 'True = XFTTT1 | XFTTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'False 'False 'False = XTFFF1 | XTFFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'False 'False 'True = XTFFT1 | XTFFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'False 'True 'False = XTFTF1 | XTFTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'False 'True 'True = XTFTT1 | XTFTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'True 'False 'False = XTTFF1 | XTTFF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'True 'False 'True = XTTFT1 | XTTFT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'True 'True 'False = XTTTF1 | XTTTF2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)-data instance X4 'True 'True 'True 'True = XTTTT1 | XTTTT2 Int32 deriving (Eq, Show, Read, G.Generic, Aeson.FromJSON, Aeson.ToJSON, Bytes.Serial, Bin.Binary, Cer.Serialize, Cborg.Serialise, NFData, Hashable)------------------------------------------------------------------------------------- Arbitrary instances--instance QC.Arbitrary (X1 'False) where arbitrary = QC.oneof [ pure XF1, fmap XF2 QC.arbitrary ]-instance QC.Arbitrary (X1 'True) where arbitrary = QC.oneof [ pure XT1, fmap XT2 QC.arbitrary ]--instance QC.Arbitrary (X2 'False 'False) where arbitrary = QC.oneof [ pure XFF1, fmap XFF2 QC.arbitrary ]-instance QC.Arbitrary (X2 'False 'True) where arbitrary = QC.oneof [ pure XFT1, fmap XFT2 QC.arbitrary ]-instance QC.Arbitrary (X2 'True 'False) where arbitrary = QC.oneof [ pure XTF1, fmap XTF2 QC.arbitrary ]-instance QC.Arbitrary (X2 'True 'True) where arbitrary = QC.oneof [ pure XTT1, fmap XTT2 QC.arbitrary ]--instance QC.Arbitrary (X3 'False 'False 'False) where arbitrary = QC.oneof [ pure XFFF1, fmap XFFF2 QC.arbitrary ]-instance QC.Arbitrary (X3 'False 'False 'True) where arbitrary = QC.oneof [ pure XFFT1, fmap XFFT2 QC.arbitrary ]-instance QC.Arbitrary (X3 'False 'True 'False) where arbitrary = QC.oneof [ pure XFTF1, fmap XFTF2 QC.arbitrary ]-instance QC.Arbitrary (X3 'False 'True 'True) where arbitrary = QC.oneof [ pure XFTT1, fmap XFTT2 QC.arbitrary ]-instance QC.Arbitrary (X3 'True 'False 'False) where arbitrary = QC.oneof [ pure XTFF1, fmap XTFF2 QC.arbitrary ]-instance QC.Arbitrary (X3 'True 'False 'True) where arbitrary = QC.oneof [ pure XTFT1, fmap XTFT2 QC.arbitrary ]-instance QC.Arbitrary (X3 'True 'True 'False) where arbitrary = QC.oneof [ pure XTTF1, fmap XTTF2 QC.arbitrary ]-instance QC.Arbitrary (X3 'True 'True 'True) where arbitrary = QC.oneof [ pure XTTT1, fmap XTTT2 QC.arbitrary ]--instance QC.Arbitrary (X4 'False 'False 'False 'False) where arbitrary = QC.oneof [ pure XFFFF1, fmap XFFFF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'False 'False 'True) where arbitrary = QC.oneof [ pure XFFFT1, fmap XFFFT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'False 'True 'False) where arbitrary = QC.oneof [ pure XFFTF1, fmap XFFTF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'False 'True 'True) where arbitrary = QC.oneof [ pure XFFTT1, fmap XFFTT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'True 'False 'False) where arbitrary = QC.oneof [ pure XFTFF1, fmap XFTFF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'True 'False 'True) where arbitrary = QC.oneof [ pure XFTFT1, fmap XFTFT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'True 'True 'False) where arbitrary = QC.oneof [ pure XFTTF1, fmap XFTTF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'False 'True 'True 'True) where arbitrary = QC.oneof [ pure XFTTT1, fmap XFTTT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'False 'False 'False) where arbitrary = QC.oneof [ pure XTFFF1, fmap XTFFF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'False 'False 'True) where arbitrary = QC.oneof [ pure XTFFT1, fmap XTFFT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'False 'True 'False) where arbitrary = QC.oneof [ pure XTFTF1, fmap XTFTF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'False 'True 'True) where arbitrary = QC.oneof [ pure XTFTT1, fmap XTFTT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'True 'False 'False) where arbitrary = QC.oneof [ pure XTTFF1, fmap XTTFF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'True 'False 'True) where arbitrary = QC.oneof [ pure XTTFT1, fmap XTTFT2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'True 'True 'False) where arbitrary = QC.oneof [ pure XTTTF1, fmap XTTTF2 QC.arbitrary ]-instance QC.Arbitrary (X4 'True 'True 'True 'True) where arbitrary = QC.oneof [ pure XTTTT1, fmap XTTTT2 QC.arbitrary ]+#endif+#endif +#ifdef HAS_serialise+INSTANCETRON(Cborg.Serialise)+id_serialise :: Cborg.Serialise a => a -> Maybe a+id_serialise = \a ->+  case Cborg.deserialiseOrFail (Cborg.serialise a) of+    Right a' -> Just a'+    Left _   -> Nothing+#endif