Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Module containing the root types and some support functionality.

## Synopsis

- type BasicService m a b = a -> m b
- type MultiGetService m a b = BasicService m (MultiGetRequest a) (MultiGetResponse a b)
- type MultiGetRequest a = HashSet a
- type MultiGetResponse a b = HashMap a b
- type ResultVar a = MVar (Either SomeException a)
- type MToIO m = forall a. m a -> IO a
- type FailOrSuccess a b = Either SomeException (MultiGetResponse a b)
- multiGetToBasic :: (Hashable a, Eq a, Monad m) => MultiGetService m a b -> BasicService m a (Maybe b)
- basicToMultiGet :: (Hashable a, Eq a, Applicative m) => BasicService m a b -> MultiGetService m a b
- getResult :: MonadBaseControl IO m => ResultVar a -> m a
- makeCall :: (Eq a, Hashable a, MonadBaseControl IO m) => MultiGetService m a b -> HashSet a -> m (FailOrSuccess a b)

# Documentation

type BasicService m a b = a -> m b Source #

Type alias for the most basic form of a service supported.

type MultiGetService m a b = BasicService m (MultiGetRequest a) (MultiGetResponse a b) Source #

Type alias for a service that looks up multiple values and returns multiple results.

type MultiGetRequest a = HashSet a Source #

Type alias for the request portion of a `MultiGetService`

.

type MultiGetResponse a b = HashMap a b Source #

Type alias for the response portion of a `MultiGetService`

.

type ResultVar a = MVar (Either SomeException a) Source #

Type alias for the common container of a result used in asynchronous calls.

type FailOrSuccess a b = Either SomeException (MultiGetResponse a b) Source #

Type alias for either a failure or a successful response.

multiGetToBasic :: (Hashable a, Eq a, Monad m) => MultiGetService m a b -> BasicService m a (Maybe b) Source #

Convert a `MultiGetService`

into a `BasicService`

that looks up a single key, returning a `Maybe`

which determines if the value was present.

basicToMultiGet :: (Hashable a, Eq a, Applicative m) => BasicService m a b -> MultiGetService m a b Source #

Convert a `BasicService`

into a `MultiGetService`

makeCall :: (Eq a, Hashable a, MonadBaseControl IO m) => MultiGetService m a b -> HashSet a -> m (FailOrSuccess a b) Source #

Makes a multi-get call and handles the error bundling it up inside an `Either`

.