diff --git a/DB-record/src/Database/Record/TH.hs b/DB-record/src/Database/Record/TH.hs index 3987cffc..2e2921c4 100644 --- a/DB-record/src/Database/Record/TH.hs +++ b/DB-record/src/Database/Record/TH.hs @@ -62,17 +62,17 @@ import Database.Record.Persistable import qualified Database.Record.Persistable as Persistable -defineHasKeyConstraintInstance :: TypeQ -> TypeQ -> Int -> Q [Dec] -defineHasKeyConstraintInstance constraint typeCon index = - [d| instance HasKeyConstraint $constraint $typeCon where - keyConstraint = specifyKeyConstraint $(integralE index) |] - recordTypeNameDefault :: String -> ConName recordTypeNameDefault = conCamelcaseName recordTypeDefault :: String -> TypeQ recordTypeDefault = toTypeCon . recordTypeNameDefault +defineHasKeyConstraintInstance :: TypeQ -> TypeQ -> Int -> Q [Dec] +defineHasKeyConstraintInstance constraint typeCon index = + [d| instance HasKeyConstraint $constraint $typeCon where + keyConstraint = specifyKeyConstraint $(integralE index) |] + defineHasNotNullKeyInstance :: TypeQ -> Int -> Q [Dec] defineHasNotNullKeyInstance = defineHasKeyConstraintInstance [t| NotNull |]