[project @ 2002-04-24 16:31:37 by simonmar]
[packages/base.git] / Text / Show.hs
1 {-# OPTIONS -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
3 -- |
4 -- Module : Text.Show
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/core/LICENSE)
7 --
8 -- Maintainer : libraries@haskell.org
9 -- Stability : provisional
10 -- Portability : portable
11 --
12 -- $Id: Show.hs,v 1.3 2002/04/24 16:31:46 simonmar Exp $
13 --
14 -- The Show class and associated functions.
15 --
16 -----------------------------------------------------------------------------
17
18 module Text.Show (
19 ShowS, -- String -> String
20 Show(
21 showsPrec, -- :: Int -> a -> ShowS
22 show, -- :: a -> String
23 showList -- :: [a] -> ShowS
24 ),
25 shows, -- :: (Show a) => a -> ShowS
26 showChar, -- :: Char -> ShowS
27 showString, -- :: String -> ShowS
28 showParen, -- :: Bool -> ShowS -> ShowS
29 showListWith, -- :: (a -> ShowS) -> [a] -> ShowS
30 ) where
31
32 #ifdef __GLASGOW_HASKELL__
33 import GHC.Show
34 #endif
35
36 #ifdef __GLASGOW_HASKELL__
37 showListWith :: (a -> ShowS) -> [a] -> ShowS
38 showListWith = showList__
39 #else
40 showList__ :: (a -> ShowS) -> [a] -> ShowS
41 showList__ _ [] s = "[]" ++ s
42 showList__ showx (x:xs) s = '[' : showx x (showl xs)
43 where
44 showl [] = ']' : s
45 showl (y:ys) = ',' : showx y (showl ys)
46 #endif