Copyright | 2013-2017 Kei Hibino |
---|---|

License | BSD3 |

Maintainer | ex8k.hibino@gmail.com |

Stability | experimental |

Portability | unknown |

Safe Haskell | None |

Language | Haskell2010 |

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

- class ProjectableFlattenMaybe a b where
- flattenPiMaybe :: (PersistableWidth a, ProjectableMaybe (Projection cont), ProjectableFlattenMaybe (Maybe b) c) => Projection cont (Maybe a) -> Pi a b -> Projection cont c
- (!) :: PersistableWidth a => Projection c a -> Pi a b -> Projection c b
- (?!) :: PersistableWidth a => Projection c (Maybe a) -> Pi a b -> Projection c (Maybe b)
- (?!?) :: PersistableWidth a => Projection c (Maybe a) -> Pi a (Maybe b) -> Projection c (Maybe b)
- (!??) :: (PersistableWidth a, ProjectableMaybe (Projection cont), ProjectableFlattenMaybe (Maybe b) c) => Projection cont (Maybe a) -> Pi a b -> Projection cont c
- unsafeAggregateOp :: (AggregatedContext ac, SqlProjectable (p ac)) => Keyword -> Projection Flat a -> p ac b
- count :: (Integral b, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac b
- sum' :: (Num a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe a)
- sumMaybe :: (Num a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe a)
- avg :: (Num a, Fractional b, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe b)
- avgMaybe :: (Num a, Fractional b, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe b)
- max' :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe a)
- maxMaybe :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe a)
- min' :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat a -> p ac (Maybe a)
- minMaybe :: (Ord a, AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe a) -> p ac (Maybe a)
- every :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe Bool) -> p ac (Maybe Bool)
- any' :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe Bool) -> p ac (Maybe Bool)
- some' :: (AggregatedContext ac, SqlProjectable (p ac)) => Projection Flat (Maybe Bool) -> p ac (Maybe Bool)
- class ProjectableApplicative p => ProjectableIdZip p where
- class ProjectableRunIdsZip a b where
- flattenPh :: ProjectableRunIdsZip a b => PlaceHolders a -> PlaceHolders b

# Projection for nested `Maybe`

s

class ProjectableFlattenMaybe a b where Source #

Interface to compose phantom `Maybe`

nested type.

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

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

ProjectableFlattenMaybe (Maybe a) (Maybe a) Source # | Not |

:: (PersistableWidth a, ProjectableMaybe (Projection cont), ProjectableFlattenMaybe (Maybe b) c) | |

=> Projection cont (Maybe a) | Source |

-> Pi a b | Projection path |

-> Projection cont c | Narrower |

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

# Get narrower projections

:: PersistableWidth a | |

=> Projection c a | Source projection |

-> Pi a b | Projection path |

-> Projection c b | Narrower projected object |

Get narrower projection along with projection path.

:: PersistableWidth a | |

=> Projection c (Maybe a) | Source |

-> Pi a b | Projection path |

-> Projection c (Maybe b) | Narrower projected object. |

:: PersistableWidth a | |

=> Projection c (Maybe a) | Source |

-> Pi a (Maybe b) | Projection path. |

-> Projection c (Maybe b) | Narrower projected object. |

:: (PersistableWidth a, ProjectableMaybe (Projection cont), ProjectableFlattenMaybe (Maybe b) c) | |

=> Projection cont (Maybe a) | Source |

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

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.

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

ProjectableRunIdsZip a a Source # | Base case definition to run recursively identity element laws. |

ProjectableRunIdsZip a b => ProjectableRunIdsZip ((), a) b Source # | Run left identity element law. |

ProjectableRunIdsZip a b => ProjectableRunIdsZip (a, ()) b Source # | Run right identity element law. |

flattenPh :: ProjectableRunIdsZip a b => PlaceHolders a -> PlaceHolders b Source #

Specialize `runIds`

for `PlaceHolders`

type.