summaryrefslogtreecommitdiff
path: root/src/runtime/haskell/Data/Binary
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/haskell/Data/Binary')
-rw-r--r--src/runtime/haskell/Data/Binary/Builder.hs4
-rw-r--r--src/runtime/haskell/Data/Binary/Get.hs11
2 files changed, 12 insertions, 3 deletions
diff --git a/src/runtime/haskell/Data/Binary/Builder.hs b/src/runtime/haskell/Data/Binary/Builder.hs
index b69371f0e..a74428f20 100644
--- a/src/runtime/haskell/Data/Binary/Builder.hs
+++ b/src/runtime/haskell/Data/Binary/Builder.hs
@@ -68,7 +68,7 @@ import qualified Data.ByteString.Lazy as L
import Data.ByteString.Base (inlinePerformIO)
import qualified Data.ByteString.Base as S
#else
-import Data.ByteString.Internal (inlinePerformIO)
+import Data.ByteString.Internal (accursedUnutterablePerformIO)
import qualified Data.ByteString.Internal as S
--import qualified Data.ByteString.Lazy.Internal as L
#endif
@@ -199,7 +199,7 @@ defaultSize = 32 * k - overhead
-- | Sequence an IO operation on the buffer
unsafeLiftIO :: (Buffer -> IO Buffer) -> Builder
-unsafeLiftIO f = Builder $ \ k buf -> inlinePerformIO $ do
+unsafeLiftIO f = Builder $ \ k buf -> accursedUnutterablePerformIO $ do
buf' <- f buf
return (k buf')
{-# INLINE unsafeLiftIO #-}
diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs
index 6e98434f5..54f17ae95 100644
--- a/src/runtime/haskell/Data/Binary/Get.hs
+++ b/src/runtime/haskell/Data/Binary/Get.hs
@@ -101,6 +101,10 @@ import GHC.Word
--import GHC.Int
#endif
+-- Control.Monad.Fail import will become redundant in GHC 8.8+
+import qualified Control.Monad.Fail as Fail
+
+
-- | The parse state
data S = S {-# UNPACK #-} !B.ByteString -- current chunk
L.ByteString -- the rest of the input
@@ -126,6 +130,11 @@ instance Monad Get where
(a, s') -> unGet (k a) s')
{-# INLINE (>>=) #-}
+#if !(MIN_VERSION_base(4,13,0))
+ fail = failDesc
+#endif
+
+instance Fail.MonadFail Get where
fail = failDesc
instance MonadFix Get where
@@ -414,7 +423,7 @@ readN n f = fmap f $ getBytes n
getPtr :: Storable a => Int -> Get a
getPtr n = do
(fp,o,_) <- readN n B.toForeignPtr
- return . B.inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
+ return . B.accursedUnutterablePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
{- INLINE getPtr -}
------------------------------------------------------------------------