Skip to content

Commit bc9bfd0

Browse files
authored
Merge pull request #48 from Roxxik/indexed-type-synonyms2
Use Type Synonyms in Data.Lens.Indexed
2 parents 163fac5 + 0510377 commit bc9bfd0

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Data/Lens/Indexed.purs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Prelude
55
import Control.Monad.State (modify, get, evalState)
66

77
import Data.Functor.Compose (Compose(..))
8-
import Data.Lens.Types (class Wander, wander, IndexedOptic, Traversal, Optic, Indexed(..))
8+
import Data.Lens.Types (wander, Optic, IndexedOptic, Indexed(..), Traversal, IndexedTraversal)
99
import Data.Newtype (unwrap)
1010
import Data.Profunctor (class Profunctor, dimap)
1111
import Data.Profunctor.Star (Star(..))
@@ -28,20 +28,17 @@ asIndex l = l <<< Indexed <<< dimap fst id
2828

2929
-- | Converts a `lens`-like indexed traversal to an `IndexedTraversal`.
3030
iwander
31-
:: forall p i s t a b
32-
. Wander p
33-
=> (forall f. Applicative f => (i -> a -> f b) -> s -> f t)
34-
-> Indexed p i a b
35-
-> p s t
31+
:: forall i s t a b
32+
. (forall f. Applicative f => (i -> a -> f b) -> s -> f t)
33+
-> IndexedTraversal i s t a b
3634
iwander itr = wander (\f s -> itr (curry f) s) <<< unwrap
3735

3836
-- | Converts a `Traversal` to an `IndexedTraversal` by using the integer
3937
-- | positions as indices.
4038
positions
41-
:: forall p s t a b
42-
. Wander p
43-
=> Traversal s t a b
44-
-> IndexedOptic p Int s t a b
39+
:: forall s t a b
40+
. Traversal s t a b
41+
-> IndexedTraversal Int s t a b
4542
positions tr =
4643
iwander \f s ->
4744
flip evalState 0 $ unwrap $ flip unwrap s $ tr $ Star \a ->

0 commit comments

Comments
 (0)