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

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

Database.Relational.Query.ProjectableClass

Contents

Description

This module provides interfaces to preserve constraints of direct product projections.

Synopsis

Interface to specify record constructors.

class ProductConstructor r where Source #

Specify tuple like record constructors which are allowed to define ProjectableFunctor.

Minimal complete definition

productConstructor

Methods

productConstructor :: r Source #

The constructor which has type r.

ProjectableFunctor and ProjectableApplicative

class ProjectableFunctor p where Source #

Weaken functor on projections.

Minimal complete definition

(|$|)

Methods

(|$|) :: ProductConstructor (a -> b) => (a -> b) -> p a -> p b infixl 4 Source #

Method like fmap.

Instances

ProjectableFunctor PlaceHolders Source #

Compose seed of record type PlaceHolders.

Methods

(|$|) :: ProductConstructor (a -> b) => (a -> b) -> PlaceHolders a -> PlaceHolders b Source #

ProjectableFunctor (Pi a) Source #

Compose seed of projection path Pi which has record result type.

Methods

(|$|) :: ProductConstructor (a -> b) => (a -> b) -> Pi a a -> Pi a b Source #

class ProjectableFunctor p => ProjectableApplicative p where Source #

Weaken applicative functor on projections.

Minimal complete definition

(|*|)

Methods

(|*|) :: p (a -> b) -> p a -> p b infixl 4 Source #

Method like <*>.

Instances

ProjectableApplicative PlaceHolders Source #

Compose record type PlaceHolders using applicative style.

Methods

(|*|) :: PlaceHolders (a -> b) -> PlaceHolders a -> PlaceHolders b Source #

ProjectableApplicative (Pi a) Source #

Compose projection path Pi which has record result type using applicative style.

Methods

(|*|) :: Pi a (a -> b) -> Pi a a -> Pi a b Source #

ipfmap :: (ProjectableFunctor p, ProductConstructor (a -> b)) => p a -> p b Source #

Same as |$| other than using inferred record constructor.

Literal SQL terms

class ShowConstantTermsSQL a where Source #

ShowConstantTermsSQL a is implicit rule to derive function to convert from haskell record type a into constant SQL terms.

Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming) with default signature is available for ShowConstantTermsSQL class, so you can make instance like below:

  {-# LANGUAGE DeriveGeneric #-}
  import GHC.Generics (Generic)
  --
  data Foo = Foo { ... } deriving Generic
  instance ShowConstantTermsSQL Foo

Methods

showConstantTermsSQL' :: a -> DList StringSQL Source #

showConstantTermsSQL' :: (Generic a, GShowConstantTermsSQL (Rep a)) => a -> DList StringSQL Source #

type StringSQL = Keyword Source #

String wrap type for SQL strings.