@@ -14,11 +14,12 @@ import Data.Unit (unit)
1414import Control.Category ((<<<), id )
1515import Control.Applicative (class Applicative , pure )
1616import Data.Monoid (class Monoid , mempty )
17- import Data.Identity (Identity (..), runIdentity )
17+ import Data.Identity (Identity (..))
1818import Data.Filterable (class Filterable , partitioned , filtered )
1919import Data.Functor (map )
2020import Data.Either (Either (..))
2121import Data.Maybe (Maybe (..))
22+ import Data.Newtype (unwrap )
2223import Data.Traversable (class Traversable , traverse )
2324
2425-- | `Witherable` represents data structures which can be _partitioned_ with
@@ -55,12 +56,12 @@ class (Filterable t, Traversable t) <= Witherable t where
5556-- | A default implementation of `parititonMap` given a `Witherable`.
5657partitionMapByWilt :: forall t a l r . Witherable t =>
5758 (a -> Either l r ) -> t a -> { left :: t l , right :: t r }
58- partitionMapByWilt p = runIdentity <<< wilt (Identity <<< p)
59+ partitionMapByWilt p = unwrap <<< wilt (Identity <<< p)
5960
6061-- | A default implementation of `filterMap` given a `Witherable`.
6162filterMapByWither :: forall t a b . Witherable t =>
6263 (a -> Maybe b ) -> t a -> t b
63- filterMapByWither p = runIdentity <<< wither (Identity <<< p)
64+ filterMapByWither p = unwrap <<< wither (Identity <<< p)
6465
6566-- | A default implementation of `traverse` given a `Witherable`.
6667traverseByWither :: forall t m a b . (Witherable t , Applicative m ) =>
0 commit comments