foldl :: MonadPlus m => (a -> b -> a) -> a -> m b -> m a
foldl step start fetch =
  loop start
  where
    loop !state =
      mplus
        (do
          !element <- fetch
          loop (step state element))
        (return state)


foldl :: MonadPlus m => (a -> b -> a) -> a -> m b -> m a
foldl step start fetch =
  loop start
  where
    loop !state =
      mplus
        (do
          !element <- fetch
          loop (step state element))
        (return state)


foldl step start fetch =
  loop start
  where
    loop !state =
      mplus
        (do
          !element <- fetch
          loop (step state element))
        (return state)

