buildst arrseq a b =
    if a == b
        then
            let minx = arrseq ! a
                in (minx, StLeaf a minx)
        else
            let midp = cmidp a b
                (minl, lt) = buildst arrseq a (midp - 1)
                (minr, rt) = buildst arrseq midp b
                minx = min minl minr
                in (minx, StNode a b minx lt rt)
buildst arrseq a b =
    if a == b
        then
            let minx = arrseq ! a
                in (minx, StLeaf a minx)
        else
            let midp = cmidp a b
                (minl, lt) = buildst arrseq a (midp - 1)
                (minr, rt) = buildst arrseq midp b
                minx = min minl minr
                in (minx, StNode a b minx lt rt)
buildst arrseq a b =
    if a == b
        then
            let minx = arrseq ! a
                in (minx, StLeaf a minx)
        else
            let midp = cmidp a b
                (minl, lt) = buildst arrseq a (midp - 1)
                (minr, rt) = buildst arrseq midp b
                minx = min minl minr
                in (minx, StNode a b minx lt rt)