[Hat] hat error with HUnit: Variable not in scope:
`TPrelude.fnegate'
Malcolm Wallace
hat@haskell.org
Fri, 26 Jul 2002 10:51:52 +0100
Shae Matijs Erisson <shae@ScannedInAvian.com> writes:
> I'm using HUnit (http://hunit.sf.net/)
>
> /home/shae/src/haskell/libraries/THUnitText.hs:64:
> Variable not in scope: `TPrelude.fnegate'
The problem here is with hat-trans - in the following definition,
put line pers (-1) = do ...; return (-1)
it has mistakenly interpreted the negative number literal on the left
hand side as a variable binding for negate. Hence, in the transformed
version of the code, it has used the lambda-bound form `fnegate'
on the right, instead of the real let-bound variable `gnegate'.
Until we can find a fix for hat-trans, here is a workaround for your
application. Replace the negative numeric literal pattern with another
form, such as a guard. For instance:
--- HUnitText.lhs Thu Feb 21 20:21:13 2002
+++ HUnitText.lhs.new Fri Jul 26 10:43:40 2002
@@ -55,7 +55,8 @@
> putTextToHandle handle showProgress = PutText put initCnt
> where
> initCnt = if showProgress then 0 else -1
-> put line pers (-1) = do when pers (hPutStrLn handle line); return (-1)
+> put line pers cnt | cnt == (-1)
+> = do when pers (hPutStrLn handle line); return (-1)
> put line True cnt = do hPutStrLn handle (erase cnt ++ line); return 0
> put line False cnt = do hPutStr handle ('\r' : line); return (length line)
> -- The "erasing" strategy with a single '\r' relies on the fact that the
Regards,
Malcolm