pg-store-0.4.1: Simple storage interface to PostgreSQL

Copyright(c) Ole Krüger 2016
LicenseBSD3
MaintainerOle Krüger <ole@vprsm.de>
Safe HaskellSafe
LanguageHaskell2010

Database.PostgreSQL.Store.Tuple

Description

 

Synopsis

Documentation

data Tuple ts where Source #

Generic product type

Constructors

Empty :: Tuple '[] 
Cons :: t -> !(Tuple ts) -> Tuple (t ': ts) 

Instances

ShowElement ts => Show (Tuple ts) Source # 

Methods

showsPrec :: Int -> Tuple ts -> ShowS #

show :: Tuple ts -> String #

showList :: [Tuple ts] -> ShowS #

appendElement :: AppendElement ts => Tuple ts -> t -> Tuple (ts |> t) Source #

class HasElement n ts r | n ts -> r where Source #

Helper class to extract an element from a Tuple.

Minimal complete definition

getElementN

Methods

getElementN :: Tuple ts -> Tagged n r Source #

Extract the n-th element from the product.

Instances

((<=) 1 n, HasElement ((-) n 1) ts r) => HasElement n ((:) Type t ts) r Source #

Extract element that is not the head

Methods

getElementN :: Tuple ((Type ': t) ts) -> Tagged Nat n r Source #

HasElement 0 ((:) Type t ts) t Source #

Extract head element

Methods

getElementN :: Tuple ((Type ': t) ts) -> Tagged Nat 0 t Source #

getElementN :: HasElement n ts r => Tuple ts -> Tagged n r Source #

Extract the n-th element from the product.

getElement0 :: Tuple (r ': ts) -> r Source #

Extract element at index 0.

getElement1 :: Tuple (t0 ': (r ': ts)) -> r Source #

Extract element at index 1.

getElement2 :: Tuple (t0 ': (t1 ': (r ': ts))) -> r Source #

Extract element at index 2.

getElement3 :: Tuple (t0 ': (t1 ': (t2 ': (r ': ts)))) -> r Source #

Extract element at index 3.

getElement4 :: Tuple (t0 ': (t1 ': (t2 ': (t3 ': (r ': ts))))) -> r Source #

Extract element at index 4.

getElement5 :: Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (r ': ts)))))) -> r Source #

Extract element at index 5.

getElement6 :: Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (r ': ts))))))) -> r Source #

Extract element at index 6.

getElement7 :: Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (r ': ts)))))))) -> r Source #

Extract element at index 7.

getElement8 :: Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (t7 ': (r ': ts))))))))) -> r Source #

Extract element at index 8.

getElement9 :: Tuple (t0 ': (t1 ': (t2 ': (t3 ': (t4 ': (t5 ': (t6 ': (t7 ': (t8 ': (r ': ts)))))))))) -> r Source #

Extract element at index 9.

type family FunctionType (ps :: [Type]) r where ... Source #

Build a function type using the given parameter types and return type.

Equations

FunctionType '[] r = r 
FunctionType (p ': ps) r = p -> FunctionType ps r 

type WithTuple ts r = ConsTuple '[] (Tuple ts -> r) (FunctionType ts r) Source #

A value of type r can be created using an instance of Tuple ts.

withTuple :: WithTuple ts r => (Tuple ts -> r) -> FunctionType ts r Source #

Collect values to construct a Tuple ts, then apply the given function to it.