[Haskell-cafe] advanced cabal configuration

Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=) kazu at iij.ad.jp
Wed May 20 02:02:23 UTC 2015


Hi Jonas,

> Couldn't you write something like this?
> 
> foreign import ccall unsafe "sendfile64"
>     c_sendfile64 :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
> 
> foreign import ccall unsafe "sendfile"
>     c_sendfile32 :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
> 
> c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
> c_sendfile = case sizeOf (undefined :: COff) of
>     4 -> c_sendfile32
>     8 -> c_sendfile64
>     _ -> error "COff has an unsupported size"

I think that this is possible. Thank you for your suggestion!

--Kazu


More information about the Haskell-Cafe mailing list