f :: (Monad m) => (String -> Int -> String -> m ()) -> [String] -> m () f _ (x:_) = f2 Nothing x where f2 :: (Maybe Int) -> String -> m () -- when I comment this line, -- the code compiles f2 _ _ = return () main = undefined