Skip to content

Boxed rep 2020 10 08 #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Data/Binary/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
--
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down