Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
expose WitherableWithIndex, FilterableWithIndex
  • Loading branch information
xgrommx committed Oct 17, 2019
commit f04e430740a1e29d3821d6b42dc698e4c9865e0c
19 changes: 19 additions & 0 deletions src/Data/Filterable.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ module Data.Filterable
, filterDefaultPartitionMap
, filterMapDefault
, cleared
, class FilterableWithIndex
, ipartitionMap
, ipartition
, ifilterMap
, ifilter
, ieitherBool
, ipartitionDefault
, ipartitionDefaultFilter
, ipartitionDefaultFilterMap
, ipartitionMapDefault
, imaybeBool
, ifilterDefault
, ifilterDefaultPartition
, ifilterDefaultPartitionMap
, ifilterMapDefault
, icleared
, module Data.Compactable
) where

Expand Down Expand Up @@ -61,6 +77,9 @@ ipartitionMapDefault p = separate <<< mapWithIndex p
ipartitionDefault :: forall f i a. FilterableWithIndex i f => (i -> a -> Boolean) -> f a -> { no :: f a, yes :: f a }
ipartitionDefault p xs = let o = ipartitionMap (ieitherBool p) xs in {no: o.left, yes: o.right}

ipartitionDefaultFilter :: forall f a i. FilterableWithIndex i f => (i -> a -> Boolean) -> f a -> { no :: f a, yes :: f a }
ipartitionDefaultFilter p xs = { yes: ifilter p xs, no: ifilter (not p) xs }

ifilterMapDefault :: forall f i a b. FilterableWithIndex i f => (i -> a -> Maybe b) -> f a -> f b
ifilterMapDefault p = compact <<< mapWithIndex p

Expand Down
10 changes: 10 additions & 0 deletions src/Data/Witherable.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ module Data.Witherable
, withered
, witherDefault
, wiltDefault
, class WitherableWithIndex
, iwilt
, iwither
, ipartitionMapByWilt
, ifilterMapByWither
, itraverseByWither
, iwilted
, iwithered
, iwitherDefault
, iwiltDefault
, module Data.Filterable
) where

Expand Down