module Network.Socket.SendFile.Util
( wrapSendFile'
) where
wrapSendFile' :: Integral i => (a -> b -> i -> i -> i -> IO c) -> a -> b -> Integer -> Integer -> Integer -> IO c
wrapSendFile' :: forall i a b c.
Integral i =>
(a -> b -> i -> i -> i -> IO c)
-> a -> b -> Integer -> Integer -> Integer -> IO c
wrapSendFile' a -> b -> i -> i -> i -> IO c
fun a
outp b
inp Integer
blockSize Integer
off Integer
count
| Integer
count forall a. Ord a => a -> a -> Bool
< Integer
0 = forall a. HasCallStack => [Char] -> a
error [Char]
"SendFile - count must be a positive integer"
| (Integer
count forall a. Eq a => a -> a -> Bool
/= Integer
0) Bool -> Bool -> Bool
&& (Integer
blockSize forall a. Ord a => a -> a -> Bool
<= Integer
0) = forall a. HasCallStack => [Char] -> a
error [Char]
"SendFile - blockSize must be a positive integer greater than 1"
| Integer
off forall a. Ord a => a -> a -> Bool
< Integer
0 = forall a. HasCallStack => [Char] -> a
error [Char]
"SendFile - offset must be a positive integer"
| Bool
otherwise = a -> b -> i -> i -> i -> IO c
fun a
outp b
inp (forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
blockSize) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
off) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
count)