Skip to content

Commit 0edb822

Browse files
author
Martin Bidlingmaier
committed
Inline ValueWithIndex type synonym
1 parent 7ba6690 commit 0edb822

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Data/FoldableWithIndex.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module Data.FoldableWithIndex
1010
, surroundMapWithIndex
1111
, allWithIndex
1212
, anyWithIndex
13-
, ValueWithIndex
1413
, findWithIndex
1514
) where
1615

@@ -260,19 +259,20 @@ anyWithIndex
260259
-> b
261260
anyWithIndex t = unwrap <<< foldMapWithIndex (\i -> Disj <<< t i)
262261

263-
-- | Isomorphic to `Tuple i a`.
264-
type ValueWithIndex i a = { index :: i, value :: a }
265-
266262
-- | Try to find an element in a data structure which satisfies a predicate
267263
-- | with access to the index.
268264
findWithIndex
269265
:: forall i a f
270266
. FoldableWithIndex i f
271267
=> (i -> a -> Boolean)
272268
-> f a
273-
-> Maybe (ValueWithIndex i a)
269+
-> Maybe { index :: i, value :: a}
274270
findWithIndex p = foldlWithIndex go Nothing
275271
where
276-
go :: i -> Maybe (ValueWithIndex i a) -> a -> Maybe (ValueWithIndex i a)
272+
go
273+
:: i
274+
-> Maybe { index :: i, value :: a}
275+
-> a
276+
-> Maybe { index :: i, value :: a}
277277
go i Nothing x | p i x = Just { index: i, value: x}
278278
go _ r _ = r

0 commit comments

Comments
 (0)