Initial setup
parent
22debc12d7
commit
f6d7a9e183
|
@ -0,0 +1,28 @@
|
|||
module LogAnalysis where
|
||||
|
||||
import Text.Read ( readMaybe )
|
||||
|
||||
data MessageType = Info
|
||||
| Warning
|
||||
| Error Int
|
||||
deriving (Show, Eq)
|
||||
|
||||
type Timestamp = Int
|
||||
|
||||
data LogMessage = LogMessage MessageType Timestamp String
|
||||
deriving (Show, Eq)
|
||||
|
||||
data MaybeLogMessage = ValidLM LogMessage
|
||||
| InvalidLM String
|
||||
deriving (Show, Eq)
|
||||
|
||||
data MaybeInt = ValidInt Int
|
||||
| InvalidInt
|
||||
deriving (Show, Eq)
|
||||
|
||||
readInt :: String -> MaybeInt
|
||||
readInt s
|
||||
| Just i <- readMaybe s = ValidInt i
|
||||
| otherwise = InvalidInt
|
||||
|
||||
-- parseMessage :: String -> MaybeLogMessage
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,11 @@
|
|||
I 6 Completed armadillo processing
|
||||
I 1 Nothing to report
|
||||
I 4 Everything normal
|
||||
I 11 Initiating self-destruct sequence
|
||||
E 70 3 Way too many pickles
|
||||
E 65 8 Bad pickle-flange interaction detected
|
||||
W 5 Flange is due for a check-up
|
||||
I 7 Out for lunch, back in two time steps
|
||||
E 20 2 Too many pickles
|
||||
I 9 Back from lunch
|
||||
E 99 10 Flange failed!
|
Loading…
Reference in New Issue