<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-10-01 11:01 GMT+02:00 Oliver Charles <span dir="ltr"><<a href="mailto:ollie@ocharles.org.uk" target="_blank">ollie@ocharles.org.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div dir="ltr">[...] However, it's a lot more significant if you want to do something like:<br></div></span><div><br></div><div>foo x = doSomething (case x of ...)</div><div><br></div><div>Without pattern synonyms, you either have</div><div><br></div><div>foo x = doSomething x'</div><div> where x' | x == ... = ...</div><div><br></div><div>or</div><div><br></div><div>{-# LANGUAGE MultiWayIf #-}</div><div><br></div><div>foo x = doSomething (if | x == ... -> ...)</div></div></div>
</blockquote></div><br></div><div class="gmail_extra">Or simply in plain old Haskell (basically the desugaring of the multi-way-if):</div><div class="gmail_extra"><br></div><div class="gmail_extra"> foo x = doSomething (case () of</div><div class="gmail_extra"> _ | x == gl_BAR -> expr1</div><div class="gmail_extra"> | x == gl_BAZ -> expr2</div><div class="gmail_extra"> | otherwise -> expr3)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Compared to:</div><div class="gmail_extra"><br></div><div class="gmail_extra"> foo x = doSomething (case x of</div><div class="gmail_extra"> GL_BAR -> expr1</div><div class="gmail_extra"> GL_BAZ -> expr2</div><div class="gmail_extra"> _ .> expr3)</div><div class="gmail_extra"><br></div><div class="gmail_extra">it doesn't really look *that* much different IMHO, given the high price one has to pay for a tiny improvement in readability. But that's my personal, more conservative view of things, and I'm here to see what other people prefer.Alas, up to now, this is not very conclusive... :-/</div></div>