[web-devel] GGHandler, PersistBackend, and MonadPlus

Jeremy Hughes jedahu at gmail.com
Wed Jun 8 22:16:17 CEST 2011


Hi,

Could GGHandler be made an instance of MonadPlus, and PersistBackend
have MonadPlus in its context? I have found both to be useful.

Jeremy


diff from yesod-core-0.8.2/Yesod/Handler.hs
123c123
< import Control.Monad (liftM, join, MonadPlus)
---
> import Control.Monad (liftM, join)
249c249
<     deriving (Functor, Applicative, Monad, MonadPlus, MonadIO, MonadControlIO)
---
>     deriving (Functor, Applicative, Monad, MonadIO, MonadControlIO)


diff from persistent-0.5.1/Database/Persist/Base.hs
54a55,56
> import Control.Monad
>
303c305
< class Monad m => PersistBackend m where
---
> class MonadPlus m => PersistBackend m where


diff from persistent-0.5.1/Database/Persist/GenericSql.hs
34c34
< import Control.Monad (liftM, unless)
---
> import Control.Monad (liftM, unless, MonadPlus)
63c63
< instance MonadControlIO m => PersistBackend (SqlPersist m) where
---
> instance (MonadPlus m, MonadControlIO m) => PersistBackend (SqlPersist m) where


diff from persistent-0.5.1/Database/Persist/GenericSql/Raw.hs
22a23
> import Control.Monad
25c26
<     deriving (Monad, MonadIO, MonadTrans, Functor, Applicative,
MonadControlIO)
---
>     deriving (Monad, MonadIO, MonadTrans, Functor, Applicative, MonadControlIO, MonadPlus)



diff from persistent-mongoDB-0.2.2/Database/Persist/MongoDB.hs
28a29
> import Control.Monad (MonadPlus)
37c38
<     deriving (Monad, Trans.MonadIO, Functor, Applicative)
---
>     deriving (Monad, Trans.MonadIO, Functor, Applicative, MonadPlus)
121c122
< instance (DB.DbAccess m, DB.Service t) => PersistBackend
(MongoDBReader t m) where
---
> instance (DB.DbAccess m, DB.Service t, MonadPlus m) => PersistBackend (MongoDBReader t m) where



More information about the web-devel mailing list