2015-07-13 13:45 GMT+02:00 Nikolay Amiantov <ab@fmap.me>:
[...]
1. Use lens: `has _Left`
2. Make a function: `isLeft (Left _) = True; isLeft _ = False`
3. (When you need a lambda) Use LambdaCase: `\case Left _ -> True; _ ->
False`
[...]
http://www.extremeprogramming.org/rules/simple.html ;-) 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