{-# LANGUAGE CPP #-}
module Database.PostgreSQL.Simple.Compat
( mask
, (<>)
, unsafeDupablePerformIO
, toByteString
, scientificBuilder
, toPico
, fromPico
) where
import qualified Control.Exception as E
import Data.ByteString (ByteString)
import Data.ByteString.Lazy (toStrict)
import Data.ByteString.Builder (Builder, toLazyByteString)
import Data.Text.Lazy.Builder.Scientific (scientificBuilder)
import System.IO.Unsafe (unsafeDupablePerformIO)
import Data.Fixed (Pico)
import Data.Fixed (Fixed(MkFixed))
mask :: ((IO a -> IO a) -> IO b) -> IO b
mask :: forall a b. ((IO a -> IO a) -> IO b) -> IO b
mask (IO a -> IO a) -> IO b
io = ((forall a. IO a -> IO a) -> IO b) -> IO b
forall b. ((forall a. IO a -> IO a) -> IO b) -> IO b
E.mask (((forall a. IO a -> IO a) -> IO b) -> IO b)
-> ((forall a. IO a -> IO a) -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \forall a. IO a -> IO a
restore -> (IO a -> IO a) -> IO b
io IO a -> IO a
forall a. IO a -> IO a
restore
{-# INLINE mask #-}
toByteString :: Builder -> ByteString
toByteString :: Builder -> ByteString
toByteString Builder
x = LazyByteString -> ByteString
toStrict (Builder -> LazyByteString
toLazyByteString Builder
x)
toPico :: Integer -> Pico
toPico :: Integer -> Pico
toPico = Integer -> Pico
forall k (a :: k). Integer -> Fixed a
MkFixed
fromPico :: Pico -> Integer
fromPico :: Pico -> Integer
fromPico (MkFixed Integer
i) = Integer
i