-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Regional memory pointers -- -- The library allows you to allocate memory in a region yielding a -- regional pointer to it. When the region terminates all pointers are -- automatically freed. Most importantly, a pointer can't be returned -- from the region. So it's impossible to reference unallocated memory. -- -- The primary technique used in this package is called "Lightweight -- monadic regions" which was invented by Oleg Kiselyov and Chung-chieh -- Shan. See: -- -- http://okmij.org/ftp/Haskell/regions.html#light-weight -- -- This technique is implemented in the regions package which is -- re-exported from this library. -- -- This library provides wrappers around all the Ptr functions -- from the Foreign.* modules of the base library. @package regional-pointers @version 0.7 -- | Unsafe functions for constructing regional pointers, retrieving -- the native Ptr from a regional pointer and for lifting -- operations on Ptrs to RegionalPtrs. module Foreign.Ptr.Region.Unsafe -- | Construct a regional pointer from a native pointer and an IO -- computation that finalizes the pointer (like free ptr) which -- is performed when the region terminates. -- -- This function is unsafe because this library can't guarantee that the -- finalizer will actually finalize the pointer (suppose having -- return () as the finalizer). You have to verify the correct -- finalisation yourself. unsafeRegionalPtr :: MonadIO pr => Ptr α -> Finalizer -> RegionT s pr (RegionalPtr α (RegionT s pr)) wrapAlloca :: RegionControlIO pr => ((Ptr α -> IO (RegionT s pr β)) -> IO (RegionT s pr β)) -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β wrapAlloca2 :: RegionControlIO pr => ((γ -> Ptr α -> IO (RegionT s pr β)) -> IO (RegionT s pr β)) -> (forall sl. γ -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β wrapMalloc :: RegionControlIO pr => IO (Ptr α) -> RegionT s pr (RegionalPtr α (RegionT s pr)) wrapPeekStringLen :: (Pointer pointer, AncestorRegion pr cr, MonadIO cr) => ((Ptr α, Int) -> IO String) -> (pointer α pr, Int) -> cr String wrapNewStringLen :: RegionControlIO pr => IO (Ptr α, Int) -> RegionT s pr (RegionalPtr α (RegionT s pr), Int) wrapWithStringLen :: RegionControlIO pr => (((Ptr α, Int) -> IO (RegionT s pr β)) -> IO (RegionT s pr β)) -> (forall sl. (LocalPtr α (LocalRegion sl s), Int) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Retrieve the native pointer from a regional pointer. -- -- This function is unsafe because it allows you to both free -- the pointer before the region terminates and use the pointer outside -- the region when it is already freed. unsafePtr :: Pointer pointer => pointer α r -> Ptr α unsafeWrap :: (MonadIO m, Pointer pointer) => (Ptr α -> IO β) -> (pointer α r -> m β) unsafeWrap2 :: (MonadIO m, Pointer pointer) => (Ptr α -> γ -> IO β) -> (pointer α r -> γ -> m β) unsafeWrap3 :: (MonadIO m, Pointer pointer) => (Ptr α -> γ -> δ -> IO β) -> (pointer α r -> γ -> δ -> m β) unsafeWrap2flp :: (MonadIO m, Pointer pointer) => (γ -> Ptr α -> IO β) -> (γ -> pointer α r -> m β) module Foreign.Ptr.Region -- | A regional pointer to memory. -- -- This should provide a safer replacement for -- Foreign.Ptr.Ptr data RegionalPtr α r :: (* -> *) -- | The constant nullPtr is a pointer which is not associated -- with a valid memory location. -- -- Note that nullPtr is a pure value. This means it does not -- perform the side-effect of registering a finalizer like "free -- nullPtr" in the RegionT monad. -- -- Finally note that the region parameter of the NullPtr is set to -- RootRegion which is the ancestor of any region. This allows -- nullPtr to be used in any region. nullPtr :: NullPtr α RootRegion data NullPtr α r :: (* -> *) class Pointer pointer :: (* -> (* -> *) -> *) mapPointer :: Pointer pointer => (Ptr α -> Ptr β) -> (pointer α r -> pointer β r) -- | Class of pointers which point to allocated memory. NullPtr is -- the only pointer which is not an instance of this class. -- -- The super class PrivateAllocatedPointer is not exported by this -- module which ensures you can't accidentally make NullPtr an -- instance of this class. class PrivateAllocatedPointer pointer => AllocatedPointer pointer -- | The castPtr function casts a pointer from one type to -- another. -- -- Wraps: Foreign.Ptr.castPtr castPtr :: Pointer pointer => pointer α r -> pointer β r -- | Given an arbitrary address and an alignment constraint, -- alignPtr yields the next higher address that fulfills the -- alignment constraint. An alignment constraint x is fulfilled -- by any address divisible by x. This operation is idempotent. -- -- Wraps: Foreign.Ptr.alignPtr alignPtr :: AllocatedPointer pointer => pointer α r -> Int -> pointer α r -- | Advances the given address by the given offset in bytes. -- -- Wraps: Foreign.Ptr.plusPtr plusPtr :: AllocatedPointer pointer => pointer α r -> Int -> pointer β r -- | Computes the offset required to get from the second to the first -- argument. We have -- --
--   p2 == p1 `plusPtr` (p2 `minusPtr` p1)
--   
-- -- Wraps: Foreign.Ptr.minusPtr minusPtr :: AllocatedPointer pointer => pointer α r1 -> pointer β r2 -> Int module Foreign.Marshal.Alloc.Region -- | A regional pointer to memory which was locally allocated by one of the -- alloca-like functions. -- -- Note that a LocalPtr can not be duplicated to a parent -- region. data LocalPtr α r :: (* -> *) -- | alloca f executes the computation f, passing -- as argument a pointer to a temporarily allocated block of memory -- sufficient to hold values of type α. -- -- The memory is freed when f terminates (either normally or via -- an exception). -- -- This should provide a safer replacement for: -- Foreign.Marshal.Alloc.alloca. alloca :: (Storable α, RegionControlIO pr) => (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | allocaBytes n f executes the computation f, -- passing as argument a pointer to a temporarily allocated block of -- memory of n bytes. The block of memory is sufficiently -- aligned for any of the basic foreign types that fits into a memory -- block of the allocated size. -- -- The memory is freed when f terminates (either normally or via -- an exception). -- -- This should provide a safer replacement for: -- Foreign.Marshal.Alloc.allocaBytes. allocaBytes :: RegionControlIO pr => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | This should provide a safer replacement for: -- Foreign.Marshal.Alloc.allocaBytesAligned. allocaBytesAligned :: RegionControlIO pr => Int -> Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Allocate a block of memory that is sufficient to hold values of type -- α. -- -- Note that: malloc = mallocBytes $ sizeOf (undefined -- :: α) -- -- This should provide a safer replacement for: -- Foreign.Marshal.Alloc.malloc. malloc :: (Storable α, RegionControlIO pr) => RegionT s pr (RegionalPtr α (RegionT s pr)) -- | Allocate a block of memory of the given number of bytes. The block of -- memory is sufficiently aligned for any of the basic foreign types that -- fits into a memory block of the allocated size. -- -- This should provide a safer replacement for: -- Foreign.Marshal.Alloc.mallocBytes. mallocBytes :: RegionControlIO pr => Int -> RegionT s pr (RegionalPtr α (RegionT s pr)) module Foreign.Marshal.Utils.Region -- | with val f executes the computation f, -- passing as argument a regional pointer to a temporarily allocated -- block of memory into which val has been marshalled (the -- combination of alloca and poke). -- -- The memory is freed when f terminates (either normally or via -- an exception). -- -- This provides a safer replacement for -- Foreign.Marshal.Utils.with. with :: (Storable α, RegionControlIO pr) => α -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Allocate a block of memory and marshal a value into it (the -- combination of malloc and poke). The size of the -- area allocated is determined by the sizeOf method from the -- instance of Storable for the appropriate type. -- -- This provides a safer replacement for -- Foreign.Marshal.Utils.new. new :: (Storable α, RegionControlIO pr) => α -> RegionT s pr (RegionalPtr α (RegionT s pr)) -- | Convert a Haskell Bool to its numeric representation fromBool :: Num a => Bool -> a -- | Convert a Boolean in numeric representation to a Haskell value toBool :: Num a => a -> Bool -- | A MaybePointer α corresponds to a Maybe -- α but additionally introduces some type equalities to the -- type-checker. data MaybePointer α :: * pointer :: * β :: * r :: (* -> *) NullPointer :: MaybePointer α (NullPtr β RootRegion) β RootRegion JustPointer :: α -> MaybePointer α (RegionalPtr β r) β r -- | Allocate storage and marshal a storable value wrapped into a -- MaybePointer. -- -- The nullPtr is used to represent NullPointer. -- -- Alternative for maybeNew. maybeNew :: Monad m => (α -> m (RegionalPtr β r)) -> (MaybePointer α pointer β r -> m pointer) -- | Converts a withXXX combinator into one marshalling a value -- wrapped into a MaybePointer, using nullPtr to represent -- NoPointer. -- -- Alternative for maybeWith maybeWith :: (α -> (pointer -> m γ) -> m γ) -> (MaybePointer α pointer β r -> (pointer -> m γ) -> m γ) class MaybePeek pointer :: (* -> (* -> *) -> *) maybePeek :: (MaybePeek pointer, Applicative m) => (pointer α r -> m β) -> (pointer α r -> m (Maybe β)) -- | Replicates a withXXX combinator over a list of objects, -- yielding a list of marshalled objects withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res -- | Copies the given number of bytes from the second area (source) into -- the first (destination); the copied areas may not overlap -- -- Wraps: Foreign.Marshal.Utils.copyBytes. copyBytes :: (AllocatedPointer pointer1, AllocatedPointer pointer2, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) => pointer1 α pr1 -> pointer2 α pr2 -> Int -> cr () -- | Copies the given number of bytes from the second area (source) into -- the first (destination); the copied areas may overlap -- -- Wraps: Foreign.Marshal.Utils.moveBytes. moveBytes :: (AllocatedPointer pointer1, AllocatedPointer pointer2, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) => pointer1 α pr1 -> pointer2 α pr2 -> Int -> cr () instance MaybePeek RegionalPtr instance MaybePeek NullPtr module Foreign.Marshal.Array.Region -- | Allocate storage for the given number of elements of a storable type. -- -- Like malloc, but for multiple elements. mallocArray :: (Storable α, RegionControlIO pr) => Int -> RegionT s pr (RegionalPtr α (RegionT s pr)) -- | Like mallocArray, but add an extra position to hold a special -- termination element. mallocArray0 :: (Storable α, RegionControlIO pr) => Int -> RegionT s pr (RegionalPtr α (RegionT s pr)) -- | Temporarily allocate space for the given number of elements (like -- alloca, but for multiple elements). allocaArray :: (Storable α, RegionControlIO pr) => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Like allocaArray, but add an extra position to hold a special -- termination element. allocaArray0 :: (Storable α, RegionControlIO pr) => Int -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Convert an array of given length into a Haskell list. -- -- (This version traverses the array backwards using an accumulating -- parameter, which uses constant stack space. The previous version using -- mapM needed linear stack space.) -- -- Wraps: Foreign.Marshal.Array.peekArray. peekArray :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => Int -> pointer α pr -> cr [α] -- | Convert an array terminated by the given end marker into a Haskell -- list. -- -- Wraps: Foreign.Marshal.Array.peekArray0. peekArray0 :: (AllocatedPointer pointer, Storable α, Eq α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> cr [α] -- | Write the list elements consecutive into memory. -- -- Wraps: Foreign.Marshal.Array.pokeArray. pokeArray :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> [α] -> cr () -- | Write the list elements consecutive into memory and terminate them -- with the given marker element. -- -- Wraps: Foreign.Marshal.Array.pokeArray0. pokeArray0 :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> [α] -> cr () -- | Write a list of storable elements into a newly allocated, consecutive -- sequence of storable values. -- -- Like new, but for multiple elements. newArray :: (Storable α, RegionControlIO pr) => [α] -> RegionT s pr (RegionalPtr α (RegionT s pr)) -- | Write a list of storable elements into a newly allocated, consecutive -- sequence of storable values, where the end is fixed by the given end -- marker. newArray0 :: (Storable α, RegionControlIO pr) => α -> [α] -> RegionT s pr (RegionalPtr α (RegionT s pr)) -- | Temporarily store a list of storable values in memory. -- -- Like with, but for multiple elements. withArray :: (Storable α, RegionControlIO pr) => [α] -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Like withArray, but a terminator indicates where the array -- ends. withArray0 :: (Storable α, RegionControlIO pr) => α -> [α] -> (forall sl. LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Like withArray, but the action gets the number of values as an -- additional parameter. withArrayLen :: (Storable α, RegionControlIO pr) => [α] -> (forall sl. Int -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Like withArrayLen, but a terminator indicates where the array -- ends. withArrayLen0 :: (Storable α, RegionControlIO pr) => α -> [α] -> (forall sl. Int -> LocalPtr α (LocalRegion sl s) -> RegionT (Local s) pr β) -> RegionT s pr β -- | Copy the given number of elements from the second array (source) into -- the first array (destination); the copied areas may not -- overlap. -- -- Wraps: Foreign.Marshal.Array.copyArray. copyArray :: (AllocatedPointer pointer1, AllocatedPointer pointer2, Storable α, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) => pointer1 α pr1 -> pointer2 α pr2 -> Int -> cr () -- | Copy the given number of elements from the second array (source) into -- the first array (destination); the copied areas may overlap. -- -- Wraps: Foreign.Marshal.Array.moveArray. moveArray :: (AllocatedPointer pointer1, AllocatedPointer pointer2, Storable α, AncestorRegion pr1 cr, AncestorRegion pr2 cr, MonadIO cr) => pointer1 α pr1 -> pointer2 α pr2 -> Int -> cr () -- | Return the number of elements in an array, excluding the terminator. -- -- Wraps: Foreign.Marshal.Array.lengthArray0. lengthArray0 :: (AllocatedPointer pointer, Storable α, Eq α, AncestorRegion pr cr, MonadIO cr) => α -> pointer α pr -> cr Int -- | Advance a pointer into an array by the given number of elements. -- -- Wraps: Foreign.Marshal.Array.advancePtr. advancePtr :: (AllocatedPointer pointer, Storable α) => pointer α pr -> Int -> pointer α pr -- | Lifts methods of the Storable type class from -- Foreign.Storable to regional pointers. module Foreign.Storable.Region -- | Read a value from a memory area regarded as an array of values of the -- same kind. The first argument specifies the start address of the array -- and the second the index into the array (the first element of the -- array has index 0). The following equality holds, -- --
--   peekElemOff addr idx = IOExts.fixIO $ \result ->
--     peek (addr `plusPtr` (idx * sizeOf result))
--   
-- -- Note that this is only a specification, not necessarily the concrete -- implementation of the function. -- -- Wraps: Foreign.Storable.peekElemOff. peekElemOff :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> Int -> cr α -- | Write a value to a memory area regarded as an array of values of the -- same kind. The following equality holds: -- --
--   pokeElemOff addr idx x =
--     poke (addr `plusPtr` (idx * sizeOf x)) x
--   
-- -- Wraps: Foreign.Storable.pokeElemOff. pokeElemOff :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> Int -> α -> cr () -- | Read a value from a memory location given by a base address and -- offset. The following equality holds: -- --
--   peekByteOff addr off = peek (addr `plusPtr` off)
--   
-- -- Wraps: Foreign.Storable.peekByteOff. peekByteOff :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer β pr -> Int -> cr α -- | Write a value to a memory location given by a base address and offset. -- The following equality holds: -- --
--   pokeByteOff addr off x = poke (addr `plusPtr` off) x
--   
-- -- Wraps: Foreign.Storable.pokeByteOff. pokeByteOff :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer β pr -> Int -> α -> cr () -- | Read a value from the given memory location. -- -- Note that the peek and poke functions might require properly aligned -- addresses to function correctly. This is architecture dependent; thus, -- portable code should ensure that when peeking or poking values of some -- type a, the alignment constraint for a, as given by -- the function alignment is fulfilled. -- -- Wraps: Foreign.Storable.peek. peek :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> cr α -- | Write the given value to the given memory location. Alignment -- restrictions might apply; see peek. -- -- Wraps: Foreign.Storable.poke. poke :: (AllocatedPointer pointer, Storable α, AncestorRegion pr cr, MonadIO cr) => pointer α pr -> α -> cr () -- | Lifts functions and types from Foreign.C.String to regional -- pointers. module Foreign.C.String.Region -- | 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 RegionalCString pointer :: (* -> (* -> *) -> *) r = pointer CChar r -- | 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. type RegionalCStringLen pointer r = (RegionalCString pointer r, Int) -- | Marshal a NUL terminated C string into a Haskell string. -- -- Wraps: Foreign.C.String.peekCString peekCString :: (AllocatedPointer pointer, AncestorRegion pr cr, MonadIO cr) => RegionalCString pointer pr -> cr String -- | Marshal a C string with explicit length into a Haskell string. -- -- Wraps: Foreign.C.String.peekCStringLen. peekCStringLen :: (AllocatedPointer pointer, AncestorRegion pr cr, MonadIO cr) => RegionalCStringLen pointer pr -> cr String -- | Marshal a Haskell string into a NUL terminated C string. -- -- The Haskell string may not contain any NUL characters -- -- Wraps: Foreign.C.String.newCString. newCString :: RegionControlIO pr => String -> RegionT s pr (RegionalCString RegionalPtr (RegionT s pr)) -- | Marshal a Haskell string into a C string (ie, character array) with -- explicit length information. -- -- Wraps: Foreign.C.String.newCStringLen. newCStringLen :: RegionControlIO pr => String -> RegionT s pr (RegionalCStringLen RegionalPtr (RegionT s pr)) -- | Marshal a Haskell string into a NUL terminated C string using -- temporary storage. -- -- -- -- Wraps: Foreign.C.String.withCString. withCString :: RegionControlIO pr => String -> (forall sl. RegionalCString LocalPtr (LocalRegion sl s) -> RegionT (Local s) pr α) -> RegionT s pr α -- | Marshal a Haskell string into a C string (ie, character array) in -- temporary storage, with explicit length information. -- -- -- -- Wraps: Foreign.C.String.withCStringLen. withCStringLen :: RegionControlIO pr => String -> (forall sl. RegionalCStringLen LocalPtr (LocalRegion sl s) -> RegionT (Local s) pr α) -> RegionT s pr α -- | Generalizes Foreign.C.String.charIsRepresentable to -- any MonadIO. charIsRepresentable :: MonadIO m => Char -> m Bool -- | Convert a Haskell character to a C character. This function is only -- safe on the first 256 characters. castCharToCChar :: Char -> CChar -- | Convert a C byte, representing a Latin-1 character, to the -- corresponding Haskell character. castCCharToChar :: CChar -> Char -- | Convert a Haskell character to a C unsigned char. This -- function is only safe on the first 256 characters. castCharToCUChar :: Char -> CUChar -- | Convert a C unsigned char, representing a Latin-1 character, -- to the corresponding Haskell character. castCUCharToChar :: CUChar -> Char -- | Convert a Haskell character to a C signed char. This function -- is only safe on the first 256 characters. castCharToCSChar :: Char -> CSChar -- | Convert a C signed char, representing a Latin-1 character, to -- the corresponding Haskell character. castCSCharToChar :: CSChar -> Char -- | Marshal a NUL terminated C string into a Haskell string. -- -- Wraps: Foreign.C.String.peekCAString. peekCAString :: (AllocatedPointer pointer, AncestorRegion pr cr, MonadIO cr) => RegionalCString pointer pr -> cr String -- | Marshal a C string with explicit length into a Haskell string. -- -- Wraps: Foreign.C.String.peekCAStringLen. peekCAStringLen :: (AllocatedPointer pointer, AncestorRegion pr cr, MonadIO cr) => RegionalCStringLen pointer pr -> cr String -- | Marshal a Haskell string into a NUL terminated C string. -- -- The Haskell string may not contain any NUL characters -- -- Wraps: Foreign.C.String.newCAString. newCAString :: RegionControlIO pr => String -> RegionT s pr (RegionalCString RegionalPtr (RegionT s pr)) -- | Marshal a Haskell string into a C string (ie, character array) with -- explicit length information. -- -- Wraps: Foreign.C.String.newCAStringLen. newCAStringLen :: RegionControlIO pr => String -> RegionT s pr (RegionalCStringLen RegionalPtr (RegionT s pr)) -- | Marshal a Haskell string into a NUL terminated C string using -- temporary storage. -- -- -- -- Wraps: Foreign.C.String.withCAString. withCAString :: RegionControlIO pr => String -> (forall sl. RegionalCString LocalPtr (LocalRegion sl s) -> RegionT (Local s) pr α) -> RegionT s pr α -- | Marshal a Haskell string into a C string (ie, character array) in -- temporary storage, with explicit length information. -- -- -- -- Wraps: Foreign.C.String.withCAStringLen. withCAStringLen :: RegionControlIO pr => String -> (forall sl. RegionalCStringLen LocalPtr (LocalRegion sl s) -> RegionT (Local s) pr α) -> RegionT s pr α -- | 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 RegionalCWString pointer :: (* -> (* -> *) -> *) r = pointer CWchar r -- | 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. type RegionalCWStringLen pointer r = (RegionalCWString pointer r, Int) -- | Marshal a NUL terminated C wide string into a Haskell string. -- -- Wraps: Foreign.C.String.peekCWString. peekCWString :: (AllocatedPointer pointer, AncestorRegion pr cr, MonadIO cr) => RegionalCWString pointer pr -> cr String -- | Marshal a C wide string with explicit length into a Haskell string. -- -- Wraps: Foreign.C.String.peekCWStringLen. peekCWStringLen :: (AllocatedPointer pointer, AncestorRegion pr cr, MonadIO cr) => RegionalCWStringLen pointer pr -> cr String -- | Marshal a Haskell string into a NUL terminated C wide string. -- -- The Haskell string may not contain any NUL characters. -- -- Wraps: Foreign.C.String.newCWString. newCWString :: RegionControlIO pr => String -> RegionT s pr (RegionalCWString RegionalPtr (RegionT s pr)) -- | Marshal a Haskell string into a C wide string (ie, wide character -- array) with explicit length information. -- -- Wraps: Foreign.C.String.newCWStringLen. newCWStringLen :: RegionControlIO pr => String -> RegionT s pr (RegionalCWStringLen RegionalPtr (RegionT s pr)) -- | Marshal a Haskell string into a NUL terminated C wide string using -- temporary storage. -- -- -- -- Wraps: Foreign.C.String.withCWString. withCWString :: RegionControlIO pr => String -> (forall sl. RegionalCWString LocalPtr (LocalRegion sl s) -> RegionT (Local s) pr α) -> RegionT s pr α -- | Marshal a Haskell string into a NUL terminated C wide string using -- temporary storage. -- -- -- -- Wraps: Foreign.C.String.withCWStringLen. withCWStringLen :: RegionControlIO pr => String -> (forall sl. RegionalCWStringLen LocalPtr (LocalRegion sl s) -> RegionT (Local s) pr α) -> RegionT s pr α