Package frege.prelude.PreludeText

Compiled: Wed Dec 05 00:00:06 PST 2012 from source file: frege/prelude/PreludeText.fr

Package Documentation

Classes and Instances to convert values to Strings (Show.show) and Strings to values (read).

There are a few differences to Haskell, notably

Table of Content

Imports

Type Aliases

type ReadS a = ReadS a

Haskell compatibility

type ShowS = ShowS

Haskell compatibility

Classes

class Show show

Class Show provides operations to convert values to Strings.

This class can be derived for all algebraic data types whose constituents are themselves instances of Show.

Known Instances

[], Maybe, Ordering, JException, Long, StringJ, Int, Either, Double, Float, (,,), Bool, (), (,), Char, Integer

Member Functions

display :: Show show => show -> String

Show.display computes an alternate string represantation of a value and is used in the Char and String instances of Show to produce an unquoted string.

The default implementation is to do the same as Show.show.

show :: Show show => show -> String

Computes the string representation of a value.

Every instance must implement Show.show.

showList :: Show show => [show] -> String -> String

Haskell compatibility

showsPrec :: Show show => Int -> show -> String -> String

Haskell compatibility

showsub :: Show show => show -> String

Show.showsub is used for Show.showing elements of a value of an allgebraic data type in derived instances of Show.

The generated code in derived instances for types that are not enumerations is

 showsub x = "(" ++ show x ++ ")"

so that values are enclosed in parentheses. Certain types like records, lists, tuples and many primitive types do not need extra parentheses, and thus Show.showsub is the same as Show.show, which is also the default implementation.

In short,

Example:

 derive Show ( Maybe b)

implements the following:

 show Nothing = "Nothing"
 show (Just x) = "Just " ++ x.showsub
 showsub x = "(" ++ show x ++ ")"

so that

 show (Just (Just 42)) == "Just (Just 42)"

Instances

instance Show ()

Member Functions

display :: () -> String

inherited from Show.display

show :: () -> String

Function generated for derived istance.

showList :: [()] -> String -> String

inherited from Show.showList

showsPrec :: Int -> () -> String -> String

inherited from Show.showsPrec

showsub :: () -> String

Function generated for derived istance.

instance Show (Show a, Show b) => (a, b)

Member Functions

display :: (Show α, Show β) => (α, β) -> String

inherited from Show.display

show :: (Show α, Show β) => (α, β) -> String

Function generated for derived istance.

showList :: (Show α, Show β) => [(α, β)] -> String -> String

inherited from Show.showList

showsPrec :: (Show α, Show β) => Int -> (α, β) -> String -> String

inherited from Show.showsPrec

showsub :: (Show α, Show β) => (α, β) -> String

Function generated for derived istance.

instance Show (Show b, Show a, Show c) => (a, b, c)

Member Functions

display :: (Show β, Show α, Show γ) => (α, β, γ) -> String

inherited from Show.display

show :: (Show β, Show α, Show γ) => (α, β, γ) -> String

Function generated for derived istance.

showList :: (Show β, Show α, Show γ) => [(α, β, γ)] -> String -> String

inherited from Show.showList

showsPrec :: (Show β, Show α, Show γ) => Int -> (α, β, γ) -> String -> String

inherited from Show.showsPrec

showsub :: (Show β, Show α, Show γ) => (α, β, γ) -> String

Function generated for derived istance.

instance Show Bool

Member Functions

display :: Bool -> String

inherited from Show.display

show :: Bool -> String
showList :: [Bool] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Bool -> String -> String

inherited from Show.showsPrec

showsub :: Bool -> String

inherited from Show.showsub

instance Show Char

Member Functions

display :: Char -> String

construct a string that consists of just this character

show :: Char -> String
pure native frege.RT.quoteChr

reconstructs a Java char literal from a character, i.e.

> show a = "a"

showList :: [Char] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Char -> String -> String

inherited from Show.showsPrec

showsub :: Char -> String

inherited from Show.showsub

instance Show Double

Member Functions

display :: Double -> String

inherited from Show.display

show :: Double -> String
pure native java.lang.Double.toString
showList :: [Double] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Double -> String -> String

inherited from Show.showsPrec

showsub :: Double -> String

inherited from Show.showsub

