| Copyright | 2017 Kei Hibino |
|---|---|
| License | BSD3 |
| Maintainer | ex8k.hibino@gmail.com |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Database.Relational.Query.ProjectableClass
Contents
Description
This module provides interfaces to preserve constraints of direct product projections.
- class ProductConstructor r where
- class ProjectableFunctor p where
- class ProjectableFunctor p => ProjectableApplicative p where
- ipfmap :: (ProjectableFunctor p, ProductConstructor (a -> b)) => p a -> p b
- class ShowConstantTermsSQL a where
- showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL]
- type StringSQL = Keyword
Interface to specify record constructors.
class ProductConstructor r where #
Specify tuple like record constructors which are allowed to define ProjectableFunctor.
Minimal complete definition
ProjectableFunctor and ProjectableApplicative
class ProjectableFunctor p where #
Weaken functor on projections.
Minimal complete definition
Instances
| ProjectableFunctor PlaceHolders # | Compose seed of record type |
| ProjectableFunctor (Pi a) # | Compose seed of projection path |
class ProjectableFunctor p => ProjectableApplicative p where #
Weaken applicative functor on projections.
Minimal complete definition
Instances
| ProjectableApplicative PlaceHolders # | Compose record type |
| ProjectableApplicative (Pi a) # | Compose projection path |
ipfmap :: (ProjectableFunctor p, ProductConstructor (a -> b)) => p a -> p b #
Same as |$| other than using inferred record constructor.
Literal SQL terms
class ShowConstantTermsSQL a where #
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 #
showConstantTermsSQL' :: (Generic a, GShowConstantTermsSQL (Rep a)) => a -> DList StringSQL #
showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL] #
Convert from haskell record to SQL terms list.