
On 2014-04-21 18:55, Tom Ellis wrote:
(Since Carter asked for new proposals to be started in a separate thread I am reposting the contents of an earlier message with additions)
My (counter) proposal is that 'whenM' and 'ifM' *not* be added anywhere (under any names) because there is a completely generic alternative to these adhoc additions that warrants further investigation.
The executive summary is that instead of introducing another function 'unlessM' to be used like this
unlessM doesDirectoryExist path $ do putStrLn $ "Creating directory " ++ path createDirectory path
we just use the existing 'unless' and a new generic combinator (<*>|) like this
unless <$> doesDirectoryExist path <*>| pure (do putStrLn $ "Creating directory " ++ path createDirectory path)
-1, completely ignores the pedagogic aspects of the original proposal.