
On Mon, Jan 06, 2014 at 09:25:25PM +1300, Chris Wong wrote:
You can use forward slashes in Windows as well.
It's worth clarifying this somewhat I think. I found this at http://is.gd/a5gCuk: Every version of Windows has accepted "/" as a path separator. So has every version of MS-DOS beginning with DOS 2.0 (the first version that had subdirectories). It's only been in command lines that "/" was not allowed, because it had already been used as a switch delimiter in MS-DOS 1.0. So as long as you keep away from stuff like System.Process.system you should be fine with ordinary slashes. /M
On Jan 6, 2014 9:13 PM, "Kees Bleijenberg"
wrote: 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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus@therning.org jabber: magnus@therning.org twitter: magthe http://therning.org/magnus Unreadable code, Why would anyone use it? Learn a better way. -- Geoff Kuenning's contribution to the 2004 Perl Haiku Contest, Haikus about Perl - 'Dishonerable Mention' winner