ZVON > References > Haskell reference
| Indexes | Syntax | >> Prelude << | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Module: Prelude
Class: Show
Instances: (), [a], Char, Double, Float, Int, Integer
Bibliography: The Read and Show Classes [ A Gentle Introduction to Haskell ]


class  Show a  where
    showsPrec        :: Int -> a -> ShowS
    show       :: a -> String 
    showList         :: [a] -> ShowS

-- Mimimal complete definition:
-- show or showsPrec
    showsPrec _ x s   = show x ++ s

    show x        = showsPrec 0 x ""

    showList []       = showString "[]"
    showList (x:xs)   = showChar '[' . shows x . showl xs
                        where showl []     = showChar ']'
                              showl (x:xs) = showChar ',' . shows x .
                                             showl xs



instance Show Int where

    showsPrec           = showSigned showInt

instance Show Integer where

    showsPrec           = showSigned showInt

instance Show Float where
 
    showsPrec p         = showFloat

instance Show Double where

    showsPrec p         = showFloat

instance Show () where

    showsPrec p () = showString "()"

instance Show Char where

    showsPrec p '\'' = showString "'\\''"
    showsPrec p c    = showChar '\'' . showLitChar c . showChar '\''

    showList cs = showChar '"' . showl cs
                 where showl ""       = showChar '"'
                       showl ('"':cs) = showString "\\\"" . showl cs
                       showl (c:cs)   = showLitChar c . showl cs

instance (Show a) => Show [a] where

    showsPrec p      = showList



_____________________________________________
Reference Search | Sitemap | XML Glossary       ZVON | Systinet




Related sites:
  • dotNet Slackers - Your latest resource for ASP.NET
  • Dotnet Spider - Outsourcing and Offshore software development in India
  • XML - Xselerator, XSL Editor, BizTalk Utilities, XML Tutorials, Learn XML
  • Planet Source Code - The largest public source code database on the Internet
answering service water softener MSN Alojamiento Web UNLIMITED Web Hosting by HostDepartment
VoIP Internettelefonie Hosted Exchange, SDSL VoIP Internettelefonie AT VoIP Internettelefonie DE