Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Indexed
provides an indexed monad transformer
class and a class extending it to run Definition
s.
Synopsis
- class (forall i j m. Monad m => Functor (t i j m), forall i m. Monad m => Monad (t i i m), forall i. MonadTrans (t i i)) => IndexedMonadTrans t where
- pqAp :: Monad m => t i j m (x -> y) -> t j k m x -> t i k m y
- pqJoin :: Monad m => t i j m (t j k m y) -> t i k m y
- pqBind :: Monad m => (x -> t j k m y) -> t i j m x -> t i k m y
- pqThen :: Monad m => t j k m y -> t i j m x -> t i k m y
- pqAndThen :: Monad m => (y -> t j k m z) -> (x -> t i j m y) -> x -> t i k m z
- newtype Indexed t m r i j = Indexed {
- runIndexed :: t i j m r
- class IndexedMonadTrans pq => IndexedMonadTransPQ pq where
- define :: MonadIO io => Definition db0 db1 -> pq db0 db1 io ()
- indexedDefine :: (IndexedMonadTransPQ pq, MonadIO io) => Definition db0 db1 -> Indexed pq io () db0 db1
Documentation
class (forall i j m. Monad m => Functor (t i j m), forall i m. Monad m => Monad (t i i m), forall i. MonadTrans (t i i)) => IndexedMonadTrans t where Source #
An Atkey indexed monad
is a Functor
enriched category.
An indexed monad transformer transforms a Monad
into an indexed monad,
and is a monad transformer when its source and target are the same,
enabling use of standard do
notation for endo-index operations.
pqAp :: Monad m => t i j m (x -> y) -> t j k m x -> t i k m y Source #
indexed analog of <*>
pqJoin :: Monad m => t i j m (t j k m y) -> t i k m y Source #
indexed analog of join
pqBind :: Monad m => (x -> t j k m y) -> t i j m x -> t i k m y Source #
indexed analog of =<<
pqThen :: Monad m => t j k m y -> t i j m x -> t i k m y Source #
indexed analog of flipped >>
pqAndThen :: Monad m => (y -> t j k m z) -> (x -> t i j m y) -> x -> t i k m z Source #
indexed analog of <=<
Instances
IndexedMonadTrans PQ Source # | |
Defined in Squeal.PostgreSQL.Session pqAp :: forall (m :: Type -> Type) (i :: k) (j :: k) x y (k :: k). Monad m => PQ i j m (x -> y) -> PQ j k m x -> PQ i k m y Source # pqJoin :: forall (m :: Type -> Type) (i :: k) (j :: k) (k :: k) y. Monad m => PQ i j m (PQ j k m y) -> PQ i k m y Source # pqBind :: forall (m :: Type -> Type) x (j :: k) (k :: k) y (i :: k). Monad m => (x -> PQ j k m y) -> PQ i j m x -> PQ i k m y Source # pqThen :: forall (m :: Type -> Type) (j :: k) (k :: k) y (i :: k) x. Monad m => PQ j k m y -> PQ i j m x -> PQ i k m y Source # pqAndThen :: forall (m :: Type -> Type) y (j :: k) (k :: k) z x (i :: k). Monad m => (y -> PQ j k m z) -> (x -> PQ i j m y) -> x -> PQ i k m z Source # |
newtype Indexed t m r i j Source #
Indexed
reshuffles the type parameters of an IndexedMonadTrans
,
exposing its Category
instance.
Indexed | |
|
Instances
Migratory Definition (Indexed PQ IO ()) Source # | pure migrations |
Defined in Squeal.PostgreSQL.Session.Migration runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration Definition) db0 db1 -> Indexed PQ IO () db0 db1 Source # | |
Migratory (IsoQ Definition) (IsoQ (Indexed PQ IO ())) Source # | pure rewindable migrations |
Defined in Squeal.PostgreSQL.Session.Migration | |
Migratory (IsoQ (Indexed PQ IO ())) (IsoQ (Indexed PQ IO ())) Source # | impure rewindable migrations |
Migratory (OpQ Definition) (OpQ (Indexed PQ IO ())) Source # | pure rewinds |
Defined in Squeal.PostgreSQL.Session.Migration | |
Migratory (OpQ (Indexed PQ IO ())) (OpQ (Indexed PQ IO ())) Source # | impure rewinds |
(IndexedMonadTrans t, Monad m, Monoid r) => Category (Indexed t m r :: k -> k -> Type) Source # | |
Migratory (Indexed PQ IO ()) (Indexed PQ IO ()) Source # | impure migrations |
class IndexedMonadTrans pq => IndexedMonadTransPQ pq where Source #
IndexedMonadTransPQ
is a class for indexed monad transformers
that support running Definition
s using define
which acts functorially in effect.
define id = return ()
define (statement1 >>> statement2) = define statement1 & pqThen (define statement2)
define :: MonadIO io => Definition db0 db1 -> pq db0 db1 io () Source #
Instances
IndexedMonadTransPQ PQ Source # | |
Defined in Squeal.PostgreSQL.Session define :: forall (io :: Type -> Type) (db0 :: SchemasType) (db1 :: SchemasType). MonadIO io => Definition db0 db1 -> PQ db0 db1 io () Source # |
indexedDefine :: (IndexedMonadTransPQ pq, MonadIO io) => Definition db0 db1 -> Indexed pq io () db0 db1 Source #
Run a pure SQL Definition
functorially in effect
indexedDefine id = id
indexedDefine (def1 >>> def2) = indexedDefine def1 >>> indexedDefine def2