<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div>Hi,<br>
<br>
In the following code:<br>
<br>
insert m@(LogMessage _ t _) (Node left value@(LogMessage _ t' _)
right)</div>
<div> | t <= t' = Node (insert m left) value right</div>
<div> | t > t' = Node left value (insert m right)<br>
<br>
GHC can't detect that both guards (t <= t') and (t > t')
cover all cases. The usual way to deal with this is to use
"otherwise" (which is always true):<br>
<br>
insert m@(LogMessage _ t _) (Node left value@(LogMessage _ t' _)
right)
<div> | t <= t' = Node (insert m left) value right</div>
<div> | otherwise = Node left value (insert m right)<br>
<br>
Regards,<br>
Sylvain<br>
</div>
</div>
<br>
<div class="moz-cite-prefix">On 06/07/2017 11:12, Jona Ekenberg
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CALvEEUeLDExZtZOfLx-WY6fVWN-OC5bGxs6WXFTg7qDbsVXc6Q@mail.gmail.com">
<div dir="ltr">Hello,
<div><br>
</div>
<div>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).</div>
<div><br>
</div>
<div>I just finished the exercises for lesson two, and while
everything works, I get this warning:</div>
<div>
<div>Lektion02.hs:(38,1)-(44,21): warning:
[-Wincomplete-patterns] …</div>
<div> Pattern match(es) are non-exhaustive</div>
<div> In an equation for ‘insert’:</div>
<div> Patterns not matched:</div>
<div> (LogMessage _ _ _) (Node _ (LogMessage _ _ _)
_)</div>
</div>
<div><br>
</div>
<div>I understand that there is a pattern I'm not covering, but
I can't really figure out which one. Here is my function:</div>
<div>
<div>insert :: LogMessage -> MessageTree -> MessageTree</div>
<div>insert (Unknown _) mt = mt</div>
<div>insert m Leaf = Node Leaf m Leaf</div>
<div>insert m@(LogMessage _ t _) (Node left value@(LogMessage
_ t' _) right)</div>
<div> | t <= t' = Node (insert m left) value right</div>
<div> | t > t' = Node left value (insert m
right)</div>
<div>insert m@(LogMessage _ _ _) (Node left (Unknown _) right)</div>
<div> = Node left m right</div>
</div>
<div><br>
</div>
<div>(here's a pastebin with intact indentation: <a
href="http://lpaste.net/356716" moz-do-not-send="true">http://lpaste.net/356716</a>)</div>
<div><br>
</div>
<div>I am not sure on how I should progress to find out which
pattern I'm missing.</div>
<div>Any help is appreciated.</div>
<div><br>
</div>
<div>Kind regards,</div>
<div>Jona</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>