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

Copyright2013-2017 Kei Hibino
Safe HaskellNone




This module provides proof object definitions of constraint key. Difference between this module and Database.Record.KeyConstraint is typed constraint key column definition is included in this module.


Constraint Key proof object

data Key c r ct Source #

Constraint Key proof object. Constraint type c, record type r and columns type ct.

indexes :: Key c r ct -> [Int] Source #

Index of key which specifies constraint key.

unsafeDefineConstraintKey Source #


:: PersistableWidth ct 
=> [Int]

Key indexes which specify this constraint key

-> Key c r ct

Result constraint key proof object

Unsafely generate constraint Key proof object using specified key index.

tableConstraint :: Key c r ct -> KeyConstraint c r Source #

Get table constraint KeyConstraint proof object from constraint Key.

projectionKey :: Key c r ct -> Pi r ct Source #

Get projection path proof object from constraint Key.

Derivation rules

uniqueKey :: PersistableWidth ct => Key Primary r ct -> Key Unique r ct Source #

Derive Unique constraint Key from Primary constraint Key

Inference rules

class PersistableWidth ct => HasConstraintKey c r ct where Source #

Constraint Key inference interface.

Minimal complete definition



constraintKey :: Key c r ct Source #

Infer constraint key.

derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ct Source #

Infered Unique constraint Key. Record type r has unique key which type is ct derived from primay key.

Constraint types

data Primary :: * #

Constraint type. Primary key.

data Unique :: * #

Constraint type. Unique key.

data NotNull :: * #

Constraint type. Not-null key.