{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeApplications #-} module DocTest01 (main) where import Data.Tuple.Classes (uncurriedN') #if defined(LENS) import Control.Lens (over) #else import Lens.Micro (over) #endif -- Function wrapper that expects a unary function printArgAndRun :: (Show a) => (a -> IO b) -> a -> IO b printArgAndRun f x = do print x f x -- But we have a ternary function printTitleAndSum :: String -> Int -> Int -> IO () printTitleAndSum title i j = do putStrLn title print $ i + j -- We can adapt it printArgsTitleAndSum :: String -> Int -> Int -> IO () printArgsTitleAndSum = over (uncurriedN' @3) printArgAndRun printTitleAndSum main :: IO () main = printArgsTitleAndSum "Important identity" 26885 15184