mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-01 13:52:12 +03:00
Drop derivation rule of PersistableValues.
This commit is contained in:
parent
c087426cf3
commit
ff9ea16814
@ -2,7 +2,6 @@
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- |
|
||||
@ -15,29 +14,15 @@
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- This module provides HDBC instance definitions of DB-record.
|
||||
module Database.HDBC.Record.Persistable (
|
||||
persistableSqlValue
|
||||
) where
|
||||
module Database.HDBC.Record.Persistable () where
|
||||
|
||||
import Database.Record (PersistableSqlValue, PersistableType (..), PersistableValue (..))
|
||||
import Database.Record (PersistableType (..))
|
||||
import Database.Record.Persistable (unsafePersistableSqlTypeFromNull)
|
||||
import qualified Database.Record.Persistable as Record
|
||||
import Database.HDBC.Record.InternalTH (derivePersistableInstancesFromConvertibleSqlValues)
|
||||
|
||||
import Data.Convertible (Convertible)
|
||||
import Database.HDBC (SqlValue(SqlNull), fromSql, toSql)
|
||||
import Database.HDBC (SqlValue(SqlNull))
|
||||
|
||||
instance PersistableType SqlValue where
|
||||
persistableType = unsafePersistableSqlTypeFromNull SqlNull
|
||||
|
||||
-- | Derived 'PersistableSqlValue' from 'Convertible'.
|
||||
persistableSqlValue :: (Convertible SqlValue a, Convertible a SqlValue)
|
||||
=> PersistableSqlValue SqlValue a
|
||||
persistableSqlValue = Record.persistableSqlValue persistableType fromSql toSql
|
||||
|
||||
-- | Infered 'PersistableSqlValue' from 'Convertible'.
|
||||
instance (Convertible SqlValue a, Convertible a SqlValue)
|
||||
=> PersistableValue SqlValue a where
|
||||
persistableValue = persistableSqlValue
|
||||
|
||||
$(derivePersistableInstancesFromConvertibleSqlValues)
|
||||
|
Loading…
Reference in New Issue
Block a user