mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-29 14:45:51 +03:00
Simplify dependencies.
This commit is contained in:
parent
23d0eb840c
commit
011e77875a
@ -18,21 +18,16 @@ module Database.HDBC.Record.TH (
|
||||
import Language.Haskell.TH (Q, Dec, Type)
|
||||
import Database.HDBC (SqlValue)
|
||||
import Database.HDBC.SqlValueExtra ()
|
||||
import Database.Record
|
||||
(Persistable(persistable), derivedPersistableValueRecord,
|
||||
FromSql(recordFromSql), recordFromSql', ToSql(recordToSql), recordToSql')
|
||||
import Database.Record (FromSql(..), valueFromSql, ToSql(..), valueToSql)
|
||||
|
||||
|
||||
-- | Template to declare HDBC instances of DB-record against single value type.
|
||||
derivePersistableInstanceFromValue :: Q Type -- ^ Type to implement instances
|
||||
-> Q [Dec] -- ^ Result declarations
|
||||
derivePersistableInstanceFromValue typ =
|
||||
[d| instance Persistable SqlValue $(typ) where
|
||||
persistable = derivedPersistableValueRecord
|
||||
|
||||
instance FromSql SqlValue $(typ) where
|
||||
recordFromSql = recordFromSql'
|
||||
[d| instance FromSql SqlValue $(typ) where
|
||||
recordFromSql = valueFromSql
|
||||
|
||||
instance ToSql SqlValue $(typ) where
|
||||
recordToSql = recordToSql'
|
||||
recordToSql = valueToSql
|
||||
|]
|
||||
|
Loading…
Reference in New Issue
Block a user