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.