packages feed

groundhog 0.7.0 → 0.7.0.1

raw patch · 3 files changed

+48/−9 lines, 3 filesdep ~monad-controlPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: monad-control

API changes (from Hackage documentation)

- Database.Groundhog.Core: data Proxy a
+ Database.Groundhog.Core: instance MonadCont m => MonadCont (DbPersist conn m)
+ Database.Groundhog.Core: instance MonadError e m => MonadError e (DbPersist conn m)
+ Database.Groundhog.Core: instance MonadState s m => MonadState s (DbPersist conn m)
+ Database.Groundhog.Core: instance MonadWriter w m => MonadWriter w (DbPersist conn m)

Files

Database/Groundhog/Core.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GADTs, TypeFamilies, ExistentialQuantification, MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, EmptyDataDecls, ConstraintKinds #-}+{-# LANGUAGE GADTs, TypeFamilies, ExistentialQuantification, MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, EmptyDataDecls, ConstraintKinds, CPP #-} {-# LANGUAGE UndecidableInstances #-} -- Required for Projection' -- | This module defines the functions and datatypes used throughout the framework. -- Most of them are for the internal use@@ -20,7 +20,6 @@   , BackendSpecific   , ConstructorMarker   , UniqueMarker-  , Proxy   , HFalse   , HTrue   , ZT (..) -- ZonedTime wrapper@@ -91,10 +90,14 @@ import Control.Monad.Trans.Class (MonadTrans(..)) import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.Trans.Control (MonadBaseControl (..), ComposeSt, defaultLiftBaseWith, defaultRestoreM, MonadTransControl (..))-import Control.Monad.Trans.Reader (ReaderT(..), runReaderT)+import Control.Monad.Trans.Reader (ReaderT(..), runReaderT, mapReaderT) import Control.Monad.Trans.State (StateT) import Control.Monad.Reader (MonadReader(..)) import Control.Monad (liftM)+import qualified Control.Monad.Cont.Class as Mtl+import qualified Control.Monad.Error.Class as Mtl+import qualified Control.Monad.State.Class as Mtl+import qualified Control.Monad.Writer.Class as Mtl import Data.ByteString.Char8 (ByteString) import Data.Int (Int64) import Data.Map (Map)@@ -140,9 +143,6 @@ -- | It allows to store autogenerated keys of one database in another if they have different datatype. data KeyForBackend db v = (DbDescriptor db, PersistEntity v) => KeyForBackend (AutoKeyType db) -{-# DEPRECATED Proxy "use polymorphic proxy or another data constructor like [] instead" #-}-data Proxy a- data HFalse data HTrue @@ -262,20 +262,56 @@   liftBase = lift . liftBase  instance MonadTransControl (DbPersist conn) where+#if MIN_VERSION_monad_control(1, 0, 0)+  type StT (DbPersist conn) a = StT (ReaderT conn) a+  liftWith f = DbPersist $ ReaderT $ \r -> f $ \t -> runReaderT (unDbPersist t) r+  restoreT = DbPersist . ReaderT . const+#else   newtype StT (DbPersist conn) a = StReader {unStReader :: a}   liftWith f = DbPersist $ ReaderT $ \r -> f $ \t -> liftM StReader $ runReaderT (unDbPersist t) r   restoreT = DbPersist . ReaderT . const . liftM unStReader+#endif  instance MonadBaseControl IO m => MonadBaseControl IO (DbPersist conn m) where+#if MIN_VERSION_monad_control(1, 0, 0)+  type StM (DbPersist conn m) a = ComposeSt (DbPersist conn) m a+  liftBaseWith = defaultLiftBaseWith+  restoreM     = defaultRestoreM+#else   newtype StM (DbPersist conn m) a = StMSP {unStMSP :: ComposeSt (DbPersist conn) m a}   liftBaseWith = defaultLiftBaseWith StMSP   restoreM     = defaultRestoreM   unStMSP+#endif  instance MonadLogger m => MonadLogger (DbPersist conn m) where-    monadLoggerLog a b c = lift . monadLoggerLog a b c+  monadLoggerLog a b c = lift . monadLoggerLog a b c  runDbPersist :: Monad m => DbPersist conn m a -> conn -> m a runDbPersist = runReaderT . unDbPersist++mapDbPersist :: (m a -> n b) -> DbPersist conn m a -> DbPersist conn n b+mapDbPersist f m = DbPersist $ mapReaderT f $ unDbPersist m++instance Mtl.MonadWriter w m => Mtl.MonadWriter w (DbPersist conn m) where+  writer = lift . Mtl.writer+  tell = lift . Mtl.tell+  listen = mapDbPersist Mtl.listen+  pass = mapDbPersist Mtl.pass++instance Mtl.MonadError e m => Mtl.MonadError e (DbPersist conn m) where+  throwError = lift . Mtl.throwError+  catchError m h = DbPersist $ Mtl.catchError (unDbPersist m) (unDbPersist . h)++instance Mtl.MonadCont m => Mtl.MonadCont (DbPersist conn m) where+  callCC = liftCallCC Mtl.callCC where+    liftCallCC callCC f = DbPersist $ ReaderT $ \ r ->+      callCC $ \ c ->+      runDbPersist (f (DbPersist . ReaderT . const . c)) r++instance Mtl.MonadState s m => Mtl.MonadState s (DbPersist conn m) where+  get = lift Mtl.get+  put = lift . Mtl.put+  state = lift . Mtl.state  class PrimitivePersistField (AutoKeyType db) => DbDescriptor db where   -- | Type of the database default autoincremented key. For example, Sqlite has Int64
changelog view
@@ -1,3 +1,6 @@+0.7.0.1+* Support for monad-control 1.0+ 0.7.0 * Removed logger argument from executeMigration and runMigration * PersistField instance for lazy ByteString
groundhog.cabal view
@@ -1,5 +1,5 @@ name:            groundhog-version:         0.7.0+version:         0.7.0.1 license:         BSD3 license-file:    LICENSE author:          Boris Lykah <lykahb@gmail.com>@@ -24,7 +24,7 @@                    , text                     >= 0.8                    , blaze-builder            >= 0.3        && < 0.4                    , containers               >= 0.2-                   , monad-control            >= 0.3        && < 0.4+                   , monad-control            >= 0.3        && < 1.1                    , monad-logger             >= 0.3        && < 0.4                    , transformers-base     exposed-modules: Database.Groundhog