Compactable doesn't require a Functor. In fact, some data types without a Functor instance can have a Compactable instance (e.g. Set).
Compactable provides compact and a method I'm currently calling separate. These are equivalent to Filterable's filtered and partitioned, respectively.
The intention with this PR is to make Compactable a superclass of Filterable.
The functions defined below the compactable instances are simply the result of adding constraints in the monad hierarchy (plus Traversable) and a few show up under different names in Filterable and Witherable with the following equivalences:
mapMaybe -> filterMap
mapEither -> partitionMap
traverseMaybe -> wither
traverseEither -> wilt
The functions that result from applying the other constraints (Apply and Bind) suggest other possible classes that could find a home in this library.
A port of https://hackage.haskell.org/package/Compactable-0.1.0.2/docs/Control-Compactable.html
Compactable
doesn't require aFunctor
. In fact, some data types without aFunctor
instance can have aCompactable
instance (e.g.Set
).Compactable
providescompact
and a method I'm currently callingseparate
. These are equivalent toFilterable
'sfiltered
andpartitioned
, respectively.The intention with this PR is to make
Compactable
a superclass ofFilterable
.The functions defined below the compactable instances are simply the result of adding constraints in the monad hierarchy (plus
Traversable
) and a few show up under different names inFilterable
andWitherable
with the following equivalences:mapMaybe
->filterMap
mapEither
->partitionMap
traverseMaybe
->wither
traverseEither
->wilt
The functions that result from applying the other constraints (Apply and Bind) suggest other possible classes that could find a home in this library.