Is there a typeclass which abstracts the filter function?
I am thinking about something like
class Filterable t where
  filter :: (a -> Bool) -> t a -> t a
If this isn't the case, is there an explicit reason for it?
Yes, the witherable package provides Filterable, with a handful of instances for common types.
There is mfilter method in Control.Monad (link)
mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With