regional-pointers-0.4: Regional memory pointers

MaintainerBas van Dijk <v.dijk.bas@gmail.com>

Foreign.Ptr.Region.Unsafe

Contents

Description

Unsafe functions for constructing regional pointers, retrieving the native Ptr from a regional pointer and for lifting operations on Ptrs to RegionalPtrs.

Synopsis

Unsafely constructing regional pointers

unsafeRegionalPtr :: MonadIO pr => Ptr α -> CloseAction -> RegionT s pr (RegionalPtr α (RegionT s pr))Source

Construct a regional pointer from a native pointer and an IO computation that finalizes the pointer (like free ptr) which is executed when the region exits.

This function is considered 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.

unsafePureRegionalPtr :: Ptr α -> RegionalPtr α rSource

Construct a regional pointer from a native pointer without registering a finalizer like free ptr.

This function is considered unsafe because this library can't guarantee the finalisation of the pointer, you have to do that yourself.

Unsafe utility functions for lifting operations on Ptrs to RegionalPtrs

unsafeWrap :: MonadIO m => (Ptr α -> IO β) -> RegionalPtr α r -> m βSource

unsafeWrap2 :: MonadIO m => (Ptr α -> γ -> IO β) -> RegionalPtr α r -> γ -> m βSource

unsafeWrap3 :: MonadIO m => (Ptr α -> γ -> δ -> IO β) -> RegionalPtr α r -> γ -> δ -> m βSource