regional-pointers-0.1.0.1: Regional memory pointersSource codeContentsIndex
Foreign.C.String.Region
MaintainerBas van Dijk <v.dijk.bas@gmail.com>
Contents
Regional C Strings
Using a locale-dependent encoding
Using 8-bit characters
C wide strings
Description
Lifts functions and types from Foreign.C.String to regional pointers.
Synopsis
type RegionalCString r = RegionalPtr CChar r
type RegionalCStringLen r = (RegionalPtr CChar r, Int)
peekCString :: (ParentOf pr cr, MonadIO cr) => RegionalCString pr -> cr String
peekCStringLen :: (ParentOf pr cr, MonadIO cr) => RegionalCStringLen pr -> cr String
newCString :: MonadCatchIO pr => String -> RegionT s pr (RegionalCString (RegionT s pr))
newCStringLen :: MonadCatchIO pr => String -> RegionT s pr (RegionalCStringLen (RegionT s pr))
withCString :: MonadCatchIO pr => String -> (forall s. RegionalCString (RegionT s pr) -> RegionT s pr α) -> pr α
withCStringLen :: MonadCatchIO pr => String -> (forall s. RegionalCStringLen (RegionT s pr) -> RegionT s pr α) -> pr α
charIsRepresentable :: MonadIO m => Char -> m Bool
castCharToCChar :: Char -> CChar
castCCharToChar :: CChar -> Char
peekCAString :: (ParentOf pr cr, MonadIO cr) => RegionalCString pr -> cr String
peekCAStringLen :: (ParentOf pr cr, MonadIO cr) => RegionalCStringLen pr -> cr String
newCAString :: MonadCatchIO pr => String -> RegionT s pr (RegionalCString (RegionT s pr))
newCAStringLen :: MonadCatchIO pr => String -> RegionT s pr (RegionalCStringLen (RegionT s pr))
withCAString :: MonadCatchIO pr => String -> (forall s. RegionalCString (RegionT s pr) -> RegionT s pr α) -> pr α
withCAStringLen :: MonadCatchIO pr => String -> (forall s. RegionalCStringLen (RegionT s pr) -> RegionT s pr α) -> pr α
type RegionalCWString r = RegionalPtr CWchar r
type RegionalCWStringLen r = (RegionalPtr CWchar r, Int)
peekCWString :: (ParentOf pr cr, MonadIO cr) => RegionalCWString pr -> cr String
peekCWStringLen :: (ParentOf pr cr, MonadIO cr) => RegionalCWStringLen pr -> cr String
newCWString :: MonadCatchIO pr => String -> RegionT s pr (RegionalCWString (RegionT s pr))
newCWStringLen :: MonadCatchIO pr => String -> RegionT s pr (RegionalCWStringLen (RegionT s pr))
withCWString :: MonadCatchIO pr => String -> (forall s. RegionalCWString (RegionT s pr) -> RegionT s pr α) -> pr α
withCWStringLen :: MonadCatchIO pr => String -> (forall s. RegionalCWStringLen (RegionT s pr) -> RegionT s pr α) -> pr α
Regional C Strings
type RegionalCString r = RegionalPtr CChar rSource

Handy type synonym for a regional pointer to an array of C characters terminated by a NUL.

This should provide a safer replacement for Foreign.C.String.CString.

type RegionalCStringLen r = (RegionalPtr CChar r, Int)Source

Handy type synonym for a regional pointer to an array of C characters which is paired with the length of the array instead of terminated by a NUL. (Thus allowing NUL characters in the middle of the string)

This should provide a safer replacement for Foreign.C.String.CStringLen.

Using a locale-dependent encoding
peekCString :: (ParentOf pr cr, MonadIO cr) => RegionalCString pr -> cr StringSource
peekCStringLen :: (ParentOf pr cr, MonadIO cr) => RegionalCStringLen pr -> cr StringSource
newCString :: MonadCatchIO pr => String -> RegionT s pr (RegionalCString (RegionT s pr))Source
newCStringLen :: MonadCatchIO pr => String -> RegionT s pr (RegionalCStringLen (RegionT s pr))Source
withCString :: MonadCatchIO pr => String -> (forall s. RegionalCString (RegionT s pr) -> RegionT s pr α) -> pr αSource
withCStringLen :: MonadCatchIO pr => String -> (forall s. RegionalCStringLen (RegionT s pr) -> RegionT s pr α) -> pr αSource
charIsRepresentable :: MonadIO m => Char -> m BoolSource
Using 8-bit characters
castCharToCChar :: Char -> CCharSource
Convert a Haskell character to a C character. This function is only safe on the first 256 characters.
castCCharToChar :: CChar -> CharSource
Convert a C byte, representing a Latin-1 character, to the corresponding Haskell character.
peekCAString :: (ParentOf pr cr, MonadIO cr) => RegionalCString pr -> cr StringSource
peekCAStringLen :: (ParentOf pr cr, MonadIO cr) => RegionalCStringLen pr -> cr StringSource
newCAString :: MonadCatchIO pr => String -> RegionT s pr (RegionalCString (RegionT s pr))Source
newCAStringLen :: MonadCatchIO pr => String -> RegionT s pr (RegionalCStringLen (RegionT s pr))Source
withCAString :: MonadCatchIO pr => String -> (forall s. RegionalCString (RegionT s pr) -> RegionT s pr α) -> pr αSource
withCAStringLen :: MonadCatchIO pr => String -> (forall s. RegionalCStringLen (RegionT s pr) -> RegionT s pr α) -> pr αSource
C wide strings
type RegionalCWString r = RegionalPtr CWchar rSource

Handy type synonym for a regional pointer to an array of C wide characters terminated by a NUL.

This should provide a safer replacement for Foreign.C.String.CWString.

type RegionalCWStringLen r = (RegionalPtr CWchar r, Int)Source

Handy type synonym for a regional pointer to an array of C wide characters which is paired with the length of the array instead of terminated by a NUL. (Thus allowing NUL characters in the middle of the string)

This should provide a safer replacement for Foreign.C.String.CWStringLen.

peekCWString :: (ParentOf pr cr, MonadIO cr) => RegionalCWString pr -> cr StringSource
peekCWStringLen :: (ParentOf pr cr, MonadIO cr) => RegionalCWStringLen pr -> cr StringSource
newCWString :: MonadCatchIO pr => String -> RegionT s pr (RegionalCWString (RegionT s pr))Source
newCWStringLen :: MonadCatchIO pr => String -> RegionT s pr (RegionalCWStringLen (RegionT s pr))Source
withCWString :: MonadCatchIO pr => String -> (forall s. RegionalCWString (RegionT s pr) -> RegionT s pr α) -> pr αSource
withCWStringLen :: MonadCatchIO pr => String -> (forall s. RegionalCWStringLen (RegionT s pr) -> RegionT s pr α) -> pr αSource
Produced by Haddock version 2.6.0