Drop derivation rule of PersistableValues.

This commit is contained in:
Kei Hibino 2016-02-12 01:40:39 +09:00
parent c087426cf3
commit ff9ea16814

View File

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