data Strict a = Strict !a deriving (Show) instance Functor Strict where -- A lawful instance would have ~(Strict a) fmap f (Strict a) = Strict (f a) -- Before optimization: fun0 :: Functor f => f a -> f Int fun0 = fmap (const 7) . fmap (const undefined) -- After optimization: fun1 :: Functor f => f a -> f Int fun1 = fmap (const 7 . const undefined) -- Compare fun0 vs. fun1: main = print $ fun0 (Strict 5)