relational-query: simplified.

This commit is contained in:
Kei Hibino 2018-06-20 23:24:05 +09:00
parent a90d319eae
commit 6786d95ae8

View File

@ -112,12 +112,10 @@ defineHasConstraintKeyInstance :: TypeQ -- ^ Constraint type
-> TypeQ -- ^ Key type
-> [Int] -- ^ Indexes specifies key
-> Q [Dec] -- ^ Result 'HasConstraintKey' declaration
defineHasConstraintKeyInstance constraint recType colType indexes = do
-- kc <- defineHasColumnConstraintInstance constraint recType index
ck <- [d| instance HasConstraintKey $constraint $recType $colType where
constraintKey = unsafeDefineConstraintKey $(listE [integralE ix | ix <- indexes])
|]
return ck
defineHasConstraintKeyInstance constraint recType colType indexes =
[d| instance HasConstraintKey $constraint $recType $colType where
constraintKey = unsafeDefineConstraintKey $(listE [integralE ix | ix <- indexes])
|]
-- | Rule template to infer primary key.
defineHasPrimaryKeyInstance :: TypeQ -- ^ Record type