[xmonad] How do you test ManageHook using QuickCheck?
linusarver at gmail.com
Sun Feb 5 19:00:43 CET 2012
On Sun, Feb 05, 2012 at 05:46:50AM +0100, Takafumi Arakaki wrote:
> doesn't have required field. I am not a haskell programmer, so maybe
> I am doing something wrong.
Um, you are putting the cart before the horse. Yes, you don't have to
really know Haskell and get away with small hacks to your xmonad config,
but what you're doing is not just a small hack... it's a fairly
substantial undertaking. So, learn some real Haskell first.
That said, here's some feedback on your question...
I've only used QuickCheck with pure functions before, sorry.
> I once experienced xmonad halted because of a zero-division error I
> had in my ManageHooks. That's why I want to test it before putting in
> my xmonad.hs.
You should separate out the pure computations out of your managehook
stuff and then use QuickCheck on those functions. A zero-division error
sounds like it's from your own code (if not, then you should contact the
maintainer(s) of the libraries in question and send a bug report).
> prop_manage_hook :: XConf -> XState -> ManageHook -> Property
Also, isn't your code sample missing a Arbitrary typeclass instance? And
Property should be PropertyM. Seeing how you've missed these glaring
errors, I take it that you do not understand what monads are, and am
compelled to reiterate that you should learn Haskell first...
More information about the xmonad