servant-0.11: A family of combinators for defining webservices APIs

Safe Haskell | None
Language | Haskell2010

Servant.Utils.Enter

Contents

- Servant combinators
- Leaf instances
- natural-transformation re-exports

Synopsis

- type family Entered m n api where ...
- class (Entered m n typ ~ ret, Entered n m ret ~ typ) => Enter typ m n ret | typ m n -> ret, ret m n -> typ, ret typ m -> n, ret typ n -> m where
- liftNat :: (MonadTrans t, Monad m) => m :~> t m
- runReaderTNat :: r -> ReaderT r m :~> m
- evalStateTLNat :: Monad m => s -> StateT s m :~> m
- evalStateTSNat :: Monad m => s -> StateT s m :~> m
- logWriterTSNat :: MonadIO m => (w -> IO ()) -> WriterT w m :~> m
- logWriterTLNat :: MonadIO m => (w -> IO ()) -> WriterT w m :~> m
- hoistNat :: (MFunctor t, Monad m) => (m :~> n) -> t m :~> t n
- embedNat :: (MMonad t, Monad n) => (m :~> t n) -> t m :~> t n
- squashNat :: (Monad m, MMonad t) => t (t m) :~> t m
- generalizeNat :: Applicative m => Identity :~> m
- newtype (k :~> f) g :: forall k. (k -> *) -> (k -> *) -> * = NT {
  - ($$) :: (~>) k f g
  }

# Documentation

type family Entered m n api where ... Source #

Helper type family to state the `Enter` symmetry.

Equations

Entered m n (a -> api) = a -> Entered m n api |
Entered m n (m a) = n a |
Entered m n (api1 :<|> api2) = Entered m n api1 :<|> Entered m n api2 |
Entered m n (Tagged m a) = Tagged n a |

class (Entered m n typ ~ ret, Entered n m ret ~ typ) => Enter typ m n ret | typ m n -> ret, ret m n -> typ, ret typ m -> n, ret typ n -> m where Source #

Minimal complete definition

enter

Methods

enter :: (m :~> n) -> typ -> ret Source #

Map the leafs of an API type.

Instances

((~) * (Entered m n (m a)) (n a), (~) * (Entered n m (n a)) (m a)) => Enter (m a) m n (n a) Source # |
Methods enter :: (* :~> m) n -> m a -> n a Source #
(Enter typ m n ret, (~) * (Entered m n (a -> typ)) (a -> ret), (~) * (Entered n m (a -> ret)) (a -> typ)) => Enter (a -> typ) m n (a -> ret) Source # |
Methods enter :: (* :~> m) n -> (a -> typ) -> a -> ret Source #
(Enter typ1 m1 n1 ret1, Enter typ2 m2 n2 ret2, (~) (* -> *) m1 m2, (~) (* -> *) n1 n2, (~) * (Entered m1 n1 ((:<|>) typ1 typ2)) ((:<|>) ret1 ret2), (~) * (Entered n1 m1 ((:<|>) ret1 ret2)) ((:<|>) typ1 typ2)) => Enter ((:<|>) typ1 typ2) m1 n1 ((:<|>) ret1 ret2) Source # |
Methods enter :: (* :~> m1) n1 -> (typ1 :<|> typ2) -> ret1 :<|> ret2 Source #
((~) * (Entered m n (Tagged (* -> *) m a)) (Tagged (* -> *) n a), (~) * (Entered n m (Tagged (* -> *) n a)) (Tagged (* -> *) m a)) => Enter (Tagged (* -> *) m a) m n (Tagged (* -> *) n a) Source # |
Methods enter :: (* :~> m) n -> Tagged (* -> *) m a -> Tagged (* -> *) n a Source #

## Servant combinators

## Leaf instances

liftNat :: (MonadTrans t, Monad m) => m :~> t m Source #

Like `lift`.

runReaderTNat :: r -> ReaderT r m :~> m Source #

evalStateTLNat :: Monad m => s -> StateT s m :~> m Source #

evalStateTSNat :: Monad m => s -> StateT s m :~> m Source #

logWriterTSNat :: MonadIO m => (w -> IO ()) -> WriterT w m :~> m Source #

Log the contents of `WriterT` with the function provided as the first argument, and return the value of the `WriterT` computation

logWriterTLNat :: MonadIO m => (w -> IO ()) -> WriterT w m :~> m Source #

Like `logWriterTSNat`, but for lazy `WriterT`.

hoistNat :: (MFunctor t, Monad m) => (m :~> n) -> t m :~> t n Source #

Like `mmorph`'s `hoist`.

embedNat :: (MMonad t, Monad n) => (m :~> t n) -> t m :~> t n Source #

Like `mmorph`'s `embed`.

squashNat :: (Monad m, MMonad t) => t (t m) :~> t m Source #

Like `mmorph`'s `squash`.

generalizeNat :: Applicative m => Identity :~> m Source #

Like `mmorph`'s `generalize`.

# natural-transformation re-exports

newtype (k :~> f) g :: forall k. (k -> *) -> (k -> *) -> * infixr 0 #

A natural transformation suitable for storing in a container.

Constructors

NT |

Fields

- ($$) :: (~>) k f g

Instances

Transformation k f g ((:~>) k f g) |
Methods (#) :: t -> forall a. g a -> (k :~> f) g a #
Category (k -> *) ((:~>) k) |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
(~) (k -> *) f g => Semigroup ((:~>) k f g) |
Methods (<>) :: (k :~> f) g -> (k :~> f) g -> (k :~> f) g # sconcat :: NonEmpty ((k :~> f) g) -> (k :~> f) g # stimes :: Integral b => b -> (k :~> f) g -> (k :~> f) g #
(~) (k -> *) f g => Monoid ((:~>) k f g) |
Methods mempty :: (k :~> f) g # mappend :: (k :~> f) g -> (k :~> f) g -> (k :~> f) g # mconcat :: [(k :~> f) g] -> (k :~> f) g #