#!/usr/bin/env runhaskell module Main where import System (getArgs) import qualified Data.ByteString.Lazy.Char8 as L has_all_vowels :: L.ByteString -> Bool has_all_vowels word = map (\pred -> pred word) predicates == [True,True,True,True,True] where predicates = (map (\c -> L.elem c) "aeiou") words_with_all_vowels = filter has_all_vowels . L.lines main :: IO () main = do [infile] <- getArgs contents <- L.readFile infile mapM_ L.putStrLn $ words_with_all_vowels contents -- -- $ {time ~/vowels.hs /usr/share/dict/words} | wc -l -- ~/vowels.hs /usr/share/dict/words 0.80s user 0.04s system 99% cpu 0.852 total -- 5942 --