From 0932e85ef83d76247259ec8d2f49f5fcfba863cc Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 1 Mar 1999 08:16:28 +0000 Subject: [PATCH] [project @ 1999-03-01 08:16:28 by sof] - added showListWith, non-overloaded version of showList. --- ghc/lib/exts/NumExts.lhs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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} -- 1.7.10.4