Skip to content

Commit 13ad4c0

Browse files
andrewthadbgamari
authored andcommitted
Support BoxedRep
1 parent bccbece commit 13ad4c0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Data/Binary/Class.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ import Numeric.Natural
110110

111111
import qualified Data.Fixed as Fixed
112112

113+
#if MIN_VERSION_base(4,14,0)
114+
import GHC.Exts (Levity(Lifted,Unlifted))
115+
#endif
116+
113117
--
114118
-- This isn't available in older Hugs or older GHC
115119
--
@@ -885,8 +889,13 @@ instance Binary RuntimeRep where
885889
put (VecRep a b) = putWord8 0 >> put a >> put b
886890
put (TupleRep reps) = putWord8 1 >> put reps
887891
put (SumRep reps) = putWord8 2 >> put reps
892+
#if __GLASGOW_HASKELL__ >= 811
893+
put (BoxedRep Lifted) = putWord8 3
894+
put (BoxedRep Unlifted) = putWord8 4
895+
#else
888896
put LiftedRep = putWord8 3
889897
put UnliftedRep = putWord8 4
898+
#endif
890899
put IntRep = putWord8 5
891900
put WordRep = putWord8 6
892901
put Int64Rep = putWord8 7
@@ -911,8 +920,13 @@ instance Binary RuntimeRep where
911920
0 -> VecRep <$> get <*> get
912921
1 -> TupleRep <$> get
913922
2 -> SumRep <$> get
923+
#if __GLASGOW_HASKELL__ >= 811
924+
3 -> pure (BoxedRep Lifted)
925+
4 -> pure (BoxedRep Unlifted)
926+
#else
914927
3 -> pure LiftedRep
915928
4 -> pure UnliftedRep
929+
#endif
916930
5 -> pure IntRep
917931
6 -> pure WordRep
918932
7 -> pure Int64Rep

0 commit comments

Comments
 (0)