title: How Do I Make a Program Wait In Haskell
body: <p>I have a pretty small laptop screen, and I normally use my applications in a fullscreen/monocle layout. However this makes it difficult to remember where exactly my applications are in the stack, since I cant see them.</p>
  <p>To solve this problem, I would like to have xmonad automatically make a window go to the top of the stack after I have focused it for a certain amount of time. Kind of like how Android manages its applications.</p>
  <p>I am trying my best to accomplish this with the following hook. However I just don't know enough about haskell to make this work.</p>
  <pre class="lang-hs prettyprint-override"><code>hook :: Event -&gt; X All
  hook (AnyEvent {ev_event_type = et}) = do
    when (et == focusIn) $
          withWindowSet(\ws -&gt; 
             let focused = W.peek ws
             timeout 1000000
             if (focused == W.peek ws) then promote else ws 
          )
    return (All True)
  hook _ = return (All True)
  
  </code></pre>
  <p>I am a newbie at this, and I would really appreciate some suggestions, this has been bugging me for a while, and you'd really be doing me a favor. :D</p>