Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Similar to async package, however, suitable for manual threading and go without exceptions.
- data Progress a b
- newtype Future a b = Future {}
- type Future' = Future [String]
- desire :: MonadIO m => Future a b -> (a -> IO b) -> m b
- waitFor :: MonadIO m => Future a b -> m (Progress a b)
- maybeChance :: MonadIO m => Future a b -> (a -> IO b) -> m (Maybe b)
- getProgress :: MonadIO m => Future a b -> m (Progress a b)
- mkFuture :: MonadIO m => ((Progress a b -> IO ()) -> IO ()) -> m (Future a b)
- expect :: Show a => Future a b -> IO b
Documentation
Two kinds of future is possible: (i) A pile of failures (Monoid a) and (ii) Successful result b.
desire :: MonadIO m => Future a b -> (a -> IO b) -> m b Source
Wait until future comes, and modify failure history.
maybeChance :: MonadIO m => Future a b -> (a -> IO b) -> m (Maybe b) Source
Return Just
when it is time. The history may be modified.
getProgress :: MonadIO m => Future a b -> m (Progress a b) Source
If it is too early, immediately returns Making
.