5 import Control.Applicative
7 data MessageType = Info
14 data LogMessage = LogMessage MessageType TimeStamp String
18 data MessageTree = Leaf
19 | Node MessageTree LogMessage MessageTree
22 -- | @testParse p n f@ tests the log file parser @p@ by running it
23 -- on the first @n@ lines of file @f@.
24 testParse :: (String -> [LogMessage])
28 testParse parse n file = take n . parse <$> readFile file
30 -- | @testWhatWentWrong p w f@ tests the log file parser @p@ and
31 -- warning message extractor @w@ by running them on the log file
33 testWhatWentWrong :: (String -> [LogMessage])
34 -> ([LogMessage] -> [String])
37 testWhatWentWrong parse whatWentWrong file
38 = whatWentWrong . parse <$> readFile file