oath-0.1.1: Composable concurrent computation done right
Safe HaskellSafe-Inferred
LanguageHaskell2010

Oath

Synopsis

Documentation

newtype Oath a Source #

Constructors

Oath 

Fields

Instances

Instances details
Alternative Oath Source #

(<|>) waits for the first result, then cancel the loser

Instance details

Defined in Oath

Methods

empty :: Oath a #

(<|>) :: Oath a -> Oath a -> Oath a #

some :: Oath a -> Oath [a] #

many :: Oath a -> Oath [a] #

Applicative Oath Source #

(<*>) initiates both computations, then combines the results once they are done

Instance details

Defined in Oath

Methods

pure :: a -> Oath a #

(<*>) :: Oath (a -> b) -> Oath a -> Oath b #

liftA2 :: (a -> b -> c) -> Oath a -> Oath b -> Oath c #

(*>) :: Oath a -> Oath b -> Oath b #

(<*) :: Oath a -> Oath b -> Oath a #

Functor Oath Source # 
Instance details

Defined in Oath

Methods

fmap :: (a -> b) -> Oath a -> Oath b #

(<$) :: a -> Oath b -> Oath a #

Monoid a => Monoid (Oath a) Source # 
Instance details

Defined in Oath

Methods

mempty :: Oath a #

mappend :: Oath a -> Oath a -> Oath a #

mconcat :: [Oath a] -> Oath a #

Semigroup a => Semigroup (Oath a) Source # 
Instance details

Defined in Oath

Methods

(<>) :: Oath a -> Oath a -> Oath a #

sconcat :: NonEmpty (Oath a) -> Oath a #

stimes :: Integral b => b -> Oath a -> Oath a #

hoistOath :: (STM a -> STM b) -> Oath a -> Oath b Source #

Apply a function to the inner computation that waits for the result.

evalOath :: Oath a -> IO a Source #

Run an Oath and wait for the result.

tryOath :: Exception e => Oath a -> Oath (Either e a) Source #

Catch an exception thrown in the inner computation.

oath :: IO a -> Oath a Source #

Lift an IO action into an Oath, forking a thread. When the continuation terminates, it kills the thread. Exception thrown in the thread will be propagated to the result.

delay :: Int -> Oath () Source #

An Oath that finishes once the given number of microseconds elapses

timeout :: Int -> Oath a -> Oath (Maybe a) Source #

Returns nothing if the Oath does not finish within the given number of microseconds.