diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index a3d3878c..d1003d75 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 __GLASGOW_HASKELL__ >= 901 +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__ >= 901 + 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__ >= 901 + 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