[project @ 1999-03-01 08:16:28 by sof]
authorsof <unknown>
Mon, 1 Mar 1999 08:16:28 +0000 (08:16 +0000)
committersof <unknown>
Mon, 1 Mar 1999 08:16:28 +0000 (08:16 +0000)
- added showListWith, non-overloaded version of showList.

ghc/lib/exts/NumExts.lhs

index 77968f4..a229481 100644 (file)
@@ -21,6 +21,9 @@ module NumExts
                         -- -> (a -> Char)      -- digit to char
                         -- -> a                -- number to show.
                         -- -> ShowS
+       , showListWith    -- :: (a -> ShowS)
+                        -- -> [a]
+                        -- -> ShowS
        ) where
 
 import Char (ord, chr)
@@ -28,7 +31,7 @@ import Char (ord, chr)
 import PreludeBuiltin
 ord_0 = ord '0'
 #else
-import PrelBase (ord_0)
+import PrelBase (ord_0, showList__)
 import GlaExts
 #endif
 \end{code}
@@ -93,3 +96,13 @@ showBin n r =
  showIntAtBase 2 (toChrOct) n r
  where toChrOct d = chr (ord_0 + fromIntegral d)
 \end{code}
+
+Easy enough to define by the user, but since it's
+occasionally useful (when, say, printing out a 
+list of hex values), we define and export it
+from @NumExts@.
+
+\begin{code}
+showListWith :: (a -> ShowS) -> [a] -> ShowS 
+showListWith = showList__
+\end{code}