{- |
  Same as splitOn but empty lists are kept. Even the empty list is split into
  a singleton list containing the empty list.
-}
splitBy :: Eq a => a -- ^ separator
        -> [a] -- ^ list to split
        -> [[a]]
splitBy c l = let (p, q) = break (c ==) l in p : case q of
     [] -> []
     _ : r -> splitBy c r

{- | Same as splitBy but the separator is a sublist not only one element.
Note that the separator must be non-empty. -}
splitBy :: Eq a => a -- ^ separator
        -> [a] -- ^ list to split
        -> [[a]]
splitBy c l = let (p, q) = break (c ==) l in p : case q of
     [] -> []
     _ : r -> splitBy c r

{- | Same as splitBy but the separator is a sublist not only one element.
Note that the separator must be non-empty. -}
splitBy c l = let (p, q) = break (c ==) l in p : case q of
     [] -> []
     _ : r -> splitBy c r

{- | Same as splitBy but the separator is a sublist not only one element.
Note that the separator must be non-empty. -}