File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -760,6 +760,6 @@ transpose ((x : xs) : xss) =
760760-- ------------------------------------------------------------------------------
761761
762762-- | Perform a fold using a monadic step function.
763- foldM :: forall m a b . Monad m => (a -> b -> m a ) -> a -> List b -> m a
764- foldM _ a Nil = pure a
765- foldM f a (b : bs ) = f a b >>= \a ' -> foldM f a' bs
763+ foldM :: forall m a b . Monad m => (b -> a -> m b ) -> b -> List a -> m b
764+ foldM _ b Nil = pure b
765+ foldM f b (a : as ) = f b a >>= \b ' -> foldM f b' as
Original file line number Diff line number Diff line change @@ -727,12 +727,12 @@ transpose xs =
727727-- ------------------------------------------------------------------------------
728728
729729-- | Perform a fold using a monadic step function.
730- foldM :: forall m a b . Monad m => (a -> b -> m a ) -> a -> List b -> m a
731- foldM f a xs =
730+ foldM :: forall m a b . Monad m => (b -> a -> m b ) -> b -> List a -> m b
731+ foldM f b xs =
732732 case uncons xs of
733- Nothing -> pure a
734- Just { head: b , tail: bs } ->
735- f a b >>= \a ' -> foldM f a' bs
733+ Nothing -> pure b
734+ Just { head: a , tail: as } ->
735+ f b a >>= \b ' -> foldM f b' as
736736
737737-- | Perform a right fold lazily
738738foldrLazy :: forall a b . Z.Lazy b => (a -> b -> b ) -> b -> List a -> b
Original file line number Diff line number Diff line change @@ -299,5 +299,5 @@ zip = zipWith Tuple
299299unzip :: forall a b . NonEmptyList (Tuple a b ) -> Tuple (NonEmptyList a ) (NonEmptyList b )
300300unzip ts = Tuple (map fst ts) (map snd ts)
301301
302- foldM :: forall m a b . Monad m => (a -> b -> m a ) -> a -> NonEmptyList b -> m a
303- foldM f a (NonEmptyList (b :| bs )) = f a b >>= \a ' -> L .foldM f a' bs
302+ foldM :: forall m a b . Monad m => (b -> a -> m b ) -> b -> NonEmptyList a -> m b
303+ foldM f b (NonEmptyList (a :| as )) = f b a >>= \b ' -> L .foldM f b' as
You can’t perform that action at this time.
0 commit comments