mapM' :: (Monad' m) => (a -> m b ) -> [a]  -> m [b]
mapM' a_to_mb  = foldr binary_fn (return' [])
  where
    binary_fn a mlb =
       bind'' (a_to_mb a) (\x ->
       bind'' mlb (\lb ->
       return'  (x : lb) ))

-- mb ---       bind' (\b -> do some stuff here) mb
-- mlb ---      bind' (\lb -> do some stuff with [b] here) mlb

-- Exercise 15
-- Relative Difficulty: 6
-- (bonus: use moppy)
-- (bonus: use forM)
mapM' :: (Monad' m) => (a -> m b ) -> [a]  -> m [b]
mapM' a_to_mb  = foldr binary_fn (return' [])
  where
    binary_fn a mlb =
       bind'' (a_to_mb a) (\x ->
       bind'' mlb (\lb ->
       return'  (x : lb) ))

-- mb ---       bind' (\b -> do some stuff here) mb
-- mlb ---      bind' (\lb -> do some stuff with [b] here) mlb

-- Exercise 15
-- Relative Difficulty: 6
-- (bonus: use moppy)
-- (bonus: use forM)
mapM' a_to_mb  = foldr binary_fn (return' [])
  where
    binary_fn a mlb =
       bind'' (a_to_mb a) (\x ->
       bind'' mlb (\lb ->
       return'  (x : lb) ))

-- mb ---       bind' (\b -> do some stuff here) mb
-- mlb ---      bind' (\lb -> do some stuff with [b] here) mlb

-- Exercise 15
-- Relative Difficulty: 6
-- (bonus: use moppy)
-- (bonus: use forM)