persistable-record-0.4.1.0: Binding between SQL database values and haskell records.

Copyright2013 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe
LanguageHaskell2010

Database.Record.Persistable

Contents

Description

This module defines interfaces between Haskell type and list of SQL type.

Synopsis

Specify SQL type

data PersistableSqlType q Source #

Proof object to specify type q is SQL type

runPersistableNullValue :: PersistableSqlType q -> q Source #

Null value of SQL type q.

unsafePersistableSqlTypeFromNull Source #

Arguments

:: q

SQL null value of SQL type q

-> PersistableSqlType q

Result proof object

Unsafely generate PersistableSqlType proof object from specified SQL null value which type is q.

Specify record width

data PersistableRecordWidth a Source #

Proof object to specify width of Haskell type a when converting to SQL type list.

runPersistableRecordWidth :: PersistableRecordWidth a -> Int Source #

Get width Int value of record type a.

unsafePersistableRecordWidth Source #

Arguments

:: Int

Specify width of Haskell type a

-> PersistableRecordWidth a

Result proof object

Unsafely generate PersistableRecordWidth proof object from specified width of Haskell type a.

unsafeValueWidth :: PersistableRecordWidth a Source #

Unsafely generate PersistableRecordWidth proof object for Haskell type a which is single column type.

maybeWidth :: PersistableRecordWidth a -> PersistableRecordWidth (Maybe a) Source #

Derivation rule of PersistableRecordWidth from from Haskell type a into for Haskell type Maybe a.

Inference rules for proof objects

class Eq q => PersistableType q where Source #

Interface of inference rule for PersistableSqlType proof object

Minimal complete definition

persistableType

sqlNullValue :: PersistableType q => q Source #

Inferred Null value of SQL type.

class PersistableWidth a where Source #

Interface of inference rule for PersistableRecordWidth proof object

Minimal complete definition

persistableWidth

Instances

PersistableWidth () Source #

Inference rule of PersistableRecordWidth for Haskell unit () type. Derive from axiom.

PersistableWidth a => PersistableWidth (Maybe a) Source #

Inference rule of PersistableRecordWidth proof object for Maybe type.

(PersistableWidth a, PersistableWidth b) => PersistableWidth (a, b) Source #

Inference rule of PersistableRecordWidth proof object for tuple (a, b) type.

derivedWidth :: PersistableWidth a => (PersistableRecordWidth a, Int) Source #

Pass type parameter and inferred width value.