instance Show (Show a, Show b) => Either a b

Member Functions

display :: (Show α, Show β) => Either α β -> String

inherited from Show.display

show :: (Show α, Show β) => Either α β -> String

Function generated for derived istance.

showList :: (Show α, Show β) => [Either α β] -> String -> String

inherited from Show.showList

showsPrec :: (Show α, Show β) => Int -> Either α β -> String -> String

inherited from Show.showsPrec

showsub :: (Show α, Show β) => Either α β -> String

Function generated for derived istance.

instance Show Float

Member Functions

display :: Float -> String

inherited from Show.display

show :: Float -> String
pure native java.lang.Float.toString
showList :: [Float] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Float -> String -> String

inherited from Show.showsPrec

showsub :: Float -> String

inherited from Show.showsub

instance Show Int

Member Functions

display :: Int -> String

inherited from Show.display

show :: Int -> String
pure native java.lang.String.valueOf

the String representation of the Int argument, uses java.lang.String.valueOf

showList :: [Int] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Int -> String -> String

inherited from Show.showsPrec

showsub :: Int -> String

inherited from Show.showsub

instance Show Integer

Member Functions

display :: Integer -> String

inherited from Show.display

show :: Integer -> String
pure native toString

the String representation of the Integer argument, uses BigInteger.toString

showList :: [Integer] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Integer -> String -> String

inherited from Show.showsPrec

showsub :: Integer -> String

inherited from Show.showsub

instance Show JException

Member Functions

display :: JException -> String

inherited from Show.display

show :: JException -> String

creates a string representation of a Java exception, consisting of the class name and the message, like

 "java.lang.ArithmeticException: division by zero"
showList :: [JException] -> String -> String

inherited from Show.showList

showsPrec :: Int -> JException -> String -> String

inherited from Show.showsPrec

showsub :: JException -> String

inherited from Show.showsub

instance Show Long

Member Functions

display :: Long -> String

inherited from Show.display

show :: Long -> String
pure native java.lang.Long.toString

the String representation of the Long argument, uses java.lang.Long.toString

showList :: [Long] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Long -> String -> String

inherited from Show.showsPrec

showsub :: Long -> String

inherited from Show.showsub

instance Show Show a => Maybe a

Member Functions

display :: Show α => Maybe α -> String

inherited from Show.display

show :: Show α => Maybe α -> String

Function generated for derived istance.

showList :: Show α => [Maybe α] -> String -> String

inherited from Show.showList

showsPrec :: Show α => Int -> Maybe α -> String -> String

inherited from Show.showsPrec

showsub :: Show α => Maybe α -> String

Function generated for derived istance.

instance Show Ordering

Member Functions

display :: Ordering -> String

inherited from Show.display

show :: Ordering -> String

Function generated for derived istance.

showList :: [Ordering] -> String -> String

inherited from Show.showList

showsPrec :: Int -> Ordering -> String -> String

inherited from Show.showsPrec

showsub :: Ordering -> String

Function generated for derived istance.

instance Show String

Member Functions

display :: String -> String
show :: String -> String
pure native frege.RT.quoteStr

reconstructs a Java string literal from a string, i.e.

> show "abc" = "\"abc\""

showList :: [String] -> String -> String

inherited from Show.showList

showsPrec :: Int -> String -> String -> String

inherited from Show.showsPrec

showsub :: String -> String

inherited from Show.showsub

instance Show Show a => [a]

Member Functions

display :: Show α => [α] -> String
show :: Show α => [α] -> String
showList :: Show α => [[α]] -> String -> String

inherited from Show.showList

showsPrec :: Show α => Int -> [α] -> String -> String

inherited from Show.showsPrec

showsub :: Show α => [α] -> String

Functions and Values

joined :: String -> [String] -> String

joined sep xs concatenates all strings in /xs/, and inserts /sep/ between any two elements of /xs/.

If /xs/ is empty, the result is an empty string. If /sep/ is an empty string, then the result is just the concatenation of the strings in /xs/.

Example:

 joined ", " ["aaa", "bbb", "ccc"] == "aaa, bbb, ccc"
packed :: [Char] -> String

convert a list of characters to a string

 packed ['a', 'b', 'c' ] == "abc"
showChar :: Char -> String -> String

Haskell compatibility

