Hello,
I am currently going through the CIS194 spring 13 course,
since it has been recommended by several haskellions. I find
the exercises extremely valuable, and the reading material is
succinct (in a good way).
I just finished the exercises for lesson two, and while
everything works, I get this warning:
Lektion02.hs:(38,1)-(44,21): warning:
[-Wincomplete-patterns] …
Pattern match(es) are non-exhaustive
In an equation for ‘insert’:
Patterns not matched:
(LogMessage _ _ _) (Node _ (LogMessage _ _ _)
_)
I understand that there is a pattern I'm not covering, but
I can't really figure out which one. Here is my function:
insert :: LogMessage -> MessageTree -> MessageTree
insert (Unknown _) mt = mt
insert m Leaf = Node Leaf m Leaf
insert m@(LogMessage _ t _) (Node left value@(LogMessage
_ t' _) right)
| t <= t' = Node (insert m left) value right
| t > t' = Node left value (insert m
right)
insert m@(LogMessage _ _ _) (Node left (Unknown _) right)
= Node left m right
I am not sure on how I should progress to find out which
pattern I'm missing.
Any help is appreciated.
Kind regards,
Jona