
13 Jul
2015
13 Jul
'15
7:45 a.m.
Hi Cafe, Every now and then I'm in a need to check if a value satisfies pattern with a Bool result. So far I know several ways to do this: 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` Usually I go for (1) because I use lens extensively anyway, but for one-time usage all the extra machinery seems too much. I don't like (2) when I don't have a library defining that for me, and also (3) -- they seem inelegant. Is there any syntactic trick that I'm missing that makes it look nicer? -- Nikolay.