| 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 Source #
Specify tuple like record constructors which are allowed to define ProjectableFunctor.
Minimal complete definition
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 |
| ProjectableFunctor (Pi a) Source # | Compose seed of projection path |
class ProjectableFunctor p => ProjectableApplicative p where Source #
Weaken applicative functor on projections.
Minimal complete definition
Instances
| ProjectableApplicative PlaceHolders Source # | Compose record type |
| ProjectableApplicative (Pi a) Source # | Compose projection path |
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
showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL] Source #
Convert from haskell record to SQL terms list.