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

Copyright2013 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

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 where Source #

Interface to compose phantom Maybe nested type.

Minimal complete definition

flatten

Methods

flatten :: ProjectableMaybe p => p a -> p b Source #

Instances

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

Compose Maybe type in projection phantom type.

Methods

flatten :: ProjectableMaybe p => p (Maybe (Maybe a)) -> p b Source #

ProjectableFlattenMaybe (Maybe a) (Maybe a) Source #

Not Maybe type is not processed.

Methods

flatten :: ProjectableMaybe p => p (Maybe a) -> p (Maybe a) Source #

flattenPiMaybe Source #

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

(!) infixl 8 Source #

Arguments

:: Projection c a

Source projection

-> Pi a b

Projection path

-> Projection c b

Narrower projected object

Get narrower projection along with projection path.

(?!) infixl 8 Source #

Arguments

:: Projection c (Maybe a)

Source Projection. Maybe type

-> Pi a b

Projection path

-> Projection c (Maybe b)

Narrower projected object. Maybe type result

Get narrower projection along with projection path Maybe phantom functor is map-ed.

(?!?) infixl 8 Source #

Arguments

:: Projection c (Maybe a)

Source Projection. Maybe phantom type

-> Pi a (Maybe b)

Projection path. Maybe type leaf

-> Projection 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.

(!??) infixl 8 Source #

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 flatten and projected object.

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

Aggregate functions

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

Unsafely make aggregation uni-operator from SQL keyword.

count :: (Integral b, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac b Source #

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 where Source #

Zipping except for identity element laws.

Minimal complete definition

leftId, rightId

Methods

leftId :: p ((), a) -> p a Source #

rightId :: p (a, ()) -> p a Source #

Instances

ProjectableIdZip PlaceHolders Source #

Zipping except for identity element laws against placeholder parameter type.

class ProjectableRunIdsZip a b where Source #

Interface to run recursively identity element laws.

Minimal complete definition

runIds

Methods

runIds :: ProjectableIdZip p => p a -> p b Source #

Instances

ProjectableRunIdsZip a a Source #

Base case definition to run recursively identity element laws.

Methods

runIds :: ProjectableIdZip p => p a -> p a Source #

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

Run left identity element law.

Methods

runIds :: ProjectableIdZip p => p ((), a) -> p b Source #

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

Run right identity element law.

Methods

runIds :: ProjectableIdZip p => p (a, ()) -> p b Source #