>>24
groupBySorted :: Ord a => [a] -> [[a]]
groupBySorted [] = []
groupBySorted (x0:xs0) = ls0 : groupBySorted rs0
  where
   (ls0, rs0) = f x0 xs0
   f x [] = ([x], [])
   f x (y:ys)
     | x <= y = let (ls, rs) = f y ys in (x:ls, rs)
     | otherwise = ([x], y:ys)

main :: IO ()
main = do
  test [8,3,4,9,9,10,6,1,4,3] -- => [[8],[3,4,9,9,10],[6],[1,4],[3]]
  test [1,3,3,4,4,6,8,9,9,10] -- => [[1,3,3,4,4,6,8,9,9,10]]
  test [10,9,9,8,6,4,4,3,3,1] -- => [[10],[9,9],[8],[6],[4,4],[3,3],[1]]
  test [1,1,1,1,1,1,1,1,1,1] -- => [[1,1,1,1,1,1,1,1,1,1]]
  test ([] :: [Int])     -- => []
  test [1]          -- => [[1]]

test :: (Ord a, Show a) => [a] -> IO ()
test xs = putStrLn $ show xs ++ " => " ++ show (groupBySorted xs)