[web-devel] GGHandler and MonadPeelIO

Aur Saraf sonoflilit at gmail.com
Fri Apr 8 13:53:59 CEST 2011


Hello,

----------------->>>>>>>>>><<<<<<<<<--------------------

runDB: need liftIOHandler

⁋For the impatient: stick liftIOHandler at the beginning of runDB like
so: runDB db = liftIOHandler $ fmap connPool getYesod >>=
Settings.runConnectionPool dbNo comments
Add a commentName:

⁋For everyone else: WAI 0.2 contained the request body as an
Enumerator in the Request datatype, and an Application was Request ->
IO Response. In WAI 0.3, an Application is Request -> Iteratee
ByteString IO Response. Long story short: all code in your Handler
function now lives on top of an Iteratee monad so that it can access
the request body.No comments
Add a commentName:

⁋This works great most of the time. The only downside is when you need
to deal with exceptions. It's impossible to define a MonadPeelIO
instance for Iteratee. Therefore, in Yesod 0.7, we have a new datatype
called GGHandler, which is just a generalization of GHandler to allow
an arbitrary inner monad.No comments
Add a commentName:

⁋GHandler defaults to having an Iteratee on the inside. But when you
need a MonadPeelIO (like we do in Persistent), you need to have an IO
on the inside. Eventually though, you'll need to convert your
GGHandler IO to a GHandler. That's what liftIOHandler does.No comments

----------------->>>>>>>>>><<<<<<<<<--------------------


Could anyone please explain this better, and what it means to someone
upgrading an application?

Specifically, what happens to:

    -- | A useful synonym; most of the DB handler functions are of this type
    type DB = SqlPersist Handler

?


Thanks :-),
  Aur



More information about the web-devel mailing list