File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,25 @@ import Data.Profunctor.Choice
99import Data.Tuple
1010import Data.Either
1111
12+ import Data.Lens.Internal.Wander
13+
1214-- | Profunctor used for `IndexedOptic`s.
1315newtype Indexed p i s t = Indexed (p (Tuple i s ) t )
1416
1517-- | Unwrap a value of type `Indexed`.
1618fromIndexed :: forall p i s t . Indexed p i s t -> p (Tuple i s ) t
1719fromIndexed (Indexed p) = p
1820
19- instance indexedProfunctor :: (Profunctor p ) => Profunctor (Indexed p i ) where
21+ instance profunctorIndexed :: (Profunctor p ) => Profunctor (Indexed p i ) where
2022 dimap f g = Indexed <<< dimap (second f) g <<< fromIndexed
2123
22- instance indexedStrong :: (Strong p ) => Strong (Indexed p i ) where
24+ instance strongIndexed :: (Strong p ) => Strong (Indexed p i ) where
2325 first = Indexed <<< dimap (\(Tuple i (Tuple a c)) -> (Tuple (Tuple i a) c)) id <<< first <<< fromIndexed
2426 second = Indexed <<< dimap (\(Tuple i (Tuple c a)) -> (Tuple c (Tuple i a))) id <<< second <<< fromIndexed
2527
26- instance indexedChoice :: (Choice p ) => Choice (Indexed p i ) where
28+ instance choiceIndexed :: (Choice p ) => Choice (Indexed p i ) where
2729 left (Indexed p) = Indexed (dimap (\(Tuple i ac) -> either (Left <<< Tuple i) Right ac) id $ left p)
2830 right (Indexed p) = Indexed (dimap (\(Tuple i ac) -> either Left (Right <<< Tuple i) ac) id $ right p)
31+
32+ instance wanderIndexed :: (Wander p ) => Wander (Indexed p i ) where
33+ wander trav = Indexed <<< wander (\ia2fb (Tuple i s) -> trav (ia2fb <<< Tuple i) s) <<< fromIndexed
You can’t perform that action at this time.
0 commit comments