<html><head></head><body><div class="ydp582a44f3yahoo-style-wrap" style="font-family:courier new, courier, monaco, monospace, sans-serif;font-size:13px;"><div></div>
<div dir="ltr" data-setdir="false">I feel I should raise the naive question, what if args is wrong?</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">[addr,50,50] when a user mistyped port 5050 as 50 50</div><div><br></div><div dir="ltr" data-setdir="false">[addr] when a user was "sure" somebody else's code would insert 5050 as the default</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">What would you like your code to do in those two cases?</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I have been using Haskell seriously for only about two years, so I am still idealistic about it. On the other hand, I worked in the software industry for about ten years, and back then my boss would have chewed me out if my Java code had crashed on the input of 50 50.</div>
</div><div id="yahoo_quoted_5211742310" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Wednesday, January 25, 2023 at 07:06:30 PM EST, Kazu Yamamoto (山本和彦) via Haskell-Cafe <haskell-cafe@haskell.org> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">Hello,<br></div><div dir="ltr"><br></div><div dir="ltr">The recent GHC added incomplete-uni-patterns to the -Wall option.<br></div><div dir="ltr">So, we have a waning with the following code:<br></div><div dir="ltr"><br></div><div dir="ltr"> let [addr,port] = args<br></div><div dir="ltr"><br></div><div dir="ltr">To avoid this, I changed the code to:<br></div><div dir="ltr"><br></div><div dir="ltr"> let addr = head args<br></div><div dir="ltr"> port = head $ tail args<br></div><div dir="ltr"><br></div><div dir="ltr">In my opinion, this seems Lisp rather than Haskell.<br></div><div dir="ltr"><br></div><div dir="ltr">Also, I need to avoid:<br></div><div dir="ltr"><br></div><div dir="ltr"> let Just val = mval<br></div><div dir="ltr"><br></div><div dir="ltr">Rahter, I use:<br></div><div dir="ltr"><br></div><div dir="ltr"> let val = fromJust mval<br></div><div dir="ltr"><br></div><div dir="ltr">This is annoying to me.<br></div><div dir="ltr"><br></div><div dir="ltr">How do you get along with incomplete-uni-patterns?<br></div><div dir="ltr">I would like to know the best current practice.<br></div><div dir="ltr"><br></div><div dir="ltr">--Kazu<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">_______________________________________________<br></div><div dir="ltr">Haskell-Cafe mailing list<br></div><div dir="ltr">To (un)subscribe, modify options or view archives go to:<br></div><div dir="ltr"><a 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></div><div dir="ltr">Only members subscribed via the mailman list are allowed to post.</div></div>
</div>
</div></body></html>