sqel-0.0.1.0: Guided derivation for Hasql statements
Safe HaskellSafe-Inferred
LanguageHaskell2010

Sqel.Comp

Documentation

class CompName a sel | a -> sel where Source #

Methods

compName :: TSelW sel Source #

Instances

Instances details
(name ~ CompNameData a (GDatatypeInfoOf a), sel ~ 'TSel 'DefaultPrefix name, MkTSel sel) => CompName a sel Source # 
Instance details

Defined in Sqel.Comp

Methods

compName :: TSelW sel Source #

CompName a sel => CompName (Uid i a) sel Source # 
Instance details

Defined in Sqel.Comp

Methods

compName :: TSelW sel Source #

type family CompNameData a info where ... Source #

Equations

CompNameData _ ('ADT _ name _ _) = name 
CompNameData a _ = TypeError (("The type " <> a) <> " is not an ADT.") 

type family RecordFields (fields :: [FieldInfo]) (ass :: [Type]) :: [ProductField] where ... Source #

Equations

RecordFields '[] '[] = '[] 
RecordFields ('FieldInfo name ': fields) (a ': as) = 'ProductField name a ': RecordFields fields as 

type family ConstructorFields (name :: Symbol) (index :: Nat) (ass :: [Type]) :: [ProductField] where ... Source #

Equations

ConstructorFields _ _ '[] = '[] 
ConstructorFields name n (a ': as) = 'ProductField (AppendSymbol name (NatSymbol n)) a ': ConstructorFields name (n + 1) as 

type family ProductFields (info :: DatatypeInfo) (ass :: [[Type]]) :: [ProductField] where ... Source #

Equations

ProductFields ('ADT _ _ '['Record _ fields] _) '[ass] = RecordFields fields ass 

class Column a fieldName s0 s | a fieldName s0 -> s where Source #

Methods

compItem :: Dd s0 -> Dd s Source #

Instances

Instances details
a ~ b => Column a fname ('DdK ('SelSymbol name) mods b ('Comp tsel c 'Nest s)) ('DdK ('SelSymbol name) mods a ('Comp tsel c 'Nest s)) Source # 
Instance details

Defined in Sqel.Comp

Methods

compItem :: Dd ('DdK ('SelSymbol name) mods b ('Comp tsel c 'Nest s)) -> Dd ('DdK ('SelSymbol name) mods a ('Comp tsel c 'Nest s)) Source #

a ~ b => Column a fname ('DdK ('SelSymbol name) mods b 'Prim) ('DdK ('SelSymbol name) mods a 'Prim) Source # 
Instance details

Defined in Sqel.Comp

Methods

compItem :: Dd ('DdK ('SelSymbol name) mods b 'Prim) -> Dd ('DdK ('SelSymbol name) mods a 'Prim) Source #

a ~ b => Column a name ('DdK 'SelAuto mods b ('Comp tsel c 'Merge s)) ('DdK 'SelAuto mods a ('Comp tsel c 'Merge s)) Source # 
Instance details

Defined in Sqel.Comp

Methods

compItem :: Dd ('DdK 'SelAuto mods b ('Comp tsel c 'Merge s)) -> Dd ('DdK 'SelAuto mods a ('Comp tsel c 'Merge s)) Source #

(a ~ b, KnownSymbol name) => Column a name ('DdK 'SelAuto mods b ('Comp tsel c 'Nest s)) ('DdK ('SelSymbol name) mods a ('Comp tsel c 'Nest s)) Source # 
Instance details

Defined in Sqel.Comp

Methods

compItem :: Dd ('DdK 'SelAuto mods b ('Comp tsel c 'Nest s)) -> Dd ('DdK ('SelSymbol name) mods a ('Comp tsel c 'Nest s)) Source #

