
Hi, Am Donnerstag, den 03.07.2008, 11:35 -0700 schrieb David Roundy:
On Thu, Jul 03, 2008 at 07:09:58PM +0100, ChrisK wrote:
Joachim Breitner wrote: You are violating the monad laws. (f >> k) and (f >>= \_ -> k) should do the same thing. You might write a version of liftIO that has the effect you want, however.
I don't mind a little anarchy in the monad laws... :)
It depends on what level you want them to be true. Assuming the rest of the code is correct, the only difference that (f >> k) from (f >>= \_ -> k) is that a file write in k, which would make no difference, would be omitted. In this sense, the monad laws are followed.
I must say that I prefer the automatic computation of dependencies as outlined by Joachim.
Thanks!
Of course, to create a "make" replacement, you'd also have to be able to call external programs and track which files they use, which is a hard problem, particularly as which files they use may depend on the contents of the files that they use. One could, however, lift calls to well-behaved external programs (e.g. those like ghc or gcc that can output their dependencies) into this sort of monad.
That’s easily possible with a custom sourceAction, which allows you to set the action, and the time stamp detection independently. Greetings, Joachim -- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org