[ create a new paste ] login | about

Link: http://codepad.org/Dqtj2BhE    [ raw code | output | fork ]

Haskell, pasted on Dec 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Main where

import Control.Applicative
import Control.Monad
import Data.Char

isLeftHandChar :: Char -> Bool
isLeftHandChar = (`elem` "qwertasdfgzxcvb") . toLower

isLeftHand :: String -> Bool
isLeftHand = all isLeftHandChar

main :: IO ()
main = do
  words <- lines <$> readFile "/usr/share/dict/words"
  forM_ words $ \w ->
    when (isLeftHand w) $ putStrLn w


Output:
1
2

Program error: /usr/share/dict/words: IO.openFile: does not exist (file does not exist)


Create a new paste based on this one


Comments: