Skip to content

Commit 4b8e618

Browse files
committed
No need for wander id in traversal code.
1 parent 7f47130 commit 4b8e618

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Data/Lens/Traversal.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ traversed = wander traverse
2828
traverseOf
2929
:: forall f s t a b. (Applicative f)
3030
=> Optic (Star f) s t a b -> (a -> f b) -> s -> f t
31-
traverseOf t f = runStar (t (Star f))
31+
traverseOf t = runStar <<< t <<< Star
3232

3333
-- | Sequence the foci of a `Traversal`, pulling out an `Applicative` effect.
3434
-- | If you do not need the result, see `sequenceOf_` for `Fold`s.
3535
sequenceOf
3636
:: forall f s t a. (Applicative f)
3737
=> Optic (Star f) s t (f a) a -> s -> f t
38-
sequenceOf t = runStar $ wander id $ t (Star id)
38+
sequenceOf t = traverseOf t id
3939

4040
-- | Tries to map over a `Traversal`; returns `empty`, if the traversal did
4141
-- | not have any new focus.
4242
failover
4343
:: forall f s t a b. (Alternative f)
4444
=> Optic (Star (Tuple (Disj Boolean))) s t a b -> (a -> b) -> s -> f t
45-
failover t f s = case runStar (wander id $ t $ Star $ Tuple (Disj true) <<< f) s of
45+
failover t f s = case runStar (t $ Star $ Tuple (Disj true) <<< f) s of
4646
Tuple (Disj true) x -> pure x
4747
Tuple (Disj false) _ -> empty

0 commit comments

Comments
 (0)