-#define ASSERT(e) if False then error "ASSERT" else
-#define ASSERT2(e,msg) if False then error "ASSERT2" else
-#define ASSERTM(e)
-#define ASSERTM2(e,msg)
-#define WARN(e,msg) if False then error "WARN" else
+#define debugIsOn False
+-- We have to actually use all the variables we are given or we may get
+-- unused variable warnings when DEBUG is off.
+#define ASSERT(e) if False && (not (e)) then panic "ASSERT" else
+#define ASSERT2(e,msg) if False && (not (e)) then pprPanic "ASSERT2" (msg) else
+#define MASSERT(e) ASSERT(e) return ()
+#define MASSERT2(e,msg) ASSERT2(e,msg) return ()
+#define ASSERTM(e) do { let { _mbool = (e) } }
+-- Here we deliberately don't use when as Control.Monad might not be imported
+#define ASSERTM2(e,msg) do { let { _mbool = (e) }; if False then panic "ASSERTM2" else return () }
+#define WARN(e,msg) if False && (e) then pprPanic "WARN" (msg) else