Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Issue with lazy eval + trace (Hugo Ferreira) ---------------------------------------------------------------------- Message: 1 Date: Mon, 07 Nov 2011 08:41:24 +0000 From: Hugo Ferreira <h...@inescporto.pt> Subject: [Haskell-beginners] Issue with lazy eval + trace To: beginners@haskell.org Message-ID: <4eb799b4.1040...@inescporto.pt> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Hello, I am using "import Debug.Trace" to debug some code but it is not working as expected. I believe this is due to lazy evaluation. But I cannot see how I can circumvent it. To exemplify I have the following function: tagFun :: (POSTags -> Tag) -> POSTags -> POSTags tagFun f corpus = Z.foldlz' tag Z.empty corpus where tag acc z = Z.insert newTag acc where (token, correctTag, _proposdTag) = trace "cursor " Z.cursor z proposed = trace "proposed tag" (f z) newTag = ( token, correctTag, proposed ) If I place tracing at: tag acc z = trace ("tag "++token++" = "++ show newTag) Z.insert newTag acc then it works ok. However the lines (token, correctTag, _proposdTag) = trace "cursor " Z.cursor z proposed = trace "proposed tag" (f z) don't work. They only appear once. I assume they should appear with every element in the zipper. Can anyone explain why? TIA, Hugo F. ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 41, Issue 8 ****************************************