@@ -737,8 +737,8 @@ instance Semigroup (FromMaybe a) where
737
737
This is compatible with van Laarhoven optics as defined in the lens package.
738
738
Any Lens, Fold1 or Traversal1 will type-check as a `Handler1`.
739
739
-}
740
- type Handler1 a b =
741
- forall x . (b -> Const (Dual (FromMaybe x )) b ) -> a -> Const (Dual (FromMaybe x )) a
740
+ type Handler1 s a =
741
+ forall x . (a -> Const (Dual (FromMaybe x )) a ) -> s -> Const (Dual (FromMaybe x )) s
742
742
743
743
{-| @(handles t folder)@ transforms the input of a `Fold1` using a Lens,
744
744
Traversal1, or Fold1 optic:
@@ -761,13 +761,13 @@ type Handler1 a b =
761
761
>
762
762
> handles t (f <*> x) = handles t f <*> handles t x
763
763
-}
764
- handles :: forall a b r . Handler1 a b -> Fold1 b r -> Fold1 a r
764
+ handles :: forall s a r . Handler1 s a -> Fold1 a r -> Fold1 s r
765
765
handles k (Fold1_ begin step done) = Fold1_ begin' step' done
766
766
where
767
- begin' = stepAfromMaybe Nothing
768
- step' x = stepAfromMaybe (Just $! x)
769
- stepAfromMaybe = flip (appFromMaybe . getDual . getConst . k (Const . Dual . FromMaybe . flip stepBfromMaybe ))
770
- stepBfromMaybe = maybe begin step
767
+ begin' = stepSfromMaybe Nothing
768
+ step' x = stepSfromMaybe (Just $! x)
769
+ stepSfromMaybe = flip (appFromMaybe . getDual . getConst . k (Const . Dual . FromMaybe . flip stepAfromMaybe ))
770
+ stepAfromMaybe = maybe begin step
771
771
{-# INLINABLE handles #-}
772
772
773
773
{- | @(foldOver f folder xs)@ folds all values from a Lens, Traversal1 or Fold1 optic with the given folder
@@ -782,7 +782,7 @@ handles k (Fold1_ begin step done) = Fold1_ begin' step' done
782
782
> Foldl1.foldOver folded1 == Foldl1.fold1
783
783
784
784
-}
785
- foldOver :: Handler1 s a -> Fold1 a b -> s -> b
785
+ foldOver :: Handler1 s a -> Fold1 a r -> s -> r
786
786
foldOver l (Fold1_ begin step done) =
787
787
done . stepSfromMaybe Nothing
788
788
where
@@ -805,8 +805,8 @@ instance Monad m => Semigroup (FromMaybeM m a) where
805
805
This is compatible with van Laarhoven optics as defined in the lens package.
806
806
Any Lens, Fold1 or Traversal1 will type-check as a `HandlerM1`
807
807
-}
808
- type HandlerM1 m a b =
809
- forall x . (b -> Const (Dual (FromMaybeM m x )) b ) -> a -> Const (Dual (FromMaybeM m x )) a
808
+ type HandlerM1 m s a =
809
+ forall x . (a -> Const (Dual (FromMaybeM m x )) a ) -> s -> Const (Dual (FromMaybeM m x )) s
810
810
811
811
{-| @(handlesM t folder)@ transforms the input of a `FoldM1` using a Lens,
812
812
Traversal1 or Fold1 optic:
@@ -825,13 +825,13 @@ type HandlerM1 m a b =
825
825
>
826
826
> handlesM t (f <*> x) = handlesM t f <*> handlesM t x
827
827
-}
828
- handlesM :: Monad m => HandlerM1 m a b -> FoldM1 m b r -> FoldM1 m a r
828
+ handlesM :: Monad m => HandlerM1 m s a -> FoldM1 m a r -> FoldM1 m s r
829
829
handlesM k (FoldM1_ begin step done) = FoldM1_ begin' step' done
830
830
where
831
- begin' = stepMaybeA Nothing
832
- step' b = stepMaybeA (Just $! b)
833
- stepMaybeA = flip (appFromMaybeM . getDual . getConst . k (Const . Dual . FromMaybeM . flip stepMaybeB ))
834
- stepMaybeB = maybe begin step
831
+ begin' = stepMaybeS Nothing
832
+ step' b = stepMaybeS (Just $! b)
833
+ stepMaybeS = flip (appFromMaybeM . getDual . getConst . k (Const . Dual . FromMaybeM . flip stepMaybeA ))
834
+ stepMaybeA = maybe begin step
835
835
{-# INLINABLE handlesM #-}
836
836
837
837
{- | @(foldOverM f folder xs)@ folds all values from a Lens, Traversal1 or
@@ -842,8 +842,8 @@ handlesM k (FoldM1_ begin step done) = FoldM1_ begin' step' done
842
842
> Foldl1.foldOverM folded1 == Foldl1.foldM1
843
843
844
844
-}
845
- foldOverM :: Monad m => HandlerM1 m s a -> FoldM1 m a b -> s -> m b
846
- foldOverM l (FoldM1_ ( begin :: a -> m x ) ( step :: x -> a -> m x ) ( done :: x -> m b ) ) s = do
845
+ foldOverM :: Monad m => HandlerM1 m s a -> FoldM1 m a r -> s -> m r
846
+ foldOverM l (FoldM1_ begin step done) s = do
847
847
r <- stepMaybeS Nothing s
848
848
done r
849
849
where
0 commit comments