<html><head></head><body><div class="ydp19b1fb51yahoo-style-wrap" style="font-family:courier new, courier, monaco, monospace, sans-serif;font-size:13px;"><div></div>
<div dir="ltr" data-setdir="false">Is pattern matching more elegant than Safe.tailErr ? Pattern matching makes your meaning visible to the eye.</div><div><br></div>
</div><div id="yahoo_quoted_4430218439" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Thursday, April 18, 2024 at 06:24:29 PM EDT, George Colpitts <george.colpitts@gmail.com> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv1760996648"><div><div dir="ltr"><div dir="ltr"><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default">It seems that I can replace </div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default"><br clear="none"></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px;"><div dir="ltr"><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default"><span style="font-family:Arial, Helvetica, sans-serif;font-size:small;"> if null ys then [] else [(xs,tail ys)])</span></div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default"><span style="font-family:Arial, Helvetica, sans-serif;font-size:small;"><br clear="none"></span></div></div></blockquote><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default">with </div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default"><br clear="none"></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px;"><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default">if null ys then [] else [(xs, Safe.tailErr ys)])</div></blockquote><br clear="none"><div dir="ltr"><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default">and not get any warnings so I think I am going to do that. I'm surprised that the warning doesn't mention that option to fix the issue. Do you see any issues with this fix?</div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default"><br clear="none"></div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default">Thanks,</div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default">George</div><div style="font-family:new serif;font-size:large;" class="yiv1760996648gmail_default"><br clear="none"></div></div><br clear="none"><div id="yiv1760996648yqt73223" class="yiv1760996648yqt7658873373"><div class="yiv1760996648gmail_quote"><div dir="ltr" class="yiv1760996648gmail_attr">On Tue, Apr 16, 2024 at 11:57 AM George Colpitts <<a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:george.colpitts@gmail.com" target="_blank" href="mailto:george.colpitts@gmail.com">george.colpitts@gmail.com</a>> wrote:<br clear="none"></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;" class="yiv1760996648gmail_quote"><div dir="ltr"><div style="font-family:new serif;font-size:large;">Hi Henning,</div><div style="font-family:new serif;font-size:large;"><br clear="none"></div><div style="font-family:new serif;font-size:large;">Thanks for the quick response!</div><div style="font-family:new serif;font-size:large;">Yes, that's basically how I fixed it but I really don't want to have to do that since the code is correct. Not a big deal but may be irritating to beginners or large projects that want to eliminate warnings. Do you think an ER would be rejected ? If I remember correctly there is already detection of incomplete pattern matching that is ok and in such cases warnings are omitted. This would be similar to that.</div><div style="font-family:new serif;font-size:large;"><br clear="none"></div><div style="font-family:new serif;font-size:large;">Cheers,</div><div style="font-family:new serif;font-size:large;">George</div><div style="font-family:new serif;font-size:large;"><br clear="none"></div></div><br clear="none"><div class="yiv1760996648gmail_quote"><div dir="ltr" class="yiv1760996648gmail_attr">On Tue, Apr 16, 2024 at 11:46 AM Henning Thielemann <<a rel="nofollow noopener noreferrer" shape="rect" ymailto="mailto:lemming@henning-thielemann.de" target="_blank" href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>> wrote:<br clear="none"></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;" class="yiv1760996648gmail_quote"><br clear="none">
On Tue, 16 Apr 2024, George Colpitts wrote:<br clear="none">
<br clear="none">
> ghc should be able to deduce correct use of partial functions and not give a warning in such cases, e.g.<br clear="none">
> in 9.8.2<br clear="none">
> <br clear="none">
> if null ys then [] else [(xs,tail ys)])<br clear="none">
> <br clear="none">
> gets a warning<br clear="none">
> <br clear="none">
> warning: [GHC-63394] [-Wx-partial]<br clear="none">
> <br clear="none">
> but it is clear that this use of tail will never be a problem so IMHO that line of code should not get a<br clear="none">
> warning. <br clear="none">
> <br clear="none">
> Does anybody know if there is a plan or enhancement request to eliminate such warnings? <br clear="none">
<br clear="none">
<br clear="none">
I would just use good old pattern matching:<br clear="none">
<br clear="none">
case ys of<br clear="none">
[] -> []<br clear="none">
_:zs -> [(xs,zs)]</blockquote></div>
</blockquote></div></div></div>
</div></div><div class="yqt7658873373" id="yqt92290">_______________________________________________<br clear="none">Haskell-Cafe mailing list<br clear="none">To (un)subscribe, modify options or view archives go to:<br clear="none"><a shape="rect" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br clear="none">Only members subscribed via the mailman list are allowed to post.</div></div>
</div>
</div></body></html>