Re: [Haskell-cafe] preprocessor, how to?

I don't quite understand why you can't just use pathSeparator (or >)
here. The code in the quotes is still Haskell, and it's going to
compile on the same platform it's going to run on, right?
Erik
On Mon, Jan 6, 2014 at 9:13 AM, Kees Bleijenberg
In a program I use a lot of hamlet files. All these hamlet files are in a submap of the source map. In code: allHtml = Mconcat [ $(hamletFile "hamlet\\belastingen.hamlet") renderUrl ,$(hamletFile "hamlet\\winddruk.hamlet") renderUrl .. ,$(hamletFile "hamlet\\berekeningDruk.hamlet") renderUrl ,$(hamletFile "hamlet\\drukNaarBuigTrek.hamlet") renderUrl] This is a Windows program.
For another project I want to use this piece of code on Linux. The code should now be: .. $(hamletFile "hamlet/winddruk.hamlet") renderUrl
I can't use pathSeparator here, because this is all happening at compile time. So I think I need a preprocessor. I would like to have a kind of hamletDir macro and change the code to something like:
#ifdef Win32 hamletDir = "hamlet\\" #else hamletDir = "hamlet/" #endif ... $(hamletFile "{hamletDir}winddruk.hamlet") renderUrl Is it possible in Haskell and how do I it?
All examples of preprocessing in Haskell I found are something like this: #ifdef xxx aaaa #else Bbbbb #endif I could use that. But a user defined macro is less code.
Kees
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (1)
-
Erik Hesselink