Algebraischer Datentyp

data Node k
    = Branch { key :: k, left :: Node k, right :: Node k }
    | Leaf   { key :: k }

children :: Node k -> [ Node k ]
children = \ n -> case n of
    Branch {} -> [ left n, right n ]
    Leaf   {} -> [ ]



2009-11-20