
Thanks for quick reply Roman (and sorry for my slow reply - I was AFK for the weekend).
That's a plausible explanations. File handles are closed when the ValueGetter monad is run. Try to add something like
Control.Exception.evaluate $ Control.DeepSeq.force cmpResult
to your comparison function. Yes, that works. I wonder why no one stumbled upon this problem before.
if your test files are under 'test/' subdirectory of your project's main directory, and you want to run the test suite from your project's main directory, then your paths must look like "test/...". Oh, right. I couldn't get this right because I set wrong CWD for the GHC process.
First off, you don't have to do that (unless you have some special needs — if so, what are they?). No, I don't have any special needs. It's just that my cmp function has to cover all possible cases - including when the file loading function returns Left - so I figured out I can handle the potential error there and have my own error message. But that's not really necessary, which means I can get rid of my custom cgReadFile altogether and use (fmap Right $ vgReadFile path).
Once again thank you. Janek