on master help sign in
Merge
312f7ebBryan O'Sullivan
Data/Aeson/Types/Generic.hs+10−2
@@ -1,4 +1,4 @@
1−{-# LANGUAGE DefaultSignatures, EmptyDataDecls, FlexibleInstances,
1+{-# LANGUAGE CPP, DefaultSignatures, EmptyDataDecls, FlexibleInstances,
2 FunctionalDependencies, KindSignatures, OverlappingInstances,
2 FunctionalDependencies, KindSignatures, OverlappingInstances,
3 ScopedTypeVariables, TypeOperators, UndecidableInstances,
3 ScopedTypeVariables, TypeOperators, UndecidableInstances,
4 ViewPatterns, NamedFieldPuns, FlexibleContexts, PatternGuards,
4 ViewPatterns, NamedFieldPuns, FlexibleContexts, PatternGuards,
@@ -24,7 +24,7 @@ import Control.Monad ((<=<))
24import Control.Monad.ST (ST)
24import Control.Monad.ST (ST)
25import Data.Aeson.Types.Class
25import Data.Aeson.Types.Class
26import Data.Aeson.Types.Internal
26import Data.Aeson.Types.Internal
27−import Data.Bits (shiftR)
27+import Data.Bits
28import Data.DList (DList, toList, empty)
28import Data.DList (DList, toList, empty)
29import Data.Maybe (fromMaybe)
29import Data.Maybe (fromMaybe)
30import Data.Monoid (mappend)
30import Data.Monoid (mappend)
@@ -249,7 +249,11 @@ instance ( WriteProduct a
249 writeProduct opts mv ix lenL a
249 writeProduct opts mv ix lenL a
250 writeProduct opts mv ixR lenR b
250 writeProduct opts mv ixR lenR b
251 where
251 where
252+#if MIN_VERSION_base(4,5,0)
253+ lenL = len `unsafeShiftR` 1
254+#else
252 lenL = len `shiftR` 1
255 lenL = len `shiftR` 1
256+#endif
253 lenR = len - lenL
257 lenR = len - lenL
254 ixR = ix + lenL
258 ixR = ix + lenL
255 {-# INLINE writeProduct #-}
259 {-# INLINE writeProduct #-}
@@ -523,7 +527,11 @@ instance (FromProduct a, FromProduct b) => FromProduct (a :*: b) where
523 (:*:) <$> parseProduct opts arr ix lenL
527 (:*:) <$> parseProduct opts arr ix lenL
524 <*> parseProduct opts arr ixR lenR
528 <*> parseProduct opts arr ixR lenR
525 where
529 where
530+#if MIN_VERSION_base(4,5,0)
531+ lenL = len `unsafeShiftR` 1
532+#else
526 lenL = len `shiftR` 1
533 lenL = len `shiftR` 1
534+#endif
527 ixR = ix + lenL
535 ixR = ix + lenL
528 lenR = len - lenL
536 lenR = len - lenL
529 {-# INLINE parseProduct #-}
537 {-# INLINE parseProduct #-}