squeal-postgresql-0.8.0.0: Squeal PostgreSQL Library
Copyright(c) Eitan Chatav 2019
Maintainereitan@morphism.tech
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Squeal.PostgreSQL.Session.Indexed

Description

Indexed provides an indexed monad transformer class and a class extending it to run Definitions.

Synopsis

Documentation

class (forall i j m. Monad m => Functor (t i j m), forall i j m. (i ~ j, Monad m) => Monad (t i j m), forall i j. i ~ j => MonadTrans (t i j)) => 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.

Minimal complete definition

pqJoin | pqBind

Methods

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

Instances details
IndexedMonadTrans PQ Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

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.

Constructors

Indexed 

Fields

Instances

Instances details
Migratory Definition (Indexed PQ IO ()) Source #

pure migrations

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

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

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (IsoQ Definition)) db0 db1 -> IsoQ (Indexed PQ IO ()) db0 db1 Source #

Migratory (IsoQ (Indexed PQ IO ())) (IsoQ (Indexed PQ IO ())) Source #

impure rewindable migrations

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (IsoQ (Indexed PQ IO ()))) db0 db1 -> IsoQ (Indexed PQ IO ()) db0 db1 Source #

Migratory (OpQ Definition) (OpQ (Indexed PQ IO ())) Source #

pure rewinds

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (OpQ Definition)) db0 db1 -> OpQ (Indexed PQ IO ()) db0 db1 Source #

Migratory (OpQ (Indexed PQ IO ())) (OpQ (Indexed PQ IO ())) Source #

impure rewinds

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (OpQ (Indexed PQ IO ()))) db0 db1 -> OpQ (Indexed PQ IO ()) db0 db1 Source #

(IndexedMonadTrans t, Monad m, Monoid r) => Category (Indexed t m r :: k -> k -> Type) Source # 
Instance details

Defined in Squeal.PostgreSQL.Session.Indexed

Methods

id :: forall (a :: k0). Indexed t m r a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). Indexed t m r b c -> Indexed t m r a b -> Indexed t m r a c #

Migratory (Indexed PQ IO ()) (Indexed PQ IO ()) Source #

impure migrations

Instance details

Defined in Squeal.PostgreSQL.Session.Migration

Methods

runMigrations :: forall (db0 :: k) (db1 :: k). Path (Migration (Indexed PQ IO ())) db0 db1 -> Indexed PQ IO () db0 db1 Source #

class IndexedMonadTrans pq => IndexedMonadTransPQ pq where Source #

IndexedMonadTransPQ is a class for indexed monad transformers that support running Definitions using define which acts functorially in effect.

  • define id = return ()
  • define (statement1 >>> statement2) = define statement1 & pqThen (define statement2)

Methods

define :: MonadIO io => Definition db0 db1 -> pq db0 db1 io () Source #

Instances

Instances details
IndexedMonadTransPQ PQ Source # 
Instance details

Defined in Squeal.PostgreSQL.Session

Methods

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