I'm sorry if this is a stupid question, but the xmonad.hs doesn't
compile saying that "when" is out of scope. It seems to not
recognize the keyword "when." I tried "if" as well but then it tells
me there's a parse error. Are you sure that what you have compiles
for you?
"when" isn't a keyword; it's a function defined in Control.Monad. (Haskell's laziness means that many things that would have to be baked-in syntax in other languages can be written as functions, and its syntax means those functions behave as if they *were* baked into the language.) So all you should need to do is add
import Control.Monad (when)
up with the other import statements.
--