[web-devel] GGHandler, PersistBackend, and MonadPlus

Michael Snoyman michael at snoyman.com
Thu Jun 9 12:41:32 CEST 2011


Hi Jeremy,
Hi Jeremy,

Sounds good in general. I've pushed a patch to each of the yesod-core
and persistent repos. The one thing I'm not sure about is adding
MonadPlus to the superclass requirements. Is there a specific reason
that's necessary?

Michael

On Wed, Jun 8, 2011 at 11:16 PM, Jeremy Hughes <jedahu at gmail.com> wrote:
> 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
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>



More information about the web-devel mailing list