
Hi It's generally bad idea to include source code in this manner. It is error prone, hard to understand and ugly. It's really better to use modules instead. But if you *really* want to rely on such hacks, then yes, it's possible. Simply use cpp's #include. But first you need to enable CPP extension. One way of doing it is writing this line as the first line:
{-# LANGUAGE CPP #-}
With cpp in game you can then write:
#include "common.hs"
Best regards
Krzysztof Skrzętnicki
On Wed, Feb 10, 2010 at 12:17, Andrew Smith
Hi I have a few lines of Haskell which I'd like to be pulled into my Haskell program, similar to the #include in C/C++, or Latex.
I don't want to just paste the code permanently using editor, or pass it through say M4, nor build my own module.
At the moment its a couple of lines I've used in three or four similar programs.
As a Haskell beginner, is my thinking still stuck in the imperative coding style era ?
-- Andrew
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners