Given the following code:

module Log where
import Control.Applicative

data MessageType = Info
                 | Warning
                 | Error Int

type TimeStamp = Int

data LogMessage = LogMessage MessageType TimeStamp String
                | Unknown String

I want to create a log parser like this:

module LogAnalysis where
import Log

parseMessage :: String -> LogMessage
parseMessage xs
  | length(words(xs)) < 3 = Unknown xs
  | notElem(head(words(xs)) ["I", "E", "W"]) = Unknown xs
  | otherwise = LogMessage Info 3 head(words(xs))

But GHC gives me "• Couldn't match type ‘[a0] -> a0’ with ‘[Char]’
      Expected type: String
        Actual type: [a0] -> a0"

So it thinks I am giving it the function head, when I would like to give it the output.

How do I fix this?

Thanks in advance,