Yes, for standard data types like Either or Maybe the best way is to use
library-defined functions -- I was more interested in a way to check for
any given pattern, which would look nicer than a custom defined function
or a LambdaCase. An example use case:
partition (\case MyPat -> True; _ -> False)
Anyway using lens for this is already very readable and concise, albeit
needs makePrisms/Lens and stuff.
On 07/13/2015 03:02 PM, Nikita Karetnikov wrote:
> Looking at the instances defined for Bool and Either, I don't think
> there's a higher level way of doing it. But even if there's one, it'll
> probably be more obscure than isLeft, which is in base since 4.7.0.0.
>
--
Nikolay.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe