Assertions in Hugs

Andreas Gruenbacher
Tue, 6 Feb 2001 18:21:22 +0100 (CET)

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)



 Andreas Gruenbacher        
 Research Assistant                       Phone      +43(1)58801-12723
 Institute for Geoinformation             Fax        +43(1)58801-12799
 Technical University of Vienna           Cell phone   +43(664)4064789