import Data.Map (Map) import qualified Data.Map as M count :: FilePath -> IO () count f = do cs <- readFile f let m = statistik $ words cs putStrLn $ show m statistik :: [ String ] -> Map String Int statistik ws = M.fromListWith (+) $ do w <- ws return ( w, 1 )