Single step debugging a yesod application

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

Maybe you can break at " u <- get404 uid". Then you can execute
:steplocal once to reach te line you desired.
2010/11/3 Nubis
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@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

Thanks Alberto, not how I had in mind, but that helps a lot getting where I
need a lot faster.
cheers
----nubis
On Wed, Nov 3, 2010 at 12:06 PM, Alberto G. Corona
Maybe you can break at " u <- get404 uid". Then you can execute :steplocal once to reach te line you desired.
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
2010/11/3 Nubis
: 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@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (2)
-
Alberto G. Corona
-
Nubis