Tomek,<br><br>> If you want to see the code I will try to release it<br>I'm very interested.<br><br>Thanks,<br>Greg<br><br><br><div><span class="gmail_quote">On 6/15/07, <b class="gmail_sendername">Tomasz Zielonka</b>
<<a href="mailto:tomasz.zielonka@gmail.com">tomasz.zielonka@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu, Jun 14, 2007 at 05:55:46PM -0700, Greg Fitzgerald wrote:<br>> Has anyone embedded a build language in Haskell? Something like<br>> Rake<<a href="http://rake.rubyforge.org/">http://rake.rubyforge.org/</a>
>is to Ruby, but in Haskell or any<br>> statically-typed functional language.<br><br>I have. It consists of such components:<br><br>- A type for build rules<br><br> type Rule = FilePath -> Maybe (BuildMonad (IO ()))
<br><br> newtype BuildMonad a =<br> BuildMonad { runBuildMonad :: WriterT [FilePath] IO a }<br> deriving (Monad, MonadWriter [FilePath])<br><br> Every rule has three levels:<br> - matching target file names :: FilePath -> Maybe a
<br> - generating dependencies :: WriterT [FilePath] m a<br> - target building :: IO ()<br> The levels are nested in a way that allows to use variables bound on<br> one level in the levels below.
<br><br>- An simple rule execution engine - takes a list of rules and<br> tries to build given targets taking care of dependencies<br><br>- A small library of useful functions, eg. for using temporary files<br> with automatic renaming on successful completion (so you don't
<br> end up with partially built targets).<br><br>- A small Template Haskell library for Perl-like string interpolation<br> to help constructing shell commands<br><br>If you want to see the code I will try to release it (it's in a
<br>company's project), but it's quite small and IMHO the nicest thing in it<br>is the overall idea. It's quite heavy for simple uses, but in<br>more complicated cases it allows things which are nearly (or literally)
<br>impossible in GNU make.<br><br>Best regards<br>Tomek<br></blockquote></div><br>