[Hat] reading negative Doubles
Malcolm Wallace
hat@haskell.org
Wed, 17 Jul 2002 17:43:43 +0100
Amanda Clare <ajc99@aber.ac.uk> writes:
> Is it possible that the instance of "read" for Doubles when using hat
> can't handle negative numbers? I get "Error: Prelude.read: no parse"
> whenever I have a negative number to read. My program works fine without
> hat.
Indeed. This fault is because we took the code directly from the
(incorrect) Haskell Report!
Here's a patch.
Regards,
Malcolm
Index: src/hat/lib/PreludeBasic.hs
===================================================================
RCS file: /usr/src/master/nhc/src/hat/lib/PreludeBasic.hs,v
retrieving revision 1.12
diff -u -r1.12 src/hat/lib/PreludeBasic.hs
--- src/hat/lib/PreludeBasic.hs 2002/05/03 15:22:36 1.12
+++ src/hat/lib/PreludeBasic.hs 2002/07/17 16:40:13
@@ -1940,7 +1940,7 @@
instance Read Float where
- readsPrec p = readFloat
+ readsPrec p = readSigned readFloat
instance Show Double where
@@ -1948,7 +1948,7 @@
instance Read Double where
- readsPrec p = readFloat
+ readsPrec p = readSigned readFloat
instance Show () where