splitOn' :: Eq a => a -> [a] -> [[a]]
splitOn' = go [] 
  where
    go res _ [] = reverse res
    go res s ls = let (pre, suf) = break (==s) ls
                  in case suf of
                  []   -> go (pre:res) s []
                  [_]  ->  go ([]:pre:res) s []
                  -- invariant: x == s
                  _:xs -> go (pre:res) s xs
splitOn' :: Eq a => a -> [a] -> [[a]]
splitOn' = go [] 
  where
    go res _ [] = reverse res
    go res s ls = let (pre, suf) = break (==s) ls
                  in case suf of
                  []   -> go (pre:res) s []
                  [_]  ->  go ([]:pre:res) s []
                  -- invariant: x == s
                  _:xs -> go (pre:res) s xs
splitOn' = go [] 
  where
    go res _ [] = reverse res
    go res s ls = let (pre, suf) = break (==s) ls
                  in case suf of
                  []   -> go (pre:res) s []
                  [_]  ->  go ([]:pre:res) s []
                  -- invariant: x == s
                  _:xs -> go (pre:res) s xs