when debug (putStrLn "Debugging")will output the string Debugging if the Boolean value debug is True, and otherwise do nothing.
>>> putStr "pi:" >> when False (print 3.14159) pi:
>>> map (\x -> applyWhen (odd x) (*2) x) [1..10] [2,2,6,4,10,6,14,8,18,10]
>>> map (\x -> applyWhen (length x > 6) ((++ "...") . take 3) x) ["Hi!", "This is amazing", "Hope you're doing well today!", ":D"] ["Hi!","Thi...","Hop...",":D"]