Folding, function composition, monads, and laziness, oh my?
问题 I am puzzled. I can write this: import Control.Monad main = print $ head $ (foldr (.) id [f, g]) [3] where f = (1:) g = undefined and the output is 1 . That makes sense, because it reduces to: main = print $ head $ ((1:) . undefined . id) [3] main = print $ head $ (1:) ((undefined . id) [3]) main = print $ head $ 1 : ((undefined . id) [3]) main = print $ 1 But if I use a vaguely similar monadic technique, it doesn't work the same: import Control.Monad main = print $ (foldr (<=<) return [f, g]