dubst_size :: DUTree s -> ST s Int
dubst_size t =
    case t of
    DUEmpty ->
        return 0
    (DUNode lp n rp) ->
        do
        l <- readSTRef lp
        sl <- dubst_size l
        r <- readSTRef rp
        sr <- dubst_size r
        return (sl + sr + 1)

-- tests for membership of tree
-- (doesn't update tree, though this isn't obvious from the type signature)
dubst_size :: DUTree s -> ST s Int
dubst_size t =
    case t of
    DUEmpty ->
        return 0
    (DUNode lp n rp) ->
        do
        l <- readSTRef lp
        sl <- dubst_size l
        r <- readSTRef rp
        sr <- dubst_size r
        return (sl + sr + 1)

-- tests for membership of tree
-- (doesn't update tree, though this isn't obvious from the type signature)
dubst_size t =
    case t of
    DUEmpty ->
        return 0
    (DUNode lp n rp) ->
        do
        l <- readSTRef lp
        sl <- dubst_size l
        r <- readSTRef rp
        sr <- dubst_size r
        return (sl + sr + 1)

-- tests for membership of tree
-- (doesn't update tree, though this isn't obvious from the type signature)