Report abuse

x :: Int
f :: Int -> Maybe Int
g :: Int -> Maybe Int

-- Task: evaluate g (f x) and abstract out Maybe.

case (f x) of
  Nothing -> Nothing
  Just y -> case (g y) of
              Nothing -> Nothing
              Just z -> z

-- equiv to

f x >>= \y ->
g y >>= \z ->
return z

-- equiv to

do y <- f x
   z <- g y
   return z

-- equiv to

y x >>= g