module Util where import Data.List.NonEmpty (NonEmpty(..), (<|)) splitOn :: (a -> Bool) -> [a] -> NonEmpty [a] splitOn _ [] = [] :| [] splitOn f (x:xs) | f x = [] <| splitOn f xs | otherwise = let l :| ls = splitOn f xs in (x : l) :| ls