[xmonad] Support literate Haskell config files?

gwern0 at gmail.com gwern0 at gmail.com
Wed Feb 6 21:54:40 EST 2008

Someone on #xmonad was asking today whether he could make his .xmonad/xmonad.hs a literate file; without thinking, I told him, sure, why not?

Then it occurred to me that what I was thinking of was how you could execute 'runhaskell Setup configure', regardless of whether it was Setup.lhs or Setup.hs, and that that wouldn't work because Core.hs matches on xmonad.hs, not lhs.

It seems to me that it's not a bad idea to let users keep their config file in literate haskell if they want. It's a simple enough change - runProcess is already dragging in the shell, so a glob is enough:

> hunk ./XMonad/Core.hs 372
> -            waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-no-recomp", "-v0", "-o",binn] (Just dir)
> +            waitForProcess =<< runProcess "ghc" ["--make", "xmonad.*hs", "-i", > "-no-recomp", "-v0", "-o",binn] (Just dir)

(It'd be better to match on a single character, but I don't think "xmonad.hs xmonad.lhs" would work - GHC would complain about duplicate mains if both are there, or about a missing file if only one; xmonad.?hs wouldn't work, as this wouldn't match xmonad.lhs; xmonad.[l]hs likewise only matches xmonad.lhs and not xmonad.hs. xmonad.{,l}hs would work under Bash and Zsh, but if you try through /bin/sh or something like Dash, it fails - brace expansions are a possible future addition, but they are not in POSIX yet. So xmonad.*hs it is.)

Alex KEDO Security Club WSP E.O.D. - the Hercules fissionable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080206/240a6821/attachment.bin

More information about the xmonad mailing list