Hello,
According to the manual of the CIS 194 course I have to do this in
GHCI : testParse parse 10 "error.log"
This to test my code.
Now my problem is that I cannot use GHCI because I use Fpcomplete.
So I thought I will use main for this :
So I tried this :
main :: IO ()
main = do
print $ testParse parse 10 "error.log"
but then I see this error message :
src/LogAnalysis.hs@39:4-39:9
No instance for (Show (IO
[LogMessage])) arising from a use of
print
…
In the expression: print
In a stmt of a 'do' block: print $ testParse parse 10
"error.log"
In the expression: do { print $ testParse parse 10 "error.log" }
The testparse function looks like this :
-- | @testParse p n f@ tests the log file parser @p@ by running it
-- on the first @n@ lines of file @f@.
testParse :: (String -> [LogMessage])
-> Int
-> FilePath
-> IO [LogMessage]
testParse parse n file = take n . parse <$> readFile file
Roelof