SSize type for Foreign.C.Types
Motivation
The ssize_t
type is not included as part of the Foreign.C.Types
module. The type is used as a return value of various system calls, such as read(2)
. The type is part of the POSIX standard, hence it is present on the platforms supported by GHC. Having the type available for FFI mappings is useful.
Proposal
Well, the idea is rather straightforward: the base
library should be enriched with the CSSize
type that directly maps to the C type ssize_t
on the respective platform/OS.
Possible Implementation?
In ghc/libraries/base/src/Foreign/C/Types.hs
-- | Haskell type representing the C @ssize_t@ type.
-- /(The concrete types of "Foreign.C.Types#platform" are platform-specific.)/
INTEGRAL_TYPE(CSSize,"ssize_t",HTYPE_SSIZE_T)
The HTYPE_SSIZE_T
appears to already exist as a C define
in the HsBaseConfig
.