diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 51e184f32769a9524f42e90a2a074e52898736c4..0f4917d9608f1a459a9ff3bce9c2b226ea7589b0 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -974,7 +974,7 @@ putTypeRep (Fun arg res) = do put (3 :: Word8) putTypeRep arg putTypeRep res -putTypeRep _ = fail "GHCi.TH.Binary.putTypeRep: Impossible" +putTypeRep _ = error "GHCi.TH.Binary.putTypeRep: Impossible" getSomeTypeRep :: Get SomeTypeRep getSomeTypeRep = do diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs index c2ebcffadde4c8ddbfd0f51a4206948eb15d4936..a469cbe8c2406e6398c390a25e4458f71d7cd25e 100644 --- a/src/Data/Binary/Get/Internal.hs +++ b/src/Data/Binary/Get/Internal.hs @@ -91,12 +91,20 @@ type Success a r = B.ByteString -> a -> Decoder r instance Monad Get where return = pure (>>=) = bindG -#if MIN_VERSION_base(4,9,0) - fail = Fail.fail +#if !(MIN_VERSION_base(4,9,0)) + fail = failG -- base < 4.9 +#elif !(MIN_VERSION_base(4,13,0)) + fail = Fail.fail -- base < 4.13 +#endif +-- NB: Starting with base-4.13, the `fail` method +-- has been removed from the `Monad`-class +-- according to the MonadFail proposal (MFP) schedule +-- which completes the process that started with base-4.9. +#if MIN_VERSION_base(4,9,0) instance Fail.MonadFail Get where -#endif fail = failG +#endif bindG :: Get a -> (a -> Get b) -> Get b bindG (C c) f = C $ \i ks -> c i (\i' a -> (runCont (f a)) i' ks)