Modifying a random String stored in the clipboard
main :: IO ()
main = traverse_ doNoise =&lt;&lt; getClipboardString where
 doNoise = setClipboardString &lt;=&lt; traverse randCap
 randCap x = bool id toUpper &lt;$&gt; (randomIO :: IO Bool) &lt;*&gt; pure x


Edit: Each change was arrived at through pattern-matching from my experience; compact code is usually easier to work with further. Looking at this again makes me think there ought to be a more lensy solution, one that fuses getting and setting, and indeed:

main = modifyClipboardString =&lt;&lt;
  zipWith (bool id toUpper) &lt;$&gt; getRandoms


We are fortunate to not actually need side effects depending on clipboard contents, but if we did, I would recommend writing a monadic variant of modifyClipboardString.