<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-07-13 13:45 GMT+02:00 Nikolay Amiantov <span dir="ltr"><<a href="mailto:ab@fmap.me" target="_blank">ab@fmap.me</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">[...]<br>
1. Use lens: `has _Left`<br>
2. Make a function: `isLeft (Left _) = True; isLeft _ = False`<br>
3. (When you need a lambda) Use LambdaCase: `\case Left _ -> True; _ -><br>
False`<br>
[...]<br></blockquote><div><br></div></div></div><div class="gmail_extra"><a href="http://www.extremeprogramming.org/rules/simple.html">http://www.extremeprogramming.org/rules/simple.html</a> ;-) So IMHO a simple, old-skool '\x -> case x of Left _ -> True; _ -> False' (probably item 2.5 in the list above) is by far the "best" way: It doesn't use any kind of extension, it doesn't pull in a dozen of packages for a trivial task, and is readable by anyone. My personal experience is that things which look very clever and advanced (like using meta/reflection facilities) only increase the WTF factor in the long run. Those facilities have their uses, but they come with a heavy cost which must be justified somehow. Boring code is good code! :-D</div></div>