"Niklas Broberg" <[EMAIL PROTECTED]> writes: > Taking Lava, a hardware description language, as my example, I would argue > that many users of Lava don't really care if it's embedded in Haskell or > whereever it comes from, they would just use it. .... > > lavac Main.hs > > where lavac is could simply be a script alias of > ghc -fprelude-is Lava > > By using an explicit Lava compiler you declare that this is indeed a Lava > program, and you don't expect it to work in any other setting, in particular > not with a Haskell compiler like GHC. > > And in the same line of thinking, I would want a way of specifying suffixes > of input source files. It would be much neater to call your files Foo.lava > or similar, and be able to tell GHC to treat them as normal .hs files, i.e. > > lavac <== ghc -hssuf lava -fprelude-is Lava
Very intriguing ideas. However, I'm sure there are easier ways of implementing a 'lavac' (or other domain-specific compiler) than adding new flags to ghc (and by implication, to every other Haskell compiler as well). All you really need is to hook up a rather simple pre-processor. For instance, #!/bin/sh { echo 'module Main where\nimport Lava\n' ; cat $1 } >`basename $1 .lava`.hs If you want an automatic file association based on suffix, then something like hmake can do the mapping of .lava onto .hs via this little pre-processor script. This solution has the additional benefit that it is compiler-agnostic. Regards, Malcolm _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users