module CommandLineOptions ( parseOptions ) where data Options = Options { materials :: [String] , ignoreMaterials :: [String] } parseOptions :: [String] -> Options parseOptions args = case splitWhere (== "--ignore") args of (materials, ignoredMaterials) -> Options materials ignoredMaterials splitWhere :: (a -> Bool) -> [a] -> ([a], [a]) splitWhere match (x:xs) | match x = ([], xs) splitWhere match (x:xs) = case (splitWhere match xs) of (ys, zs) -> (x:ys, zs) splitWhere _ [] = ([], [])