| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Effectful.Dispatch.Static.Unsafe
Description
Unsafe utilities for statically dispatched effects.
Synopsis
- reallyUnsafeLiftMapIO :: (IO a -> IO b) -> Eff es a -> Eff es b
- reallyUnsafeUnliftIO :: ((forall r. Eff es r -> IO r) -> IO a) -> Eff es a
Documentation
reallyUnsafeLiftMapIO :: (IO a -> IO b) -> Eff es a -> Eff es b Source #
Utility for lifting IO computations of type
IOa ->IOb
to
Effes a ->Effes b
This function is really unsafe because:
- It can be used to introduce arbitrary
IOactions into pureEffcomputations. - The
IOcomputation must run its argument in a way that's perceived as sequential to the outside observer, e.g. in the same thread or in a worker thread that finishes before the argument is run again.
Warning: if you disregard the second point, you will experience weird bugs, data races or internal consistency check failures.
When in doubt, use unsafeLiftMapIO, especially
since this version saves only a simple safety check per call of
reallyUnsafeLiftMapIO f.
reallyUnsafeUnliftIO :: ((forall r. Eff es r -> IO r) -> IO a) -> Eff es a Source #
Create an unlifting function.
This function is really unsafe because:
- It can be used to introduce arbitrary
IOactions into pureEffcomputations. - Unlifted
Effcomputations must be run in a way that's perceived as sequential to the outside observer, e.g. in the same thread as the caller ofreallyUnsafeUnliftIOor in a worker thread that finishes before another unlifted computation is run.
Warning: if you disregard the second point, you will experience weird bugs, data races or internal consistency check failures.
When in doubt, use unsafeSeqUnliftIO, especially
since this version saves only a simple safety check per call of the unlifting
function.