Hi all, I'm looking for a way to assert certain facts in Haskell modules. Is there a way to do this in Hugs? This would be a very nice feature; preferably with a command line switch to control whether assertions are actually run or not. ------------------------------------------------------ module Test where class Test t where f, g :: t -> t instance Test Int where f x = x test1, test2 :: Int test1 = f 3 -- 3 test2 = g 3 -- Program error: Undefined member: g -- this doesn't actually work in Hugs: --assert (test1 == 3) --assert (test2 == 3) ------------------------------------------------------ Thanks, Andreas. ------------------------------------------------------------------------ Andreas Gruenbacher gruenbacher@geoinfo.tuwien.ac.at Research Assistant Phone +43(1)58801-12723 Institute for Geoinformation Fax +43(1)58801-12799 Technical University of Vienna Cell phone +43(664)4064789
I'm looking for a way to assert certain facts in Haskell modules. Is there a way to do this in Hugs? This would be a very nice feature; preferably with a command line switch to control whether assertions are actually run or not.
This doesn't quite answer your question but... I strongly recommend looking at quickcheck http://www.cs.chalmers.se/~rjmh/QuickCheck/ which provides a lot of help in building good test-suites. If you want conditional compilation, you might also check out the -F <filter-program> feature in Hugs which lets you specify a preprocessor (such as cpp or perl) to use with your Haskell code. -- Alastair Reid
participants (2)
-
Alastair Reid -
Andreas Gruenbacher