From: sof Date: Mon, 1 Mar 1999 08:16:28 +0000 (+0000) Subject: [project @ 1999-03-01 08:16:28 by sof] X-Git-Tag: Approximately_9120_patches~6500 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0932e85ef83d76247259ec8d2f49f5fcfba863cc;p=ghc-hetmet.git [project @ 1999-03-01 08:16:28 by sof] - added showListWith, non-overloaded version of showList. --- diff --git a/ghc/lib/exts/NumExts.lhs b/ghc/lib/exts/NumExts.lhs index 77968f4..a229481 100644 --- a/ghc/lib/exts/NumExts.lhs +++ b/ghc/lib/exts/NumExts.lhs @@ -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}