foo :: (() -> () -> [()] -> [()]) -> () -> [()] -> [()]
foo k =
  \_ xs -> concatMap ($ [head xs]) [bar]
 where
  bar =
    let k' = k undefined undefined
    in  \xs ->
          let k'' = [k' xs]
          in  (() : (foldr1 (>>) k''))
foo :: (() -> () -> [()] -> [()]) -> () -> [()] -> [()]
foo k =
  \_ xs -> concatMap ($ [head xs]) [bar]
 where
  bar =
    let k' = k undefined undefined
    in  \xs ->
          let k'' = [k' xs]
          in  (() : (foldr1 (>>) k''))
foo k =
  \_ xs -> concatMap ($ [head xs]) [bar]
 where
  bar =
    let k' = k undefined undefined
    in  \xs ->
          let k'' = [k' xs]
          in  (() : (foldr1 (>>) k''))