unix-simple- Straightforward bindings to the posix API
Safe HaskellNone




data CString Source #

A string for passing to C api functions. The C-compatible form is computed lazily; it will not be forced until the string is passed to a C API function. Internally, this is stored as a Builder with no trailing nul, so performance characteristics are mostly the same, only requiring a copy when first passing the string to an API function.


Instances details
IsString CString Source # 
Instance details

Defined in CString


fromString :: String -> CString #

Semigroup CString Source # 
Instance details

Defined in CString

Monoid CString Source # 
Instance details

Defined in CString

newtype CStr Source #

wrapper around a nul-terminated C style string; the pointer points to the beginning of the string.

Users of the library will mostly not use this directly, instead using CString.


CStr (Ptr CChar) 

useCStr :: CString -> (CStr -> IO a) -> IO a Source #

Use the raw pointer underlying the CString.

fromBuilder :: Builder -> CString Source #

Convert a Builder to a CString. The builder should not have a nul terminator; it will be added.

toBuilder :: CString -> Builder Source #

Extract a bytestring builder for the string. Does not include the nul terminator. O(1).