[Haskell-cafe] Is there a tool to see reduction steps?

Daryoush Mehrtash dmehrtash at gmail.com
Wed Oct 10 22:53:31 CEST 2012

I have been given a piece of code that uses Tie-ing the Knot concept to
label a tree of nodes in breath first manner.  It seems to work fine, but
 I am having trouble expanding the code on my own to see the evaluation
 process.   I like to know if there is a tools to use to see
the reduction steps.

> data Tree = Leaf | Node Tree Int Tree deriving Show

> label (Node ln _ rn) ((h:r):rest) = (Node lr h rr, r:r2) where
>                                         (lr, r1) = label ln rest
>                                         (rr, r2) = label rn r1
> label _ _  = (Leaf, [])
> lt t = let (r, unused) = label t ([1..]:unused)
>        in r


Weblog:  http://onfp.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121010/562cfe14/attachment.htm>

More information about the Haskell-Cafe mailing list