Adjust behaviour of gcd
[ghc-base.git] / Text / Show.hs
1 {-# LANGUAGE CPP, NoImplicitPrelude #-}
2
3 -----------------------------------------------------------------------------
4 -- |
5 -- Module      :  Text.Show
6 -- Copyright   :  (c) The University of Glasgow 2001
7 -- License     :  BSD-style (see the file libraries/base/LICENSE)
8 -- 
9 -- Maintainer  :  libraries@haskell.org
10 -- Stability   :  provisional
11 -- Portability :  portable
12 --
13 -- Converting values to readable strings:
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 -- | Show a list (using square brackets and commas), given a function
37 -- for showing elements.
38 showListWith :: (a -> ShowS) -> [a] -> ShowS
39 showListWith = showList__
40
41 #ifndef __GLASGOW_HASKELL__
42 showList__ :: (a -> ShowS) ->  [a] -> ShowS
43 showList__ _     []     s = "[]" ++ s
44 showList__ showx (x:xs) s = '[' : showx x (showl xs)
45   where
46     showl []     = ']' : s
47     showl (y:ys) = ',' : showx y (showl ys)
48 #endif