Can GHC simplify id = (\(a, b) -> (a, b)).(\(a, b) -> (a, b)) into id = \(a, b) -> (a, b)?
What about more complicated case :
id (Just x) = Just x
id Nothing = Nothing
map f (Just x) = Just (f x)
map _ Nothing = Nothing
Will GHC simplify id . map into map?
I tried to use plain beta reduction but it looks like these terms are irreducible because of the nasty pattern matching.
Therefore I am curious how do GHC's optimization techniques deal with that.