[web-devel] Single step debugging a yesod application

Alberto G. Corona agocorona at gmail.com
Wed Nov 3 16:06:13 CET 2010


Maybe you can break at " u <- get404 uid". Then you can execute
:steplocal once to reach te line you desired.

2010/11/3 Nubis <nubis at woobiz.com.ar>:
> Hi guys,
> As I said in another thread, I've been debugging a yesod application single
> stepping through one of the handlers. I'm using ghci built in debugger and
> it's pretty good, but I always fail to set the breakpoint in the right scope
> where I can evaluate the stuff I'm interested in learning more about.
> For instance, in the following code I would like to set the debugger on the
> line before "mv <- maybeAuth", in order to :force the values  of (uid, u).
> But even when I set it at the beginnig of the 'mv' line, the scope ends up
> being the entire do block. Which makes sense, but doesn't helpe me solve my
> problem :)
>
> getUserR :: String -> Handler RepHtmlJson
> getUserR input = do
>     (uid, u) <-
>         case readIntegral input of
>             Just uid -> debugRunDB $ do
>                 u <- get404 uid
>                 mun <- getBy $ UniqueUsernameUser uid
>                 case mun of
>                     Nothing -> return (uid, u)
>                     Just (_, Username _ un) ->
>                         lift $ redirect RedirectPermanent $ UserR un
>             Nothing -> debugRunDB $ do
>                 mun <- getBy $ UniqueUsername input
>                 case mun of
>                     Nothing -> lift notFound
>                     Just (_, Username uid _) -> do
>                         u <- get404 uid
>                         return (uid, u)
>     mv <- maybeAuth
>
>
> Maybe the problem is that I'm thinking in a too procedural fashion about do
> blocks, or that evaluating those results is kind of paranoid. I'm too
> spoiled by REPL's, I would even like to be able to use a REPL that runs
> inside runDB for querying models and doing stuff with them interactively.
>
> How do you debug your yesod apps? am I drifting too far away from the
> haskell way?
>
> thanks in advance for your comments :)
>
> cheers
> ----nubis
>
> _______________________________________________
> 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