| Maintainer | Bas 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.
- unsafeRegionalPtr :: MonadIO pr => Ptr α -> Finalizer -> RegionT s pr (RegionalPtr α (RegionT s pr))
- unsafePureRegionalPtr :: Ptr α -> RegionalPtr α RootRegion
- unsafePtr :: RegionalPtr α r -> Ptr α
- unsafeWrap :: MonadIO m => (Ptr α -> IO β) -> RegionalPtr α r -> m β
- unsafeWrap2 :: MonadIO m => (Ptr α -> γ -> IO β) -> RegionalPtr α r -> γ -> m β
- unsafeWrap3 :: MonadIO m => (Ptr α -> γ -> δ -> IO β) -> RegionalPtr α r -> γ -> δ -> m β
Unsafely constructing regional pointers
unsafeRegionalPtr :: MonadIO pr => Ptr α -> Finalizer -> 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 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.
unsafePureRegionalPtr :: Ptr α -> RegionalPtr α RootRegionSource
Construct a regional pointer from a native pointer
without registering a finalizer like free ptr.
This function is unsafe because this library can't guarantee the finalisation of the pointer, you have to verify the correct finalisation yourself.
Note that the region parameter of the RegionalPtr is set to RootRegion
which is the ancestor of any region. This allows the regional pointer to be
used in any region.
Unsafe utility functions for lifting operations on Ptrs to RegionalPtrs
unsafePtr :: RegionalPtr α r -> Ptr αSource
Retrieve the native pointer from a regional pointer.
This function is unsafe because it both allows you to free the pointer
before the region terminates and use the pointer outside the region when it
is already freed.
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