(a ~ b, KnownSymbol name) => Column a name ('DdK 'SelAuto mods b 'Prim) ('DdK ('SelSymbol name) mods a 'Prim) Source # 
Instance details

Defined in Sqel.Comp

Methods

compItem :: Dd ('DdK 'SelAuto mods b 'Prim) -> Dd ('DdK ('SelSymbol name) mods a 'Prim) Source #

a ~ b => Column a name ('DdK 'SelUnused mods b 'Prim) ('DdK 'SelUnused mods a 'Prim) Source # 
Instance details

Defined in Sqel.Comp

Methods

compItem :: Dd ('DdK 'SelUnused mods b 'Prim) -> Dd ('DdK 'SelUnused mods a 'Prim) Source #

data CompMeta Source #

Constructors

CompMeta 

Instances

Instances details
Generic CompMeta Source # 
Instance details

Defined in Sqel.Comp

Associated Types

type Rep CompMeta :: Type -> Type #

Methods

from :: CompMeta -> Rep CompMeta x #

to :: Rep CompMeta x -> CompMeta #

type Rep CompMeta Source # 
Instance details

Defined in Sqel.Comp

type InvalidElem name i arg = DelayError ((((((("Element number " <> i) <> " in the call to ") <> Quoted name) <> " has type ") <> QuotedType arg) <> ".") % ((((("Columns should only be constructed with combinators like " <> Quoted "prim") <> ", ") <> Quoted "prod") <> ",") % ((((Quoted "column" <> " that return the proper type, ") <> Quoted "Dd") <> ".") % (("Consult the module " <> Quoted "Sqel.Combinators") <> " for the full API.")))) Source #

class CompItemOrError err field arg s | field arg -> s where Source #

Methods

compItemOrError :: Proxy err -> arg -> Dd s Source #

Instances

Instances details
Column a fieldName s0 s1 => CompItemOrError err ('ProductField fieldName a) (Dd s0) s1 Source # 
Instance details

Defined in Sqel.Comp

Methods

compItemOrError :: Proxy err -> Dd s0 -> Dd s1 Source #

class CheckCompItem meta field arg s | field arg -> s where Source #

Methods

checkCompItem :: arg -> Dd s Source #

Instances

Instances details
(meta ~ 'CompMeta desc name combinator index, error ~ InvalidElem combinator index arg, CompItemOrError error field arg s1) => CheckCompItem meta field arg s1 Source # 
Instance details

Defined in Sqel.Comp

Methods

checkCompItem :: arg -> Dd s1 Source #

type family MetaNext (meta :: CompMeta) :: CompMeta where ... Source #

Equations

MetaNext ('CompMeta desc name combinator index) = 'CompMeta desc name combinator (index + 1) 

type family MetaFor (desc :: Symbol) (name :: ErrorMessage) (combinator :: Symbol) :: CompMeta where ... Source #

Equations

MetaFor desc name combinator = 'CompMeta desc name combinator 1 

data SpecType Source #

Constructors

SpecNP 
SpecDsl 
SpecPrims 

Instances

Instances details
(a ~ b, CompColumn' meta ('Right 'SpecNP :: Either Void SpecType) fields a (NP Dd s0) s1) => CompColumn' meta ('Right 'SpecPrims :: Either Void SpecType) fields a (Prims b s0) s1 Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: Prims b s0 -> NP Dd s1 Source #

CompColumn' meta ('Right 'SpecNP :: Either Void SpecType) ('[] :: [ProductField]) a (NP f ('[] :: [k])) ('[] :: [DdK]) Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: NP f '[] -> NP Dd '[] Source #

CheckCompItem meta field arg s => CompColumn' meta ('Right 'SpecDsl :: Either Void SpecType) '[field] a arg '[s] Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: arg -> NP Dd '[s] Source #

(CheckCompItem meta field arg0 s0, CompColumn' (MetaNext meta) ('Right 'SpecDsl :: Either Void SpecType) fields a args s1) => CompColumn' meta ('Right 'SpecDsl :: Either Void SpecType) (field ': fields) a (arg0 :> args) (s0 ': s1) Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: (arg0 :> args) -> NP Dd (s0 ': s1) Source #

(CheckCompItem meta field (f arg0) s0, CompColumn' (MetaNext meta) ('Right 'SpecNP :: Either Void SpecType) fields a2 (NP f args) s1) => CompColumn' meta ('Right 'SpecNP :: Either Void SpecType) (field ': fields) a2 (NP f (arg0 ': args)) (s0 ': s1) Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: NP f (arg0 ': args) -> NP Dd (s0 ': s1) Source #

type family CheckFields (meta :: CompMeta) (len :: Nat) (fieldLen :: Nat) (t :: SpecType) :: Either Void SpecType where ... Source #

Equations

CheckFields _ n n t = 'Right t 
CheckFields ('CompMeta desc name _ _) arg f _ = 'Left (DelayError (CountMismatch desc name arg f)) 

type family DslSize (arg :: Type) :: Nat where ... Source #

Equations

DslSize (_ :> as) = 1 + DslSize as 
DslSize _ = 1 

type family TriageComp (meta :: CompMeta) (arg :: Type) (fields :: [ProductField]) :: Either Void SpecType where ... Source #

Equations

TriageComp _ (Prims _ _) _ = 'Right 'SpecPrims 
TriageComp meta (NP _ s) fs = CheckFields meta (Length @@ s) (Length @@ fs) 'SpecNP 
TriageComp meta args fs = CheckFields meta (DslSize args) (Length @@ fs) 'SpecDsl 

class CompColumn' meta spec fields a arg s | fields arg -> s where Source #

Methods

compColumn' :: arg -> NP Dd s Source #

Instances

Instances details
(a ~ b, CompColumn' meta ('Right 'SpecNP :: Either Void SpecType) fields a (NP Dd s0) s1) => CompColumn' meta ('Right 'SpecPrims :: Either Void SpecType) fields a (Prims b s0) s1 Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: Prims b s0 -> NP Dd s1 Source #

CompColumn' meta ('Right 'SpecNP :: Either Void SpecType) ('[] :: [ProductField]) a (NP f ('[] :: [k])) ('[] :: [DdK]) Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: NP f '[] -> NP Dd '[] Source #

CheckCompItem meta field arg s => CompColumn' meta ('Right 'SpecDsl :: Either Void SpecType) '[field] a arg '[s] Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: arg -> NP Dd '[s] Source #

(CheckCompItem meta field arg0 s0, CompColumn' (MetaNext meta) ('Right 'SpecDsl :: Either Void SpecType) fields a args s1) => CompColumn' meta ('Right 'SpecDsl :: Either Void SpecType) (field ': fields) a (arg0 :> args) (s0 ': s1) Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: (arg0 :> args) -> NP Dd (s0 ': s1) Source #

(CheckCompItem meta field (f arg0) s0, CompColumn' (MetaNext meta) ('Right 'SpecNP :: Either Void SpecType) fields a2 (NP f args) s1) => CompColumn' meta ('Right 'SpecNP :: Either Void SpecType) (field ': fields) a2 (NP f (arg0 ': args)) (s0 ': s1) Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn' :: NP f (arg0 ': args) -> NP Dd (s0 ': s1) Source #

class CompColumn meta fields a arg s | fields arg -> s where Source #

Methods

compColumn :: arg -> NP Dd s Source #

Instances

Instances details
(spec ~ TriageComp meta arg fields, CompColumn' meta spec fields a arg s) => CompColumn meta fields a arg s Source # 
Instance details

Defined in Sqel.Comp

Methods

compColumn :: arg -> NP Dd s Source #

class SetTypePrefix prefix s0 s1 | prefix s0 -> s1 where Source #

Methods

setTypePrefix :: Dd s0 -> Dd s1 Source #

Instances

Instances details
TypeName ('SelPrefix prefix) tpe tname => SetTypePrefix prefix ('DdK sel mods a ('Comp ('TSel oldPrefix tpe) c i s)) ('DdK sel mods a ('Comp ('TSel ('SelPrefix prefix) tpe) c i s)) Source # 
Instance details

Defined in Sqel.Comp

Methods

setTypePrefix :: Dd ('DdK sel mods a ('Comp ('TSel oldPrefix tpe) c i s)) -> Dd ('DdK sel mods a ('Comp ('TSel ('SelPrefix prefix) tpe) c i s)) Source #

typePrefix :: forall prefix s0 s1. SetTypePrefix prefix s0 s1 => Dd s0 -> Dd s1 Source #