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

Portabilityunknown
Stabilityexperimental
Maintainerex8k.hibino@gmail.com
Safe HaskellNone

Database.Relational.Query.ProjectableExtended

Contents

Description

This module defines operators on various polymorphic projections which needs extended GHC features.

Synopsis

Projection for nested Maybes

class ProjectableFlattenMaybe a b whereSource

Interface to compose phantom Maybe nested type.

Methods

flatten :: ProjectableMaybe p => p a -> p bSource

Instances

ProjectableFlattenMaybe (Maybe a) b => ProjectableFlattenMaybe (Maybe (Maybe a)) b

Compose Maybe type in projection phantom type.

ProjectableFlattenMaybe (Maybe a) (Maybe a)

Not Maybe type is not processed.

flattenPiMaybeSource

Arguments

:: (ProjectableMaybe (Projection cont), ProjectableFlattenMaybe (Maybe b) c) 
=> Projection cont (Maybe a)

Source Projection. Maybe phantom type

-> Pi a b

Projection path

-> Projection cont c

Narrower Projection. Flatten Maybe phantom type

Get narrower projection with flatten leaf phantom Maybe types along with projection path.

Get narrower projections

(!)Source

Arguments

:: Projectable Projection p 
=> Projection c a

Source projection

-> Pi a b

Projection path

-> p c b

Narrower projected object

Get narrower projection along with projection path and project into result projection type.

(?!)Source

Arguments

:: Projectable Projection p 
=> Projection c (Maybe a)

Source Projection. Maybe type

-> Pi a b

Projection path

-> p c (Maybe b)

Narrower projected object. Maybe type result

Get narrower projection along with projection path and project into result projection type. Maybe phantom functor is map-ed.

(?!?)Source

Arguments

:: Projectable Projection p 
=> Projection c (Maybe a)

Source Projection. Maybe phantom type

-> Pi a (Maybe b)

Projection path. Maybe type leaf

-> p c (Maybe b)

Narrower projected object. Maybe phantom type result

Get narrower projection along with projection path and project into result projection type. Source record Maybe phantom functor and projection path leaf Maybe functor are join-ed.

(!??)Source

Arguments

:: (ProjectableFlattenMaybe (Maybe b) c, Projectable Projection p, ProjectableMaybe (p cont)) 
=> Projection cont (Maybe a)

Source Projection. Maybe phantom type

-> Pi a b

Projection path

-> p cont c

Narrower flatten and projected object.

Get narrower projection with flatten leaf phantom Maybe types along with projection path and project into result projection type.

(.!)Source

Arguments

:: Projection c (Maybe a)

Source projection type p. Maybe phantom type

-> Pi a b

Projection path

-> Expr c b

Narrower projected expression. Maybe phantom type is stripped off

Get narrower projected expression along with projectino path and strip Maybe phantom type off.

(.?)Source

Arguments

:: Projection c (Maybe a)

Source projection type p. Maybe phantom type

-> Pi a (Maybe b)

Projection path. Maybe type leaf

-> Expr c b

Narrower projected expression. Maybe phantom type is stripped off

Get narrower projected expression along with projectino path and strip Maybe phantom type off. Projection path leaf is Maybe case.

Aggregate functions

unsafeAggregateOp :: (AggregatedContext ac, SqlProjectable (p ac)) => Keyword -> Projection Flat a -> p ac bSource

Unsafely make aggregation uni-operator from SQL keyword.

count :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac Int64Source

Aggregation function COUNT.

sum' :: (Num a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe a)Source

Aggregation function SUM.

sumMaybe :: (Num a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe a)Source

Aggregation function SUM.

avg :: (Num a, Fractional b, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe b)Source

Aggregation function AVG.

avgMaybe :: (Num a, Fractional b, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe b)Source

Aggregation function AVG.

max' :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe a)Source

Aggregation function MAX.

maxMaybe :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe a)Source

Aggregation function MAX.

min' :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe a)Source

Aggregation function MIN.

minMaybe :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe a)Source

Aggregation function MIN.

every :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe Bool) -> p ac (Maybe Bool)Source

Aggregation function EVERY.

any' :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe Bool) -> p ac (Maybe Bool)Source

Aggregation function ANY.

some' :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe Bool) -> p ac (Maybe Bool)Source

Aggregation function SOME.

Zipping projection type trick

class ProjectableApplicative p => ProjectableIdZip p whereSource

Zipping except for identity element laws.

Methods

leftId :: p ((), a) -> p aSource

rightId :: p (a, ()) -> p aSource

Instances

ProjectableIdZip PlaceHolders

Zipping except for identity element laws against placeholder parameter type.

class ProjectableRunIdsZip a b whereSource

Interface to run recursively identity element laws.

Methods

runIds :: ProjectableIdZip p => p a -> p bSource

Instances

ProjectableRunIdsZip a a

Base case definition to run recursively identity element laws.

ProjectableRunIdsZip a b => ProjectableRunIdsZip ((), a) b

Run left identity element law.

ProjectableRunIdsZip a b => ProjectableRunIdsZip (a, ()) b

Run right identity element law.