showParen :: Bool -> (ShowS) -> String -> String

Haskell compatibility

showString :: String -> String -> String

Haskell compatibility

shows :: Show a => a -> String -> String

Haskell compatibility

Functions and Values by Type

String -> String -> String

showString

String -> [String] -> String

joined

String -> String

Show_String.show, Show_String.display, Show_String.showsub

[String] -> String -> String

Show_String.showList

[()] -> String -> String

Show_().showList

[Bool] -> String -> String

Show_Bool.showList

[Char] -> String -> String

Show_Char.showList

[Char] -> String

packed

[Double] -> String -> String

Show_Double.showList

[Float] -> String -> String

Show_Float.showList

[Int] -> String -> String

Show_Int.showList

[Integer] -> String -> String

Show_Integer.showList

[JException] -> String -> String

Show_JException.showList

[Long] -> String -> String

Show_Long.showList

[Ordering] -> String -> String

Show_Ordering.showList

() -> String

Show_().show, Show_().display, Show_().showsub

Bool -> (ShowS) -> String -> String

showParen

Bool -> String

Show_Bool.show, Show_Bool.display, Show_Bool.showsub

Char -> String -> String

showChar

Char -> String

Show_Char.show, Show_Char.display, Show_Char.showsub

Double -> String

Show_Double.show, Show_Double.display, Show_Double.showsub

Float -> String

Show_Float.show, Show_Float.display, Show_Float.showsub

Int -> String -> String -> String

Show_String.showsPrec

Int -> () -> String -> String

Show_().showsPrec

Int -> Bool -> String -> String

Show_Bool.showsPrec

Int -> Char -> String -> String

Show_Char.showsPrec

Int -> Double -> String -> String

Show_Double.showsPrec

Int -> Float -> String -> String

Show_Float.showsPrec

Int -> Int -> String -> String

Show_Int.showsPrec

Int -> Integer -> String -> String

Show_Integer.showsPrec

Int -> JException -> String -> String

Show_JException.showsPrec

Int -> Long -> String -> String

Show_Long.showsPrec

Int -> Ordering -> String -> String

Show_Ordering.showsPrec

Int -> String

Show_Int.show, Show_Int.display, Show_Int.showsub

Integer -> String

Show_Integer.show, Show_Integer.display, Show_Integer.showsub

JException -> String

Show_JException.show, Show_JException.display, Show_JException.showsub

Long -> String

Show_Long.show, Show_Long.display, Show_Long.showsub

Ordering -> String

Show_Ordering.show, Show_Ordering.display, Show_Ordering.showsub

Show a => a -> String -> String

shows

Show show => [show] -> String -> String

Show.showList

Show show => Int -> show -> String -> String

Show.showsPrec

Show show => show -> String

Show.show, Show.display, Show.showsub

Show α => Maybe α -> String

Show_Maybe.show, Show_Maybe.display, Show_Maybe.showsub

Show α => [Maybe α] -> String -> String

Show_Maybe.showList

Show α => [[α]] -> String -> String

Show_[].showList

Show α => [α] -> String

Show_[].show, Show_[].display, Show_[].showsub

Show α => Int -> Maybe α -> String -> String

Show_Maybe.showsPrec

Show α => Int -> [α] -> String -> String

Show_[].showsPrec

(Show α, Show β) => (α, β) -> String

Show_(,).show, Show_(,).display, Show_(,).showsub

(Show α, Show β) => Either α β -> String

Show_Either.show, Show_Either.display, Show_Either.showsub

(Show α, Show β) => [(α, β)] -> String -> String

Show_(,).showList

(Show α, Show β) => [Either α β] -> String -> String

Show_Either.showList

(Show α, Show β) => Int -> (α, β) -> String -> String

Show_(,).showsPrec

(Show α, Show β) => Int -> Either α β -> String -> String

Show_Either.showsPrec

(Show β, Show α, Show γ) => (α, β, γ) -> String

Show_(,,).show, Show_(,,).display, Show_(,,).showsub

(Show β, Show α, Show γ) => [(α, β, γ)] -> String -> String

Show_(,,).showList

(Show β, Show α, Show γ) => Int -> (α, β, γ) -> String -> String

Show_(,,).showsPrec

Valid HTML 4.01 Strict