All pastes #280185 Raw Edit

cphaskell

public text v1 · immutable
·published 2006-12-15 18:39 UTC
rendered paste body
runl2 t = 
    do
    put 0
    t' <- l2 t 
    return t'

l2 :: Tree a -> State Int (Tree (a,Int))
l2 Empty = return Empty

l2 (Node e t1 t2) = 
    do
    i <- get
    put (i+1)
    t1' <- l2 t1
    t2' <- l2 t2
    return (Node (e,i) t1' t2')