Update definition order.

This commit is contained in:
Kei Hibino 2013-06-02 15:25:27 +09:00
parent 343d9720c3
commit af772cf52c

View File

@ -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 |]