[Haskell-cafe] Any ideas on what this should generate and not generate...?

Brandon Allbery allbery.b at gmail.com
Wed Jun 28 19:05:49 UTC 2017


On Wed, Jun 28, 2017 at 2:48 PM, David McBride <toad3k at gmail.com> wrote:

> http://hackage.haskell.org/package/base-4.9.1.0/docs/
> Debug-Trace.html#v:traceM
>
> My sense is that you should probably be using traceIO rather than the
> pure trace functions.  The pure functions do not sequence with respect
> to IO and once the expression you are tracing has been fully
> evaluated, they will never take effect again.


This, and remember that IO is a bit of a trick: the expressions you build
are in fact pure, they are *descriptions* of impure computations. Once a
pure description produces a description of a low-level, impure I/O action,
the *evaluation* is done. *Execution* is separate and not affected (or for
that matter effected).  (As if we had: data IO a = GetChar | PutChar c |
... except typing that would get 'interesting'.) So things like 'traceShow'
are done once in the process of evaluating your IO down to a sequence of
low-level actions, and actually performing those actions is distinct from
this and done later.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170628/7ae89124/attachment.html>


More information about the Haskell-Cafe mailing list