Safe Haskell | None |
---|---|
Language | Haskell2010 |
These functions exist because the underlying `opencascade-hs` library,
makes heavy use of Acquire
from resourcet
to handle memory management.
However `waterfall-cad` does not (at the highest level) keep values in the Acquire
monad.
(This is required to support functions like volume
, which return pure Haskell primitives.)
Synopsis
- unsafeFromAcquire :: Acquire a -> a
- fromAcquire :: Acquire a -> IO a
- toAcquire :: a -> Acquire a
Documentation
unsafeFromAcquire :: Acquire a -> a Source #
Converting to a value in the Acquire
monad, to a raw value.
Analagous to calling unsafePerformIO
to extract a value in the IO
monad.
The same constraints as apply to unsafePerformIO
apply to this method.
That is, it should only be used on "philosophically pure" actions.
The free
action of the resource is called when the underlying value goes out of scope of the Haskell garbage collection,
so may run at an unpredictable time.
fromAcquire :: Acquire a -> IO a Source #
Convert a resource in the Acquire
monad to a value in IO
the free
action of the resource is called when the underlying value goes out of scope of the Haskell garbage collection
so may run at an unpredictable time.
toAcquire :: a -> Acquire a Source #
Add a pure value (which may or may not have been generated by unsafeFromAcquire
) back into the Acquire monad.
Using this action _should_ prevent the underlying value from going out of GC scope untill the resource is freed.