Re: [Haskell-cafe] Observations from ListLike

2007-09-18 Thread Ketil Malde
On Mon, 2007-09-17 at 14:37 -0500, John Goerzen wrote:

 * It would be really nice if QuickCheck supported I/O and some version
   of HUnit's TestLabel to generate hierarchical names when failures
   occur.

I've done this for testing IO (reading and writing files):

 prop_serialize (E s) = 
let [s'] = unsafePerformIO (do writeFasta /tmp/serialize_test [s]
   readFasta /tmp/serialize_test)
in s == s'

I'm not sure if this is kosher, but at least the tests pass :-)

I (like everybody else?)'ve written a small driver for the tests, but
perhaps I should look at HUnit for a more general framework?

-k

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Observations from ListLike

2007-09-18 Thread Malcolm Wallace
John Goerzen [EMAIL PROTECTED] wrote:

 * Hugs programs that use cpphs can't use ByteString

This bug in cpphs was fixed already, several days ago.

 * It would be really nice if QuickCheck supported I/O

QuickCheckM gives you monadic test properties, as described in a Haskell
Workshop 2002 paper.
http://www.cs.chalmers.se/~rjmh/QuickCheck/

Regards,
Malcolm
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Observations from ListLike

2007-09-17 Thread John Goerzen
Hi folks,

I just announced ListLike[1] on [EMAIL PROTECTED]  Rather than repeat
that announcement here, I'd like to make a few observations that came
out of the development of this program:

* I wrote extensive QuickCheck cases for this and wrapped them in HUnit
  for better display and future extensibility.  Two bugs in the GHC
  base libraries were discovered as a result (one has been fixed
  already in HEAD, one not)

* Hugs programs that use cpphs can't use ByteString

* It would be really nice if QuickCheck supported I/O and some version
  of HUnit's TestLabel to generate hierarchical names when failures
  occur.

* It would also be much nicer if QuickCheck defined Arbitrary instances
  for Word8 and Char.  On Hugs, QuickCheck also lacks an instance of
  Maybe, but GHC has it for some reason.

* Testing functions like foldl in Hugs, where QuickCheck is supplying
  the list and the function, cause Hugs to crash with stack errors.
  Testing some functions over ByteStrings cause Hugs to crash
  complaining of being out of ForeignPtrs.  I have yet to figure out how
  to fix either problem; raising the heap size doesn't help.

* I had some cases in String.hs[2] where Hugs did not permit me to 
  define the default functions within the class declaration.  However,
  I could define the functions outside, with the exact same type
  signature as they'd have inside, and within the class declaration,
  just say something like words = myWords to refer to the external
  declaration.  GHC worked fine both ways.

It seems that Hugs has a number of issues with code like ListLike that
uses some more advanced Haskell features, even though Hugs nominally
supports them.  If you look through my Mercurial changelogs, you'll see
fix blah for hugs messages all over.  Which is too bad, because Hugs
seems more portable (especially to embedded devices) than GHC.

[1] http://software.complete.org/listlike
[2] http://software.complete.org/listlike/browser/src/Data/ListLike/String.hs

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe