News for hackers. Stuff that matters.
Re:The Haskell user experience by sfvisser on Wednesday August 05, 2015 @09:38AM (#10009586)
Note that trace is implemented in terms of unsafePerformIO (which is fine for debugging).

To get a trace message, you need to attach the trace to something that does get evaluated. I mostly define a somewhat simpler helper like this:

    tt :: Show a => a -> a
    tt x = trace (show x) x
So you surround your expressions with it and see there values, when those values get evaluated of course. Eg:

    myParser = (\_ code -> tt code) <$> parseComment <*> parseCode
Re:The Haskell user experience by jcl on Wednesday August 05, 2015 @03:56PM (#10012401)
Note: I just looked at the docs linked in creichert's sibling post, and I noticed that Debug.Trace provides traceShow as a helper.