[Haskell-cafe] embedded build language?

Greg Fitzgerald garious at gmail.com
Fri Jun 15 17:13:18 EDT 2007


Tomek,

> If you want to see the code I will try to release it
I'm very interested.

Thanks,
Greg


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


More information about the Haskell-Cafe mailing list