future-resource-0.3.0.0: realtime resource handling with manual concurrency

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Future

Description

Similar to async package, however, suitable for manual threading and go without exceptions.

Synopsis

Documentation

data Progress a b Source

Constructors

Making 
Fixme a 
Finished b 

Instances

Functor (Progress a) 
(Show a, Show b) => Show (Progress a b) 

newtype Future a b Source

Two kinds of future is possible: (i) A pile of failures [a] and (ii) Successful result b.

Constructors

Future 

Fields

runFuture :: IO (Progress [a] b)
 

forceFuture :: Future a b -> ([a] -> IO b) -> IO b Source

Wait until future comes, and modify failure history.

waitFuture :: Future a b -> IO (Progress [a] b) Source

Just wait for the future honestly.

maybeChance :: Future a b -> ([a] -> IO b) -> IO (Maybe b) Source

Return Just when it is time. The history may be modified.

eitherChance :: Future a b -> IO (Progress [a] b) Source

If it is too early, immediately returns Making.

asyncIO :: ((Progress [a] b -> IO ()) -> IO ()) -> IO (Future a b) Source

asyncIO $ \update -> forkIO (doSth >>= update)

runAction :: Future a (IO b) -> IO () Source

Run an action created in given Future if it is available now.