#!/usr/bin/env runhaskell main :: IO () main = do let a = splitOn ' ' "hoge fuga" case a of [] -> putStrLn "empty" x:xs -> putStrLn x splitOn :: Char -> String -> [String] splitOn splitter string = case string of [] -> [] x:xs -> if x == splitter then [" ", xs] else [[x]] (splitOn splitter xs)