Compiled: Wed Dec 05 00:00:06 PST 2012 from source file: frege/prelude/PreludeText.fr
Classes and Instances to convert values to Strings (Show.show) and Strings to values (read).
There are a few differences to Haskell, notably
Haskell compatibility
Haskell compatibility
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.
[], Maybe, Ordering, JException, Long, StringJ, Int, Either, Double, Float, (,,), Bool, (), (,), Char, Integer
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.
Computes the string representation of a value.
Every instance must implement Show.show.
Haskell compatibility
Haskell compatibility
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)"
inherited from Show.display
Function generated for derived istance.
inherited from Show.showList
inherited from Show.showsPrec
Function generated for derived istance.
inherited from Show.display
Function generated for derived istance.
inherited from Show.showList
inherited from Show.showsPrec
Function generated for derived istance.
inherited from Show.display
Function generated for derived istance.
inherited from Show.showList
inherited from Show.showsPrec
Function generated for derived istance.
inherited from Show.display
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
construct a string that consists of just this character
reconstructs a Java char literal from a character, i.e.
> show a = "a"
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
Function generated for derived istance.
inherited from Show.showList
inherited from Show.showsPrec
Function generated for derived istance.
inherited from Show.display
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
the String representation of the Int argument, uses java.lang.String.valueOf
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
the String representation of the Integer argument, uses BigInteger.toString
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
creates a string representation of a Java exception, consisting of the class name and the message, like
"java.lang.ArithmeticException: division by zero"
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
the String representation of the Long argument, uses java.lang.Long.toString
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.display
Function generated for derived istance.
inherited from Show.showList
inherited from Show.showsPrec
Function generated for derived istance.
inherited from Show.display
Function generated for derived istance.
inherited from Show.showList
inherited from Show.showsPrec
Function generated for derived istance.
reconstructs a Java string literal from a string, i.e.
> show "abc" = "\"abc\""
inherited from Show.showList
inherited from Show.showsPrec
inherited from Show.showsub
inherited from Show.showList
inherited from Show.showsPrec
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"
convert a list of characters to a string
packed ['a', 'b', 'c' ] == "abc"
Haskell compatibility
Haskell compatibility
Haskell compatibility
Haskell compatibility
Show_Integer.show, Show_Integer.display, Show_Integer.showsub
Show_JException.show, Show_JException.display, Show_JException.showsub
Show_Ordering.show, Show_Ordering.display, Show_Ordering.showsub