sindexT :: Int -> STree a -> a
sindexT n tr
    | sisNil tr                  = error "index error fail to fetch"
    | n == ssize tr              = streeVal tr
    | n < ssize (sleftSub tr)    = sindexT n (sleftSub tr)
    | otherwise                  = sindexT (n - 1 - (ssize . sleftSub) tr) (srightSub tr)
sindexT :: Int -> STree a -> a
sindexT n tr
    | sisNil tr                  = error "index error fail to fetch"
    | n == ssize tr              = streeVal tr
    | n < ssize (sleftSub tr)    = sindexT n (sleftSub tr)
    | otherwise                  = sindexT (n - 1 - (ssize . sleftSub) tr) (srightSub tr)
sindexT n tr
    | sisNil tr                  = error "index error fail to fetch"
    | n == ssize tr              = streeVal tr
    | n < ssize (sleftSub tr)    = sindexT n (sleftSub tr)
    | otherwise                  = sindexT (n - 1 - (ssize . sleftSub) tr) (srightSub tr)