[xmonad] Support literate Haskell config files?

Spencer Janssen sjanssen at cse.unl.edu
Thu Feb 7 16:45:33 EST 2008


On Wed, Feb 06, 2008 at 09:54:40PM -0500, gwern0 at gmail.com wrote:
> 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.)
> 
> --
> gwern
> Alex KEDO Security Club WSP E.O.D. - the Hercules fissionable

Just summarizing discussion on IRC:  we manually check the mod time of
xmonad.hs, which means that we'd have to duplicate code to handle this
properly.  Additionally, we'd need to document all this .hs/.lhs duplication.
It doesn't seem worth it in the end.  Let's add a FAQ about this and call it
done.


Cheers,
Spencer Janssen


More information about the xmonad mailing list