[Haskell-cafe] Best way to return Bool based on a successful pattern match?
silvio.frischi at gmail.com
Mon Jul 13 16:53:26 UTC 2015
> 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
+1 for readability
That's the problem with Haskell. You can do things in so many beautiful
and wondrous ways that you tend to get lost very easily.
More information about the Haskell-Cafe