t ξ → Html
renderNode t = itm ∘ getNode $ t
    where
    nic ∷ String → AttributeValue   -- node indicator class
    nic clazz = toValue $ (clazz++) $ if isLeaf t then " leaf" else " inner"  
    
    itm (New x)           = wrapS (nic "new") x
    itm (Deleted x)       = wrapS (nic "deleted") x
    itm (Unchanged x)     = wrapS (nic "unchanged") x
    itm (Changed old new) = mkSpan (nic "changed") $ 
                            (mkNameValueSpan old >> mkSpanH "newPayload" (payload new))

    mkSpan clazz = H.span ! A.class_ clazz
    mkSpanH clazz content = mkSpan clazz $ (toHtml content)
    mkNameValueSpan x = mkSpanH "nodeName" (nodeName x) >> mkSpanH "payload" (payload x)
    wrapS clazz x = mkSpan clazz $ mkNameValueSpan x

renderNode ∷ RenderableTree t ξ ⇒ DiffTree t ξ → Html
renderNode t = itm ∘ getNode $ t
    where
    nic ∷ String → AttributeValue   -- node indicator class
    nic clazz = toValue $ (clazz++) $ if isLeaf t then " leaf" else " inner"  
    
    itm (New x)           = wrapS (nic "new") x
    itm (Deleted x)       = wrapS (nic "deleted") x
    itm (Unchanged x)     = wrapS (nic "unchanged") x
    itm (Changed old new) = mkSpan (nic "changed") $ 
                            (mkNameValueSpan old >> mkSpanH "newPayload" (payload new))

    mkSpan clazz = H.span ! A.class_ clazz
    mkSpanH clazz content = mkSpan clazz $ (toHtml content)
    mkNameValueSpan x = mkSpanH "nodeName" (nodeName x) >> mkSpanH "payload" (payload x)
    wrapS clazz x = mkSpan clazz $ mkNameValueSpan x
renderNode t = itm ∘ getNode $ t
    where
    nic ∷ String → AttributeValue   -- node indicator class
    nic clazz = toValue $ (clazz++) $ if isLeaf t then " leaf" else " inner"  
    
    itm (New x)           = wrapS (nic "new") x
    itm (Deleted x)       = wrapS (nic "deleted") x
    itm (Unchanged x)     = wrapS (nic "unchanged") x
    itm (Changed old new) = mkSpan (nic "changed") $ 
                            (mkNameValueSpan old >> mkSpanH "newPayload" (payload new))

    mkSpan clazz = H.span ! A.class_ clazz
    mkSpanH clazz content = mkSpan clazz $ (toHtml content)
    mkNameValueSpan x = mkSpanH "nodeName" (nodeName x) >> mkSpanH "payload" (payload x)
    wrapS clazz x = mkSpan clazz $ mkNameValueSpan x