Haskell: function composition has just damaged my brain

Viewed 386

If

*Main> :t concatMap
concatMap :: (a -> [b]) -> [a] -> [b]

and

*Main> :t replicate
replicate :: Int -> a -> [a]

then how does that work

*Main> :t concatMap . replicate
concatMap . replicate :: Int -> [b] -> [b]

given:

*Main> :t (.)
(.) :: (b -> c) -> (a -> b) -> a -> c

?

I mean, my understanding of function composition is that replicate should return whatever concatMap expects as arguments in order for (.) to work. But it does not LOOK to be the case. So what is the catch?

2 Answers
Related