pragmatic-show-0.1.1.0: Alternative Show class that gives shorter view if possible.

Copyright(c) Justus Sagemüller 2017
LicenseGPL v3
Maintainer(@) jsagemue $ uni-koeln.de
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Show.Pragmatic

Description

 

Synopsis

Documentation

class Show a where Source

A drop-in replacement for Show. The behaviour is mostly the same: the result of show should be valid Haskell code, and reading back such a value should give the original value – but, unlike in Show, we don't require this in an exact sense, i.e. read (show x) == x is not necessarily fulfilled.

Notably for floating-point values, we allow a slight deviation if it considerably shortens the shown representation: for example, 0.90000004 :: Float, which can easily come up as the result of a computation which should in principle be exactly 0.9, is shown as 0.9 instead. We do however not commit to any particular fixed precision; it depends on the type and the order of magnitude which amount of rounding is appropriate. See the test suite for some examples.

Minimal complete definition

showsPrec | show

Methods

showsPrec :: Int -> a -> ShowS Source

show :: a -> String Source

showList :: [a] -> ShowS Source

Instances

Show Bool Source 
Show Char Source 
Show Double Source 
Show Float Source 
Show Int Source 
Show Int8 Source 
Show Int16 Source 
Show Int32 Source 
Show Int64 Source 
Show Integer Source 
Show Ordering Source 
Show Word Source 
Show Word8 Source 
Show Word16 Source 
Show Word32 Source 
Show Word64 Source 
Show () Source 
Show Void Source 
Show Natural Source 
Show DataType Source 
Show Constr Source 
Show DataRep Source 
Show ConstrRep Source 
Show Fixity Source 
Show Version Source 
Show HandlePosn Source 
Show FdKey Source 
Show Event Source 
Show Lifetime Source 
Show IOMode Source 
Show PatternMatchFail Source 
Show RecSelError Source 
Show RecConError Source 
Show RecUpdError Source 
Show NoMethodError Source 
Show NonTermination Source 
Show NestedAtomically Source 
Show ThreadId Source 
Show BlockReason Source 
Show ThreadStatus Source 
Show CodingFailureMode Source 
Show CDev Source 
Show CIno Source 
Show CMode Source 
Show COff Source 
Show CPid Source 
Show CSsize Source 
Show CGid Source 
Show CNlink Source 
Show CUid Source 
Show CCc Source 
Show CSpeed Source 
Show CTcflag Source 
Show CRLim Source 
Show Fd Source 
Show BlockedIndefinitelyOnMVar Source 
Show BlockedIndefinitelyOnSTM Source 
Show Deadlock Source 
Show AllocationLimitExceeded Source 
Show AssertionFailed Source 
Show SomeAsyncException Source 
Show AsyncException Source 
Show ArrayException Source 
Show ExitCode Source 
Show IOErrorType Source 
Show Handle Source 
Show BufferMode Source 
Show Newline Source 
Show NewlineMode Source 
Show SeekMode Source 
Show TextEncoding Source 
Show CodingProgress Source 
Show WordPtr Source 
Show IntPtr Source 
Show CChar Source 
Show CSChar Source 
Show CUChar Source 
Show CShort Source 
Show CUShort Source 
Show CInt Source 
Show CUInt Source 
Show CLong Source 
Show CULong Source 
Show CLLong Source 
Show CULLong Source 
Show CFloat Source 
Show CDouble Source 
Show CPtrdiff Source 
Show CSize Source 
Show CWchar Source 
Show CSigAtomic Source 
Show CClock Source 
Show CTime Source 
Show CUSeconds Source 
Show CSUSeconds Source 
Show CIntPtr Source 
Show CUIntPtr Source 
Show CIntMax Source 
Show CUIntMax Source 
Show Dynamic Source 
Show MaskingState Source 
Show IOException Source 
Show ErrorCall Source 
Show ArithException Source 
Show All Source 
Show Any Source 
Show Fingerprint Source 
Show GeneralCategory Source 
Show Lexeme Source 
Show Number Source 
Show SomeException Source 
Show a => Show [a] Source 
(Integral i, Show i) => Show (Ratio i) Source 
(Show a, Show b) => Show (a, b) Source 
(Show a, Show b, Show c) => Show (a, b, c) Source 
(Show a, Show b, Show c, Show d) => Show (a, b, c, d) Source 

shows :: Show a => a -> ShowS Source

ltdPrecShowsPrec :: RealFloat n => Int -> Int -> n -> ShowS Source

ltdPrecShowsPrec prcn displays floating-point values with a precision of at least prcn digits. That does not mean it will necessarily display that many digits, rather it tries to always choose the shortest representation with the required precision.

print :: Show a => a -> IO () Source

Drop-in for the standard screen-displaying function. This is useful as a GHCi evaluation action; invoke with $ ghci -interactive-print=Text.Show.Pragmatic.print to get more concise output from the REPL.