on ffca3ac help sign in
37 lines 850 B history raw
1-- |
2-- Module : Streamly.Internal.BaseCompat
3-- License : BSD3
4-- Maintainer : streamly@composewell.com
5-- Stability : experimental
6-- Portability : GHC
7--
8-- Compatibility functions for "base" package.
9--
10module Streamly.Internal.BaseCompat
11 (
12 (#.)
13 , unsafeWithForeignPtr
14 )
15where
17import Data.Coerce (Coercible, coerce)
18import GHC.ForeignPtr (ForeignPtr(..))
19import GHC.Ptr (Ptr(..))
21#if MIN_VERSION_base(4,15,0)
22import qualified GHC.ForeignPtr as GHCForeignPtr
23#else
24import Foreign.ForeignPtr (withForeignPtr)
25#endif
28{-# INLINE (#.) #-}
29(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
30(#.) _f = coerce
32unsafeWithForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b
33#if MIN_VERSION_base(4,15,0)
34unsafeWithForeignPtr = GHCForeignPtr.unsafeWithForeignPtr
35#else
36unsafeWithForeignPtr = withForeignPtr
37#endif