Skip to content

Commit f54d203

Browse files
committed
unsafeWithForeignPtr fix
1 parent 59b5f6a commit f54d203

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Network/HTTP/Types/Status.hs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,17 @@ import Data.ByteString.Internal as B (
242242
ByteString (..),
243243
accursedUnutterablePerformIO,
244244
unsafeCreate,
245-
unsafeWithForeignPtr,
246245
)
247246
import Data.Data (Data)
248247
import Data.Function (on)
249248
import Foreign (Ptr, Word8, copyBytes, peek, plusPtr, poke)
249+
import GHC.ForeignPtr (
250+
#if MIN_VERSION_base(4,15,0)
251+
unsafeWithForeignPtr
252+
#else
253+
withForeignPtr
254+
#endif
255+
)
250256
import GHC.Generics (Generic)
251257

252258
-- | HTTP Status.
@@ -1267,3 +1273,8 @@ parseFullStatus bs = do
12671273
Just (w, ws)
12681274
| w == 0x20 -> Just $ mkStatus code ws
12691275
| otherwise -> Nothing
1276+
1277+
#if !MIN_VERSION_base(4,15,0)
1278+
unsafeWithForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b
1279+
unsafeWithForeignPtr = withForeignPtr
1280+
#endif

0 commit comments

Comments
 (0)