i am new to haskell language.
i have a programming assignment.
write a Haskell function that takes a text file as input, divides it into words, and counts the number of words of three letters or less. Then take the words and store them in a hash table, a data structure that is built into Haskell.
I want to know if this is the right way.
--word count type WordCount = (Int) --count file countFile :: FilePath -> IO WordCount countFile file = do text <- readFile file return $ getCount text --get count getCount :: String -> WordCount getCount = foldl' (\v w x -> (w+length<3 (words x))) (0) . lines -- print count printCountLine :: Opts -> FilePath -> WordCount -> IO () printCountLine opts f (ws) = putStrLn ("\t" ++ (if showWords opts then (show ws) ++ "\t" else "") ++ f)