Here's an excerpt of a domain-specific file-IO function I'm writing:
let
cp :: FilePath -> IO ()
cp "." = putStr "" -- OUCH!
cp ".." = putStr "" -- CRIKEY!
cp fname = custom logic here...
in mapM_ cp filepaths
I understand mapM_
lets us drop/ignore all IO ()
results, so I'd like a cleaner alternative to putStr ""
--- ie. Haskell's "canonical" way to write "a type-correct no-op IO (or monad) expression that does nothing".
From my newbie reading I had undefined
in mind, and while this compiles and causes no issues, it gives an unwanted stdout print main.hs: Prelude.undefined
(I use stack runghc main.hs
as the sole coding environment here --- it's just sufficient for this, but the above code will be looping recursively through directory trees: so would be a good time to (re)learn about a better, or rather "the proper" way).