From 1ea895a798bd7fa988dc03d2108c36c714a53a5a Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Fri, 29 Nov 2019 10:43:40 -0500 Subject: [PATCH 1/3] Support BoxedRep --- src/Data/Binary/Class.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index a3d3878c..30b5f679 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -106,6 +106,10 @@ import Numeric.Natural import qualified Data.Fixed as Fixed +#if MIN_VERSION_base(4,14,0) +import GHC.Exts (Levity(Lifted,Unlifted)) +#endif + -- -- This isn't available in older Hugs or older GHC -- @@ -879,8 +883,13 @@ instance Binary RuntimeRep where put (VecRep a b) = putWord8 0 >> put a >> put b put (TupleRep reps) = putWord8 1 >> put reps put (SumRep reps) = putWord8 2 >> put reps +#if __GLASGOW_HASKELL__ >= 811 + put (BoxedRep Lifted) = putWord8 3 + put (BoxedRep Unlifted) = putWord8 4 +#else put LiftedRep = putWord8 3 put UnliftedRep = putWord8 4 +#endif put IntRep = putWord8 5 put WordRep = putWord8 6 put Int64Rep = putWord8 7 @@ -905,8 +914,13 @@ instance Binary RuntimeRep where 0 -> VecRep <$> get <*> get 1 -> TupleRep <$> get 2 -> SumRep <$> get +#if __GLASGOW_HASKELL__ >= 811 + 3 -> pure (BoxedRep Lifted) + 4 -> pure (BoxedRep Unlifted) +#else 3 -> pure LiftedRep 4 -> pure UnliftedRep +#endif 5 -> pure IntRep 6 -> pure WordRep 7 -> pure Int64Rep From 0d68bf16f32b4843b38629f34480684d0c32e2d3 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Mon, 18 May 2020 07:04:55 -0400 Subject: [PATCH 2/3] Change base bound to GHC bound in ifdef --- src/Data/Binary/Class.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 30b5f679..4986f33b 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -106,7 +106,7 @@ import Numeric.Natural import qualified Data.Fixed as Fixed -#if MIN_VERSION_base(4,14,0) +#if __GLASGOW_HASKELL__ >= 811 import GHC.Exts (Levity(Lifted,Unlifted)) #endif From de151820fdb3006a887e36c55fd856d1f0a4dd37 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Thu, 8 Oct 2020 12:10:32 -0400 Subject: [PATCH 3/3] Bump GHC version in ifdefs to 901 --- src/Data/Binary/Class.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 4986f33b..d1003d75 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -106,7 +106,7 @@ import Numeric.Natural import qualified Data.Fixed as Fixed -#if __GLASGOW_HASKELL__ >= 811 +#if __GLASGOW_HASKELL__ >= 901 import GHC.Exts (Levity(Lifted,Unlifted)) #endif @@ -883,7 +883,7 @@ instance Binary RuntimeRep where put (VecRep a b) = putWord8 0 >> put a >> put b put (TupleRep reps) = putWord8 1 >> put reps put (SumRep reps) = putWord8 2 >> put reps -#if __GLASGOW_HASKELL__ >= 811 +#if __GLASGOW_HASKELL__ >= 901 put (BoxedRep Lifted) = putWord8 3 put (BoxedRep Unlifted) = putWord8 4 #else @@ -914,7 +914,7 @@ instance Binary RuntimeRep where 0 -> VecRep <$> get <*> get 1 -> TupleRep <$> get 2 -> SumRep <$> get -#if __GLASGOW_HASKELL__ >= 811 +#if __GLASGOW_HASKELL__ >= 901 3 -> pure (BoxedRep Lifted) 4 -> pure (BoxedRep Unlifted) #else