A newtype wrapper for compatible backends, mainly useful for DerivingVia.
When writing a new backend that is BackendCompatible with an existing backend, instances for the new backend can be naturally defined in terms of the instances for the existing backend.
For example, if you decide to augment the SqlBackend with some additional
features:
data BetterSqlBackend = BetterSqlBackend { sqlBackend :: SqlBackend, ... }
instance BackendCompatible SqlBackend BetterSqlBackend where
projectBackend = sqlBackend
Then you can use DerivingVia to automatically get instances like:
deriving via (Compatible SqlBackend BetterSqlBackend) instance PersistStoreRead BetterSqlBackend
deriving via (Compatible SqlBackend BetterSqlBackend) instance PersistStoreWrite BetterSqlBackend
...
These instances will go through the compatible backend (in this case, SqlBackend)
for all their queries.
These instances require that both backends have the same BaseBackend, but deriving HasPersistBackend will enforce that for you.
deriving via (Compatible SqlBackend BetterSqlBackend) instance HasPersistBackend BetterSqlBackend
Constructors
Instances23Bounded, Enum, Eq, Integral, Num, Ord, …
(BackendCompatible b s, Bounded (BackendKey b)) => Bounded (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Enum (BackendKey b)) => Enum (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Eq (BackendKey b)) => Eq (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Integral (BackendKey b)) => Integral (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Num (BackendKey b)) => Num (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Ord (BackendKey b)) => Ord (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Read (BackendKey b)) => Read (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Real (BackendKey b)) => Real (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, Show (BackendKey b)) => Show (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, FromJSON (BackendKey b)) => FromJSON (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, ToJSON (BackendKey b)) => ToJSON (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, PersistField (BackendKey b)) => PersistField (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, PersistFieldSql (BackendKey b)) => PersistFieldSql (BackendKey (Compatible b s))Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(HasPersistBackend b, BackendCompatible b s, PersistQueryRead b) => PersistQueryRead (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(HasPersistBackend b, BackendCompatible b s, PersistQueryWrite b) => PersistQueryWrite (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, HasPersistBackend b) => HasPersistBackend (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(BackendCompatible b s, PersistCore b) => PersistCore (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(HasPersistBackend b, BackendCompatible b s, PersistStoreRead b) => PersistStoreRead (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(HasPersistBackend b, BackendCompatible b s, PersistStoreWrite b) => PersistStoreWrite (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(HasPersistBackend b, BackendCompatible b s, PersistUniqueRead b) => PersistUniqueRead (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Types(HasPersistBackend b, BackendCompatible b s, PersistUniqueWrite b) => PersistUniqueWrite (Compatible b s)Defined in persistent-2.14.6.3 · Database.Persist.Compatible.Typesdata BackendKey (Compatible b s)CompatibleKeyunCompatibleKey :: BackendKey b
type BaseBackend (Compatible b s) = BaseBackend bDefined in persistent-2.14.6.3 · Database.Persist.Compatible.Types