relational-query- Typeful, Modular, Relational, algebraic query engine

Copyright2015 Kei Hibino
Safe HaskellNone




This module defines base monad type to build queries.


Base monad type to build queries

type ConfigureQuery = Qualify (QueryConfig Identity) Source

Thin monad type for untyped structure.

configureQuery :: ConfigureQuery q -> Config -> q Source

Run ConfigureQuery monad with initial state to get only result.

qualifyQuery :: a -> ConfigureQuery (Qualified a) Source

Get qualifyed table form query.

askConfig :: ConfigureQuery Config Source

Read configuration.

Relation type

data Relation p r Source

Relation type with place-holder parameter p and query result type r.


unsafeTypeRelation :: ConfigureQuery SubQuery -> Relation p r Source

Unsafely type qualified subquery into record typed relation type.

untypeRelation :: Relation p r -> ConfigureQuery SubQuery Source

Sub-query Qualify monad from relation.

dump :: Relation p r -> String Source

Dump internal structure tree.

sqlFromRelationWith :: Relation p r -> Config -> StringSQL Source

Generate SQL string from Relation with configuration.

sqlFromRelation :: Relation p r -> StringSQL Source

SQL string from Relation.

rightPh :: Relation ((), p) r -> Relation p r Source

Simplify placeholder type applying left identity element.

leftPh :: Relation (p, ()) r -> Relation p r Source

Simplify placeholder type applying right identity element.