Module Prelude.PreludeBase

Copyright © 2011 - 2015, Ingo Wechsung

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This package provides basic definitions for the Frege language.

The Prelude packages are imported explicitly or implicitly during compilation of any other package. They define basic data structures, classes and functions.

The types and constructors for lists, unit type and tuple types are not defined here: They are provided programmatically by the compiler when it compiles a package with the name frege.prelude.PreludeBase. Nevertheless, they are considered part of the Prelude, thus qualified names like (,) are okay.

The packages are implementation specific insofar as the compiler may assume that certain items are defined here in a certain way. Changes may thus lead to compiler crashes or java code that will be rejected by the java compiler.

Imports

Table of Content

Definitions

data ()

Unit type

Constructors

()

Unit value

data (a, b)

2-tuple

Constructors

(,) a   b

2-tuple constructor

data (a, b, c)

3-tuple

Constructors

(,,) a   b   c

3-tuple constructor

data (a, b, c, d)

4-tuple

Constructors

(,,,) a   b   c   d

4-tuple constructor

data (a, b, c, d, e)

5-tuple

Constructors

(,,,,) a   b   c   d   e

5-tuple constructor

data (a, b, c, d, e, f)

6-tuple

Constructors

(,,,,,) a   b   c   d   e   f

6-tuple constructor

data (a, b, c, d, e, f, g)

7-tuple

Constructors

(,,,,,,) a   b   c   d   e   f   g

7-tuple constructor

data (a, b, c, d, e, f, g, h)

8-tuple

Constructors

(,,,,,,,) a   b   c   d   e   f   g   h

8-tuple constructor

data (a, b, c, d, e, f, g, h, i)

9-tuple

Constructors

(,,,,,,,,) a   b   c   d   e   f   g   h   i

9-tuple constructor

data (a, b, c, d, e, f, g, h, i, j)

10-tuple

Constructors

(,,,,,,,,,) a   b   c   d   e   f   g   h   i   j

10-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k)

11-tuple

Constructors

(,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k

11-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l)

12-tuple

Constructors

(,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l

12-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m)

13-tuple

Constructors

(,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m

13-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n)

14-tuple

Constructors

(,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n

14-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

15-tuple

Constructors

(,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o

15-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)

16-tuple

Constructors

(,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p

16-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)

17-tuple

Constructors

(,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q

17-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)

18-tuple

Constructors

(,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r

18-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)

19-tuple

Constructors

(,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s

19-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)

20-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t

20-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)

21-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u

21-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)

22-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v

22-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)

23-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w

23-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)

24-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x

24-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)

25-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y

25-tuple constructor

data (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)

26-tuple

Constructors

(,,,,,,,,,,,,,,,,,,,,,,,,,) a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z

26-tuple constructor

data a→b

function

data [a]

list type

Constructors

: a   [a]
infixr  4

list construction

[]

empty list

class Eq e

The type class Eq provides operators Eq.==, Eq.!= and Eq.hashCode.

All types whose values can be compared for equality should be instances of this class. For algebraic data types instances can be automatically derived if all components are themselves instances of Eq.

Known Instances

Integer, Long, Char, Bool, (), Float, Double, Int, [], StringJ

Member Functions

!=Eq e ⇒ e → e → Bool
infix  7

Check for inequality. The default implementation obeys the laws

 !(a != a)
 (a != b) == !(a == b)
 (a == b) != (a != b)

These laws shall also be obeyed in all implementations.

==Eq e ⇒ e → e → Bool
infix  7

Check for equality. This function is required in all instances.

The basic law of philosophy

 a == a

shall be obeyed by all implementations.

hashCodeEq e ⇒ e → Int

Compute a hash code.

The following rules shall hold in all instances:

 a == b ==> hashCode a == hashCode b
 hashCode a != hashCode b ==> a != b

In addition, unequal values should produce unequal hash codes more likely than not.

The hash code in derived instances for algebraic data types is computed as follows:

 hashCode v = case v of
    Con_1 f_1 ... f_k -> fold mkhash 1 [1, hashCode f_1, ..., hashCode f_k ]
    ...
    Con_n f_1 ... f_k -> fold mkhash 1 [n, hashCode f_1, ..., hashCode f_k ]
   where mkhash a b = (31 * a) + b

Here, the Con_i with i>0 are the constructors, and in each clause the f_j with j >= 0 are bound to the fields of the constructor under consideration.

constructoraInt
pure native frege.run.RunTM.constructor

Determines the constructor of a value. This is used like

constructor arg

where arg is any frege value.

Returns 0 for function types, product types and native types or the constructor number for constructed types. The constructor number is a small integer associated with every constructed value. It indicates the data constructor a value was constructed with.

The compiler assigns constructor numbers starting from 0 to the constructors defined in a data definition in the order of their appearance.

Examples

constructor [] == 0
constructor (a:as) == 1
constructor "string"  == 0    // native value

This function is strict in its argument, i.e.

constructor undefined == undefined

Implementation specific: This function is used in derived instances of Eq and Ord.

data Bool = pure native boolean

Bool values are based on Java's primitive boolean values. Note that true and false are literals, not constructors.

data HaskellBool

For compatibility with Haskell, the HaskellBool type defines constructors HaskellBool.True and HaskellBool.False.

When the identifiers True or False are used in patterns or expressions, qualified or unqualified, and name resolution detects that they resolve to HaskellBool.True or HaskellBool.False they will be replaced by literals true or false.

This is, of course, a hack, but I see no other way to bridge the gap between redefinable constructor ids and literals. For example, we couldn't simply define True as another literal keyword, because some Haskell code might use Prelude.True or could have code like.

 import Prelude hiding(True, False)
 data TriBool = False | Perhaps | True

Constructors

False

will be replaced by literal false

True

will be replaced by literal true

otherwiseBool

This is a constant with the value true. It is most often used as the last alternative in pattern guards:

 foo n | n >= 0    = ...
       | otherwise = ...
lazyifBool → α → α → α

warning: will soon be replaced with bool This is used by code generation when a conditional expression appears in a lazy context, i.e.

 (42, if foo then bar else baz)

lazyif a b c evaluates to b if a is true, otherwise to c.

bool ∷ α → α → Bool → α

This is used by code generation when a conditional expression appears in a lazy context, i.e.

 (42, if foo then bar else baz)

bool a b c evaluates to a if c is true, otherwise to b.

data Int = pure native int

Int values are based on Java's primitive int values.

The existence of this type is assumed in numerous places in the compiler.

Like with all native Java types, be they primitive or reference types, Frege holds the raw int in boxed form. However, in certain cases the compiler will optimize the boxing away:

 sum a b c = a + b + c

can compute the sum of 3 Ints, Longs, Doubles or any other values of a type that is an instance of type class Num, but it may be somewhat slower than functions specialized for a given type.

According to the Java Language Specification, int values are 32 bit wide signed two's complement integers (§4.2). Java operations on int do not indicate overflow or underflow in any way (§4.2.2). Instead, just the low 32 bits of every result are retained.

Member Functions

.&.IntIntInt
pure native &
infixl  11

Computes binary /and/ of two integers. Uses the java &-operator.

.^.IntIntInt
pure native ^
infixl  10

Computes binary /exclusive or/ of two integers. Uses the java ^-operator.

.|.IntIntInt
pure native |
infixl  10

Computes binary /or/ of two integers. Uses the java |-operator.

charIntChar
pure native (char)

i.char returns the Char value whose ordinal number is i

Result is only valid for integers in the range 0..65535

complementIntInt
pure native ~
doubleIntDouble
pure native java.lang.Double.valueOf

convert an Int to a Double, i.e. 2.double == 2.0.

floatIntFloat
pure native java.lang.Float.valueOf

convert an Int to a Float, i.e. 2.float == 2.0f.

For large integers, the result may have been be rounded.

longIntLong
pure native java.lang.Long.valueOf

Convert an Int to a Long, i.e. 2.long == 2L.

rotateLIntIntInt
pure native java.lang.Integer.rotateLeft
infixl  12

Returns the value obtained by rotating the two's complement binary representation of the specified int value left

by the specified number of bits.

rotateRIntIntInt
pure native java.lang.Integer.rotateRight
infixl  12

Returns the value obtained by rotating the two's complement binary representation of the specified int value

right by the specified number of bits.

shiftLIntIntInt
pure native <<
infixl  12
shiftRIntIntInt
pure native >>
infixl  12
sizeInt
pure native java.lang.Integer.SIZE

The number of bits used to represent an int value in two's complement binary form

toHexStringIntString
pure native java.lang.Integer.toHexString

convert to a hexadecimal string

ushiftRIntIntInt
pure native >>>
infixl  12

unsigned right shift

data Integer = pure native java.math.BigInteger

Integer is a type for integer numbers of unlimited size, It has instances for Eq, Ord, Show and Integral.

This is derived from java.math.BigInteger.

Member Functions

.&.IntegerIntegerInteger
pure native and
infixl  11
.^.IntegerIntegerInteger
pure native xor
infixl  10
.|.IntegerIntegerInteger
pure native or
infixl  10
bitLengthIntegerInt
pure native bitLength

Returns the number of bits in the minimal two's-complement representation of this Integer, excluding a sign bit.

compareToIntegerIntegerInt
pure native compareTo
complementIntegerInteger
pure native not
doubleIntegerDouble
pure native doubleValue
intIntegerInt
pure native intValue
longIntegerLong
pure native longValue
nModIntegerIntegerInteger
pure native mod

Warning! Throws ArithmeticException when divisor is negative.

shiftLIntegerIntInteger
pure native shiftLeft
infixl  12
shiftRIntegerIntInteger
pure native shiftRight
infixl  12
tenInteger
pure native java.math.BigInteger.TEN
toStringIntegerString
pure native toString
ushiftRIntegerIntInteger
infixl  12

unsigned right shift on big integers does not really make sense ...

valueOfLongInteger
pure native java.math.BigInteger.valueOf

construction from a Long, see also StringJ.aton and StringJ.integer

data Long = pure native long

Long values are based on Java's primitive long values.

According to the Java Language Specification, long values are 64 bit wide signed two's complement integers (§4.2). Java operations on long do not indicate overflow or underflow in any way (§4.2.2). Instead, just the low 64 bits of every result are retained.

Member Functions

.&.LongLongLong
pure native &
infixl  11

Computes binary and of two integers. Uses the java &-operator.

.^.LongLongLong
pure native ^
infixl  10

Computes binary exclusive or of two long integers. Uses the java ^-operator.

.|.LongLongLong
pure native |
infixl  10

Computes binary or of two long integers. Uses the java |-operator.

complementLongLong
pure native ~
doubleLongDouble
pure native java.lang.Double.valueOf

Convert an Long to a Double, i.e. 42L.double == 42.0.

For large numbers, the result may have been be rounded.

floatLongFloat
pure native java.lang.Float.valueOf

Convert an Long to a Float, i.e. 42L.float == 42.0f.

For large numbers, the result may have been be rounded.

intLongInt
pure native (int)

Uses a java cast to convert a Long to an Int. This is a narrowing primitive conversion in java parlance.

rotateLLongIntLong
pure native java.lang.Long.rotateLeft
infixl  12

Returns the value obtained by rotating the two's complement binary representation

of the specified long value left by the specified number of bits.

rotateRLongIntLong
pure native java.lang.Long.rotateRight
infixl  12

Returns the value obtained by rotating the two's complement binary representation

of the specified long value right by the specified number of bits.

shiftLLongIntLong
pure native <<
infixl  12
shiftRLongIntLong
pure native >>
infixl  12
sizeInt
pure native java.lang.Long.SIZE
ushiftRLongIntLong
pure native >>>
infixl  12

unsigned right shift

data Char = pure native char

Char values are based on Java's primitive char values.

This type has many native functions based on the methods in java.lang.Character.

Most is... functions work on Char and Int (codepoint).

Likewise, most to...Case functions work on codepoints.

Member Functions

digitCharIntInt
pure native java.lang.Character.digit

Returns the numeric value of the character argument in the specified radix.

If the character is not a digit in the given radix, -1 is returned.

The radix must be in the range 2..36, otherwise also -1 is returned.

forDigitIntIntChar
pure native java.lang.Character.forDigit
 Char.forDigit d r

returns the character for the digit d in radix r

d must not be negative and lower than r, and r must be in the range 2..36

When the arguments are invalid the character '\u0000' is returned.

getNameCharMaybe String
         | IntMaybe String
pure native java.lang.Character.getName

Return the Unicode name of the code point or null if it is unassigned.

getNameαCharMaybe String
pure native java.lang.Character.getName  overloads getName

Return the Unicode name of the code point or null if it is unassigned.

getNameβIntMaybe String
pure native java.lang.Character.getName  overloads getName

Return the Unicode name of the code point or null if it is unassigned.

getTypeCharInt
         | IntInt
pure native java.lang.Character.getType

Returns a value indicating a character's general category.

getTypeαCharInt
pure native java.lang.Character.getType  overloads getType

Returns a value indicating a character's general category.

getTypeβIntInt
pure native java.lang.Character.getType  overloads getType

Returns a value indicating a character's general category.

highSurrogateIntChar
pure native java.lang.Character.highSurrogate

The leading surrogate (which is a high surrogate code unit) of the surrogate pair representing the specified supplementary character (Unicode code point) in the UTF-16 encoding.

If the specified value is not a supplementary character, an unspecified character is returned.

See also: Char.isSupplementaryCodePoint, Char.lowSurrogate, Char.toCodePoint

The following holds:

 isSupplementaryCodePoint x ==> (x == toCodePoint (highSurrogate x) (lowSurrogate x))
isDefinedCharBool
           | IntBool
pure native java.lang.Character.isDefined

Determines if a character (Unicode code point) is defined in Unicode.

A character is defined if at least one of the following is true:

  • It has an entry in the UnicodeData file.
  • It has a value in a range defined by the UnicodeData file.
isDefinedαCharBool
pure native java.lang.Character.isDefined  overloads isDefined

Determines if a character (Unicode code point) is defined in Unicode.

A character is defined if at least one of the following is true:

  • It has an entry in the UnicodeData file.
  • It has a value in a range defined by the UnicodeData file.
isDefinedβIntBool
pure native java.lang.Character.isDefined  overloads isDefined

Determines if a character (Unicode code point) is defined in Unicode.

A character is defined if at least one of the following is true:

  • It has an entry in the UnicodeData file.
  • It has a value in a range defined by the UnicodeData file.
isDigitCharBool
         | IntBool
pure native java.lang.Character.isDigit
isDigitαCharBool
pure native java.lang.Character.isDigit  overloads isDigit
isDigitβIntBool
pure native java.lang.Character.isDigit  overloads isDigit
isHighSurrogateCharBool
pure native java.lang.Character.isHighSurrogate

Determines if the given char value is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

Such values do not represent characters by themselves, but are used in the representation of supplementary characters in the UTF-16 encoding.

isISOControlCharBool
              | IntBool
pure native java.lang.Character.isISOControl

Determines if the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range "\u0000" through "\u001F" or in the range "\u007F" through "\u009F".

isISOControlαCharBool
pure native java.lang.Character.isISOControl  overloads isISOControl

Determines if the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range "\u0000" through "\u001F" or in the range "\u007F" through "\u009F".

isISOControlβIntBool
pure native java.lang.Character.isISOControl  overloads isISOControl

Determines if the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range "\u0000" through "\u001F" or in the range "\u007F" through "\u009F".

isLetterCharBool
          | IntBool
pure native java.lang.Character.isLetter
isLetterOrDigitCharBool
                 | IntBool
pure native java.lang.Character.isLetterOrDigit
isLetterOrDigitαCharBool
pure native java.lang.Character.isLetterOrDigit  overloads isLetterOrDigit
isLetterOrDigitβIntBool
pure native java.lang.Character.isLetterOrDigit  overloads isLetterOrDigit
isLetterαCharBool
pure native java.lang.Character.isLetter  overloads isLetter
isLetterβIntBool
pure native java.lang.Character.isLetter  overloads isLetter
isLowSurrogateCharBool
pure native java.lang.Character.isLowSurrogate

Determines if the given char value is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

Such values do not represent characters by themselves, but are used in the representation of supplementary characters in the UTF-16 encoding.

isLowerCaseCharBool
             | IntBool
pure native java.lang.Character.isLowerCase
isLowerCaseαCharBool
pure native java.lang.Character.isLowerCase  overloads isLowerCase
isLowerCaseβIntBool
pure native java.lang.Character.isLowerCase  overloads isLowerCase
isSupplementaryCodePointIntBool
pure native java.lang.Character.isSupplementaryCodePoint

Determines whether the specified character (Unicode code point) is in the supplementary character range.

This is roughly equivalent to

 (> ord Char.maxBound)

except that it also checks if the value is lower than 0x110000

If, for some integer n

 not (Char.isSupplementaryCodePoint n) && (n > ord Char.maxBound)

then n is not a codepoint at all.

isSurrogateCharBool
pure native java.lang.Character.isSurrogate

Determines if the given char value is a Unicode surrogate code unit.

Such values do not represent characters by themselves, but are used in the representation of supplementary characters in the UTF-16 encoding.

A char value is a surrogate code unit if and only if it is either a low-surrogate code unit or a high-surrogate code unit.

isSurrogatePairCharCharBool
pure native java.lang.Character.isSurrogatePair

Determines whether the specified pair of char values is a valid Unicode surrogate pair.

isUpperCaseCharBool
             | IntBool
pure native java.lang.Character.isUpperCase
isUpperCaseαCharBool
pure native java.lang.Character.isUpperCase  overloads isUpperCase
isUpperCaseβIntBool
pure native java.lang.Character.isUpperCase  overloads isUpperCase
isValidCodePointIntBool
pure native java.lang.Character.isValidCodePoint

Determines whether the specified code point is a valid Unicode code point value.

This is the case if it is not negative and lower than 0x110000

isWhitespaceCharBool
              | IntBool
pure native java.lang.Character.isWhitespace
isWhitespaceαCharBool
pure native java.lang.Character.isWhitespace  overloads isWhitespace
isWhitespaceβIntBool
pure native java.lang.Character.isWhitespace  overloads isWhitespace
lowSurrogateIntChar
pure native java.lang.Character.lowSurrogate

The trailing surrogate (which is a low surrogate code unit) of the surrogate pair representing the specified supplementary character (Unicode code point) in the UTF-16 encoding.

If the specified value is not a supplementary character, an unspecified character is returned.

See also: Char.isSupplementaryCodePoint, Char.highSurrogate, Char.toCodePoint

The following holds:

 isSupplementaryCodePoint x ==> (x == toCodePoint (highSurrogate x) (lowSurrogate x))
toCodePointCharCharInt
pure native java.lang.Character.toCodePoint
 Char.toCodePoint high low

Converts the specified surrogate pair to its supplementary code point value. This function does not validate the specified surrogate pair. The caller must validate it using Char.isSurrogatePair if necessary.

toLowerCaseCharChar
             | IntInt
pure native java.lang.Character.toLowerCase

The lowercase equivalent of the character, if any; otherwise, the character itself.

toLowerCaseαCharChar
pure native java.lang.Character.toLowerCase  overloads toLowerCase

The lowercase equivalent of the character, if any; otherwise, the character itself.

toLowerCaseβIntInt
pure native java.lang.Character.toLowerCase  overloads toLowerCase

The lowercase equivalent of the character, if any; otherwise, the character itself.

toTitleCaseCharChar
             | IntInt
pure native java.lang.Character.toTitleCase

The titlecase equivalent of the character, if any; otherwise, the character itself.

toTitleCaseαCharChar
pure native java.lang.Character.toTitleCase  overloads toTitleCase

The titlecase equivalent of the character, if any; otherwise, the character itself.

toTitleCaseβIntInt
pure native java.lang.Character.toTitleCase  overloads toTitleCase

The titlecase equivalent of the character, if any; otherwise, the character itself.

toUpperCaseCharChar
             | IntInt
pure native java.lang.Character.toUpperCase

The uppercase equivalent of the character, if any; otherwise, the character itself.

toUpperCaseαCharChar
pure native java.lang.Character.toUpperCase  overloads toUpperCase

The uppercase equivalent of the character, if any; otherwise, the character itself.

toUpperCaseβIntInt
pure native java.lang.Character.toUpperCase  overloads toUpperCase

The uppercase equivalent of the character, if any; otherwise, the character itself.

type String = StringJ Char

String values are based on Java's java.lang.String objects. String is an alias for StringJ Char

data StringJ a = pure native java.lang.String

For technical reasons, the native string type is defined with a phantom type, which allows us to treat strings like character lists.

The following rules apply:

Member Functions

++StringJ aStringJ aStringJ a
pure native +
infixr  13

Concatenate two strings, uses Java's + operator

atodStringDouble
pure native java.lang.Double.parseDouble

Like StringJ.double, but the exception is not checked, thus only good when one knows for sure that the parse will succeed.

atofStringFloat
pure native java.lang.Float.parseFloat

Like StringJ.float, but the exception is not checked, thus only good when one knows for sure that the parse will succeed.

atoiStringInt
pure native java.lang.Integer.parseInt

Like StringJ.int, but the exception is not checked, thus only good when one knows for sure that the parse will succeed.

atolStringLong
pure native java.lang.Long.parseLong

Like StringJ.long, but the exception is not checked, thus only good when one knows for sure that the parse will succeed.

atonStringInteger
pure native new

Like StringJ.integer, but the exception is not checked, thus only good when one knows for sure that the parse will succeed.

charAtStringIntChar
pure native charAt

retrieve character at index

compareToStringStringInt
pure native compareTo

StringJ.compareTo is used in the Ord instance of String

doubleString → (NumberFormatException | Double)
pure native java.lang.Double.parseDouble

Safe way to parse a Double value from a string. See StringJ.int

floatString → (NumberFormatException | Float)
pure native java.lang.Float.parseFloat

Safe way to parse a Float value from a string. See StringJ.int

formatString → a → String
        | String → a → b → String
        | String → a → b → c → String
        | String → a → b → c → d → String
        | String → a → b → c → d → e → String
        | String → a → b → c → d → e → f → String
        | String → a → b → c → d → e → f → g → String
        | String → a → b → c → d → e → f → g → h → String
        | String → a → b → c → d → e → f → g → h → i → String
pure native java.lang.String.format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatαStringaString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatβStringabString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatγStringabcString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatδStringabcdString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatεStringabcdeString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatζStringabcdefString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatηStringabcdefgString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatθStringabcdefghString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

formatιStringabcdefghiString
pure native java.lang.String.format  overloads format

Format 1 to 9 values

May throw IllegalFormatException, if the type of any argument does not fit the format specifier.

indexOfStringCharInt
pure native indexOf
 str.indexOf ch

the first index of ch in str, or -1 if not present

intString → (NumberFormatException | Int)
pure native java.lang.Integer.parseInt

Safe way to parse an integer from a string. java.lang.NumberFormatException will be caught and returned as Either.Left value. When the parse succeeds, the integer is returned in the Either.Right value.

Use like this:

 case s.int of
   Left exc -> ...     -- s is not well formed
   Right i  -> ...     -- the parsed value is in i
intToStringIntString
pure native java.lang.String.valueOf

convert an Int to a String

integerString → (NumberFormatException | Integer)
pure native new

Safe way to parse a big Integer value from a string. See StringJ.int

lengthStringJ aInt
pure native length

The length of a String

longString → (NumberFormatException | Long)
pure native java.lang.Long.parseLong

Safe way to parse a long integer from a string. See StringJ.int

notifyStringIO ()
native frege.runtime.Concurrent.notifyOne

notify a single thread waiting on the objects monitor

notifyAllStringIO ()
native frege.runtime.Concurrent.notifyAll

notify all threads waiting on the objects monitor

polymorphicElemAtStringJ aInt → a
pure native PreludeBase.polyCharAt

Retrieve element of String at index

Because it is impossible to create a String from anything but Chars, the type is not even wrong.

Will be needed in the String instance of ListLike that expects a type with kind ->.

quoteStringString
pure native java.util.regex.Pattern.quote

quote regular expression metacharacters in string

quoteReplacementStringString
pure native java.util.regex.Matcher.quoteReplacement

quote replacement string metacharacters in string

startsWithStringStringBool
pure native startsWith

true if the second string is a prefix of the first one

substrStringJ aIntIntStringJ a
pure native substring

see substr

toLowerCaseStringString
pure native toLowerCase

convert to lower case

toUpperCaseStringString
pure native toUpperCase

convert to upper case

waitStringIO ()
native frege.runtime.Concurrent.waitFor  throws InterruptedException

wait on Objects monitor

substrStringJ aIntIntStringJ a
pure native substring

substr s start end returns the sub string of s that starts with the character at position start and extends to the character at position end-1.

This uses the native method substring of class java.lang.String. It will throw an IndexOutOfBoundsException if start is negative or larger than end or if end is greater than the length of s.

strtailStringJ aIntStringJ a
pure native substring

strtail s n returns a new string that is a substring of string s. The substring begins with the character at the specified index and extends to the end of s.

This uses the native method substring of class java.lang.String. It will throw an IndexOutOfBoundsException if n is negative or larger than the length of s.

atoiStringInt
data Float = pure native float

Float values are based on Java's primitive float values.

According to the Java Language Specification §4.2.3, float values are 32-bit-precision binary floating point values. The values and the operations on it behave as specified in the IEEE Standard for Binary Floating-Point Arithmetic.

Member Functions

doubleFloatDouble
pure native (double)

Applies the java widening primitive conversion from float to double.

intFloatInt
pure native java.lang.Math.round

Returns the closest Int value to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type int.

The following property holds:

 (f < Int.maxBound.float && f > Int.minBound.float) ==>
   (f.int.float == (f + 0.5f).floor)

Special cases:

data Double = pure native double

Double values are Java's primitive double values.

According to the Java Language Specification §4.2.3, double values are 64-bit-precision binary floating point values. The values and the operations on it behave as specified in the IEEE Standard for Binary Floating-Point Arithmetic.

Member Functions

floatDoubleFloat
pure native (float)

Applies the java narrowing primitive conversion from double to float

longDoubleLong
pure native java.lang.Math.round

Returns the closest Long value to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long.

The following property holds:

 (d < Long.maxBound.double && d > Long.minBound.double) ==>
   (d.long.double == (d + 0.5d).floor)

Special cases:

longBitsDoubleLong
pure native java.lang.Double.doubleToLongBits

bit representation of a double

data Object = pure native java.lang.Object

The Java Object type

Member Functions

getClassaClass a
pure native frege.runtime.Runtime.getClass

for any value, we can get its Java class

notifyObjectIO ()
native frege.runtime.Concurrent.notifyOne

notify a single thread waiting on the objects monitor

notifyAllObjectIO ()
native frege.runtime.Concurrent.notifyAll

notify all threads waiting on the objects monitor

waitObjectIO ()
native frege.runtime.Concurrent.waitFor  throws InterruptedException

wait on Objects monitor

data InterruptedException = pure native java.lang.InterruptedException
type CatchAll = Either Throwable

warning: probably catches more exceptions than you want to handle, use (Exception1|Exception2|Result) This is the principal return type for java methods that are expected to throw exceptions.

It is strongly recommended to use more specific exception types.

data Class a = pure native java.lang.Class

We need to do some reflection from frege code. For example, when we catch a Throwable thrown from Java code. we might want to know what it is.

Member Functions

forNameStringIO (ClassNotFoundException | Class a)
native java.lang.Class.forName
getNameClass aString
pure native getName
data Throwable = pure native java.lang.Throwable

Frege wrapper for java Throwables.

Member Functions

caughtThrowableString

give the class name of this exception

getLocalizedMessageThrowableString
pure native getLocalizedMessage
getMessageThrowableString
pure native getMessage
printStackTraceThrowableIO ()
native printStackTrace
strictTuple2ab → (a, b)
pure native PreludeBase.TTuple2.mk

Used to construct a strict tuple. Don't use anymore!

strictTuple3abc → (a, b, c)
pure native PreludeBase.TTuple3.mk

Constructs a strict 3-tuple. See remarks for strictTuple2.

strictTuple4abcd → (a, b, c, d)
pure native PreludeBase.TTuple4.mk

Constructs a strict 4-tuple. See remarks for strictTuple2.

strictTuple5abcde → (a, b, c, d, e)
pure native PreludeBase.TTuple5.mk

Constructs a strict 5-tuple. See remarks for strictTuple2.

strictTuple6abcdef → (a, b, c, d, e, f)
pure native PreludeBase.TTuple6.mk

Constructs a strict 6-tuple. See remarks for strictTuple2.

strictTuple7abcdefg → (a, b, c, d, e, f, g)
pure native PreludeBase.TTuple7.mk

Constructs a strict 7-tuple. See remarks for strictTuple2.

strictTuple8abcdefgh → (a, b, c, d, e, f, g, h)
pure native PreludeBase.TTuple8.mk

Constructs a strict 8-tuple. See remarks for strictTuple2.

strictTuple9abcdefghi → (a, b, c, d, e, f, g, h, i)
pure native PreludeBase.TTuple9.mk

Constructs a strict 9-tuple. See remarks for strictTuple2.

strictTuple10abcdefghij → (a, b, c, d, e, f, g, h, i, j)
pure native PreludeBase.TTuple10.mk

Constructs a strict 10-tuple. See remarks for strictTuple2.

strictTuple11abcdefghijk → (a, b, c, d, e, f, g, h, i, j, k)
pure native PreludeBase.TTuple11.mk

Constructs a strict 11-tuple. See remarks for strictTuple2.

strictTuple12abcdefghijkl → (a, b, c, d, e, f, g, h, i, j, k, l)
pure native PreludeBase.TTuple12.mk

Constructs a strict 12-tuple. See remarks for strictTuple2.

strictTuple13abcdefghijklm → (a, b, c, d, e, f, g, h, i, j, k, l, m)
pure native PreludeBase.TTuple13.mk

Constructs a strict 13-tuple. See remarks for strictTuple2.

strictTuple14abcdefghijklmn → (a, b, c, d, e, f, g, h, i, j, k, l, m, n)
pure native PreludeBase.TTuple14.mk

Constructs a strict 14-tuple. See remarks for strictTuple2.

strictTuple15abcdefghijklmno → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
pure native PreludeBase.TTuple15.mk

Constructs a strict 15-tuple. See remarks for strictTuple2.

strictTuple16abcdefghijklmnop → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
pure native PreludeBase.TTuple16.mk

Constructs a strict 16-tuple. See remarks for strictTuple2.

strictTuple17abcdefghijklmnopq → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)
pure native PreludeBase.TTuple17.mk

Constructs a strict 17-tuple. See remarks for strictTuple2.

strictTuple18abcdefghijklmnopqr → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)
pure native PreludeBase.TTuple18.mk

Constructs a strict 18-tuple. See remarks for strictTuple2.

strictTuple19abcdefghijklmnopqrs → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)
pure native PreludeBase.TTuple19.mk

Constructs a strict 19-tuple. See remarks for strictTuple2.

strictTuple20abcdefghijklmnopqrst → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)
pure native PreludeBase.TTuple20.mk

Constructs a strict 20-tuple. See remarks for strictTuple2.

strictTuple21abcdefghijklmnopqrstu → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)
pure native PreludeBase.TTuple21.mk

Constructs a strict 21-tuple. See remarks for strictTuple2.

strictTuple22abcdefghijklmnopqrstuv → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)
pure native PreludeBase.TTuple22.mk

Constructs a strict 22-tuple. See remarks for strictTuple2.

strictTuple23abcdefghijklmnopqrstuvw → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
pure native PreludeBase.TTuple23.mk

Constructs a strict 23-tuple. See remarks for strictTuple2.

strictTuple24abcdefghijklmnopqrstuvwx → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
pure native PreludeBase.TTuple24.mk

Constructs a strict 24-tuple. See remarks for strictTuple2.

strictTuple25abcdefghijklmnopqrstuvwxy → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)
pure native PreludeBase.TTuple25.mk

Constructs a strict 25-tuple. See remarks for strictTuple2.

strictTuple26abcdefghijklmnopqrstuvwxyz → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
pure native PreludeBase.TTuple26.mk

Constructs a strict 26-tuple. See remarks for strictTuple2.

seqβα → α
infixr  2

a `seq` b evaluates a before it returns b

This is a right associative operator with precedence 15.

data Undefined = pure native frege.runtime.Undefined

An unchecked subclass of java.lang.RuntimeException for the Frege Runtime

An instance of Undefined will be thrown if undefined or (error msg) is evaluated.

Member Functions

dieUndefinedBool
pure native die

Throw this Undefined, this will abort the computation evaluating it.

Actually, the return type is not correct, since it never returns.

newStringUndefined
     | StringThrowableUndefined
pure native new

create an Undefined value with a message (String) or with a message and a cause. The cause is another exception that caused this one.

newXThrowableUndefined

create an Undefined value from a cause (Throwable). The message will be taken from the cause.

newαStringUndefined
pure native new  overloads new

create an Undefined value with a message (String) or with a message and a cause. The cause is another exception that caused this one.

newβStringThrowableUndefined
pure native new  overloads new

create an Undefined value with a message (String) or with a message and a cause. The cause is another exception that caused this one.

data NoMatch = pure native frege.runtime.NoMatch

A subclass of Undefined, used by the runtime to signal failed pattern matches

data GuardFailed = pure native frege.runtime.GuardFailed

A subclass of Undefined, used by the runtime to signal failed guards

data NumberFormatException = pure native java.lang.NumberFormatException

java.lang.NumberFormatException needed for string conversion operations

declared protected to avoid name conflicts with NumberFormatException

data ClassNotFoundException = pure native java.lang.ClassNotFoundException

Forward declaration of ClassNotFoundException

undefined ∷ u

This is the standard undefined value.

errorString → u

Construct an undefined value with an informative message.

When evaluated, an Undefined exception will be thrown.

throwThrowable → α

Constructs an undefined value from a java exception and throws it.

!BoolBool
pure native !

The Java ! operator on booleans

?IntInt
pure native ~

complement

&&BoolBoolBool
pure native &&
infixr  6

The Java && operator on booleans. Note that since this is a native function, the second argument appears strict to the compiler when in fact it is lazy at the Java level. This can lead to inconsistent results in some cases. For example, the following program correctly prints false in the first line of the output, but then aborts:

 main _ = do
    stdout << (false && undefined) << "\n"
    stdout << conj false undefined << "\n"
  where
    conj a b = a && b

Note that the very same behaviour is seen in the following java program

 public class And {
    static boolean undef() {
        if (true) throw new Error("undefined");
        return false;
    }
    static boolean conj(boolean a, boolean b) { return a&&b; }
    public static void main(String[] args) {
        System.out.println(false && undef());
        System.out.println(conj(false, undef()));
    }
 }

One could thus say that && behaves exactly like the Java operator including the fact that it cannot be replaced by a function without changing the semantics of a program.

For an alternative see und

||BoolBoolBool
pure native ||
infixr  5

The Java || operator on booleans.

Note that since this is a native function, the second argument appears strict to the compiler when in fact it is lazy at the Java level.

This can lead to inconsistent results in cases where the wrong strictness of the second argument propagates to arguments of the function that contains an application of ||. (The documentation for && has an example.)

See oder for an alternative

undBoolBoolBool
infixr  6

Like &&, but second argument is lazy. The `und` operator has the same precedence and arity as &&. The definition is

 a `und` b = if a then b     else false

This should really be named and, but Haskell 2010 uses this already for lists. Hence we use the german word und.

oderBoolBoolBool
infixr  5

Like ||, but second argument is lazy. The `oder` operator has the same precedence and arity as ||. The definition is

 a `oder`  b = if a then true  else b

This should really be named or, but Haskell 2010 uses this already for lists. Hence we use the german word oder.

notBoolBool
pure native !

not b is true if b is false, otherwise true. Uses java's ! operator.

^^BoolBoolBool
infixr  5

a ^^ b is true if either a or b is true, but not both.

 a ^^ b = if a then not b else b
===aaBool
pure native ==
infix  7

This checks for object identity or equality of primitive values using Java's == operator. It evaluates its arguments, so undefined values cannot be compared.

!==aaBool
pure native !=
infix  7

This checks for object identity or inequality of primitive values using Java's != operator. It evaluates its arguments, so undefined values cannot be compared.

data Ordering

Ordering encodes the results of comparisons, see also Ord.<=>

Constructors

Eq
Gt
Lt
class Eq o ⇒ Ord o

The Ord class provides relational operators as well as the functions Ord.max and Ord.min. The default implementation defines them all in terms of the compare operator Ord.<=>.

Making some type an instance of Ord makes it automatically an instance of Eq if it is not one already and if it has an implementation for Eq.hashCode. The operators Eq.== and Eq.!= will be defined in terms of Ord.<=>.

Instances of Ord can be derived automatically for algebraic data types when all elements of the type are themselves instances of Ord and when the type is an instance of Eq.

Known Instances

Integer, Char, Bool, Float, Double, Int, StringJ, Long

Member Functions

!=Ord o ⇒ o → o → Bool
infix  7

This implementation for the (Eq.!=) operator is being used in instances of Ord when the instantiated type is not already an instance of Eq.

<Ord o ⇒ o → o → Bool
infix  9

Relational < operator. Obeys the following laws:

 if a < b && b < c then a < c
 a < b == b > a
<=Ord o ⇒ o → o → Bool
infix  9

Relational <= operator. Obeys the following laws:

 if a <= b && b <= c then a <= c
 a <= b == b >= a
 a <= b == !(a > b)
<=>Ord o ⇒ o → o → Ordering
infix  8

This operator must be defined in all instances. It compares its operands and returns Ordering.Lt if the first is lower than the second, Ordering.Gt if the first is greater than the second and Ordering.Eq otherwise.

The following shall be invariantly true:

 case a <=> b of { Eq -> a == b; _ -> a != b }
==Ord o ⇒ o → o → Bool
infix  7

This implementation for the (Eq.==) operator is being used in instances of Ord when the instantiated type is not already an instance of Eq.

>Ord o ⇒ o → o → Bool
infix  9

Relational > operator. Obeys the following laws:

 if a > b && b > c then a > c
 a > b == b < a
>=Ord o ⇒ o → o → Bool
infix  9

Relational >= operator. Obeys the following laws:

 if a >= b && b >= c then a >= c
 a >= b == b <= a
 a >= b == !(a < b)
compareOrd o ⇒ o → o → Ordering
infix  8
maxOrd o ⇒ o → o → o
 max a b = if a > b then a else b   
minOrd o ⇒ o → o → o
 min a b = if a < b then a else b   
class (Eq e, Ord e) ⇒ Enum e

Class Enum defines operations on sequentially ordered types.

A type that is an instance of Enum is also an instance of Ord (and, in turn, of Eq).

Instances of Enum may be derived for any enumeration type (types whose constructors have no fields). If there is no Eq.hashCode provided, it will be the same as Enum.ord.

Enumeration types have special syntactic support with the range list:

 [a .. b]
 [a ..]
 [a,b .. c]
 [a,b ..]

Known Instances

Int, Bool, Char, Integer, Long

Member Functions

<=>Enum e ⇒ e → e → Ordering
infix  8

This is the default implementation of the compare operator, that makes each Enum type an Ord type automatically.

 a <=> b  =  (ord a).<=>  (ord b)
enumFromEnum e ⇒ e → [e]

used in translating @[n..]

enumFromThenEnum e ⇒ e → e → [e]

used in translating @[n,n'..]

enumFromThenToEnum e ⇒ e → e → e → [e]

used in translating @[n,n'..m]

enumFromToEnum e ⇒ e → e → [e]

used in translating @[n..m]

fromEnum e ⇒ Int → e

T.from i maps the Int value i to a value of T, such that

   ord (T.from i) == i

unless there is no value e of T so that ord e == i. In the latter case, the result is undefined.

hashCodeEnum e ⇒ e → Int

default implementation for Eq.hashCode is same as Enum.ord

ordEnum e ⇒ e → Int

ord e returns the ordinal number associated with the value e. For enumeration types, Enum.ord is the same as constructor, for Int, it is the identity function. Some types, like Long, cannot map all their values to Int, in such cases the result of applying Enum.ord may be meaningless.

predEnum e ⇒ e → e

pred e is the predecessor of e or undefined if there is no predecessor.

succEnum e ⇒ e → e

succ e is the successor of e or undefined if there is no such successor.

class (Eq n, Ord n) ⇒ Num n

The Num class provides the operators (Num.+), (Num.-) and (Num.*) as well as some functions that are common for all numeric types.

Known Instances

Integer, Float, Double, Int, Long

Member Functions

*Num n ⇒ n → n → n
infixl  14

Computes the product of two numbers

+Num n ⇒ n → n → n
infixl  13

Computes the sum of two numbers

-Num n ⇒ n → n → n
infixl  13

Computes the difference of two numbers

absNum n ⇒ n → n

Computes the absolute value

fromIntNum n ⇒ Int → n

converts an Int value to the instantiated type

fromIntegerNum n ⇒ Integer → n

converts an Integer value to the instantiated type

isInfiniteNum n ⇒ n → Bool

Floating point number types may have special values for infinity and negative infinity. isFinite n yields true if n is an infinite value and false in all other cases.

The default implementation always returns false so that implementors of instances for types without special values for infinity need not care.

See also Num.isNumber.

isNaNNum n ⇒ n → Bool

Floating point number types may have a special values for not a number (NaN). For example, 0d / 0d is NaN. isNaN n yields true if n is the special value that indicates that n is not a number and false in all other cases.

The default implementation always returns false so that implementors of instances for types without such a special values need not care.

See also Num.isNumber.

isNumberNum n ⇒ n → Bool

Returns true if n is neither infinite (see Num.isInfinite) nor NaN (see Num.isNaN).

Note that certain properties for functions on numbers are true only under the assumption that the argument values are numbers.

The default implementation is

 isNumber n = !(isInfinite n) && !(isNaN n)

so that the function should always compute the right answer as long as Num.isInfinite and Num.isNaN do.

negateNum n ⇒ n → n

Negates a number n such that if n is a number

 n + negate n == 0   
oneNum n ⇒ n

the number 1 in the instantiated type

signNum n ⇒ n → Int

sign n is -1 if n<0, 1 if n>0 and 0 otherwise

subtractNum n ⇒ n → n → n

use (subtract a) instead of \\b -> b-a in sections

zeroNum n ⇒ n

the number 0 in the instantiated type

class (Eq r, Ord r, Num r) ⇒ Real r

The Real class provides the division operator (Real./).

Known Instances

Float, Double

Member Functions

/Real r ⇒ r → r → r
infixl  14

the division operator

fromDoubleReal r ⇒ Double → r

convert a Double to any Real value

class (Eq i, Ord i, Num i) ⇒ Integral i

Class Integral provides division and remainder operations for integral numbers.

Known Instances

Integer, Int, Long

Member Functions

^ ∷ (Integral i, Num a) ⇒ a → i → a
infixr  15

x ^ n raise x to the n-th power

The exponent must be positive.

bigIntegral i ⇒ i → Integer

every integral number can be converted to a big Integer

divIntegral i ⇒ i → i → i
infixl  14

integer division

divModIntegral i ⇒ i → i → (i, i)
evenIntegral i ⇒ i → Bool
fromIntegral ∷ (Integral i, Num b) ⇒ i → b

every Num can be made from an Integral

gcdIntegral i ⇒ i → i → i

Integral.gcd x y is the non-negative factor of both x and y of which every common factor of x and y is also a factor; for example Integral.gcd 4 2 = 2, Integral.gcd (-4) 6 = 2, Integral.gcd 0 4 = 4. Integral.gcd 0 0 = 0. (That is, the common divisor that is \"greatest\" in the divisibility preordering.)

Note: Since for signed fixed-width integer types, Num.abs Bounded.minBound < 0, the result may be negative if one of the arguments is Bounded.minBound (and necessarily is if the other is 0 or Bounded.minBound) for such types.

gcdHelperIntegral i ⇒ i → i → i

worker function for Integral.gcd, needs not pollute the namespace

lcmIntegral i ⇒ i → i → i

Integral.lcm x y is the smallest positive integer that both x and y divide.

modIntegral i ⇒ i → i → i
infixl  14

This modulo operator works so that

 forAll arbitrary (\a -> forAll arbitrary (\b -> (a `div` b) * b + (a `mod` b) = a))

In addition, it is the case that

 forAll arbitrary (\a -> forAll arbitrary (\b -> @(a `quot` b) == (a `div` b) || (a `quot` b) == (a `div` b)-1))   
oddIntegral i ⇒ i → Bool
powf ∷ (Integral i, Num a) ⇒ a → i → a

helper for Integral.^

powg ∷ (Integral i, Num a) ⇒ a → i → a → a

helper for Integral.^

quotIntegral i ⇒ i → i → i
infixl  14
quotRemIntegral i ⇒ i → i → (i, i)

Haskell compatibility

remIntegral i ⇒ i → i → i
infixl  14

The remainder á la Java operator % - a `rem` b has same sign as a

 forAll arbitrary (\a -> forAll arbitrary (\b -> (a `quot` b) * b + (a `rem` b) = a

This behaviour is the same as in Haskell

class Bounded b

A class for data types that have a lower and an upper bound.

Instances of Bounded can be derived automatically for enumeration types.

Known Instances

Int, Bool, Char, Long

Member Functions

maxBoundBounded b ⇒ b

the upper bound

minBoundBounded b ⇒ b

the lower bound

chrIntChar
ctosCharString
pure native java.lang.Character.toString

make a String from a single Char

data Maybe a

Constructors

Just a
Nothing
maybe ∷ α → (β→α) → Maybe β → α

The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Maybe.Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Maybe.Just and returns the result.

data (a | b)

Constructors

Left a
Right b
either ∷ (α→γ) → (β→γ) → (α | β) → γ
infixl  2

apply first function to value in Either.Left or second function to value in Either.Right

fst(α, β) → α

return the first element of a 2-tuple

snd(α, β) → β

return the second element of a 2-tuple

!:α → [α] → [α]
infixr  4

A head strict variant of (:)

This will be used in list comprehensions

idα → α
$ ∷ (β→α) → β → α
infixr  1

a $ b is the same as a b, but because of $'s low precedence one can write f $ x+y instead of f (x+y). Also, because $ is right associative, f $ g $ h y is f (g (h y))

$! ∷ (α→β) → α → β
infixr  1

Same as `$` but argument is strict

constα → β → α

const a is a function that returns a regardless of its argument.

asTypeOfa → a → a

asTypeOf a b is a with the type of b.

This is a type restricted version of const.

flip ∷ (β→γ→α) → γ → β → α

Exchange first and second argument of a function, i.e.

 flip f a b = f b a   
uncurry ∷ (γ→β→α) → (γ, β) → α

Passes the elements of a 2-tuple as arguments to a function.

curry ∷ ((α, γ)→β) → α → γ → β

curry f passes the next two arguments as 2-tuple to f

@ ∷ β → α → ()
infixr  2

In patterns, the @-operator is used to bind a name to a complex pattern

 f (x@a:as) = e

is the same as

 f arg = case arg of { x -> case x of { a:as -> e }}   
usingEq α ⇒ (β→α) → β → β → Bool

using f applies a projection function f on both sides of Eq.==. Example usage:

 uniqBy (using fst) [(1, 1), (2, 2), (2, 3), (3,4), (2,5)]
comparingOrd β ⇒ (α→β) → α → α → Ordering

comparing f applies a projection function on both sides of Ord.<=>. Example usage:

 sortBy (comparing snd) [(1, "z"), (2, "b")] == [(2, "b"), (1, "z")]
ascendingOrd β ⇒ (α→β) → α → α → Ordering

Alias for comparing

descendingOrd α ⇒ (β→α) → β → β → Ordering

descending f applies a projection function on both sides of Ord.<=>, but flips arguments. Example usage:

 sortBy (descending fst) [(1, "z"), (2, "b")] == [(2, "b"), (1, "z")]
on ∷ (β→β→α) → (γ→β) → γ → γ → α
infixl  1
 g `on` f

Apply a projection function f on both operands of g

 comparing f = (<=>) `on` f   
data ST s a

(ST s a) is an abstract data type and is a computation that encapsulates side effects in state thread s and returns a value of type a.

The type s can be understood as a compiler generated unique index for state threads. Every state thread is independent of each other and keeps track of mutable variables created in it. For detailed information, read the paper Lazy Functional State Threads.

Every mutable native data type shall be wrapped in a Mutable with phantom type parameter s. that tells to what state thread the value belongs. For example, the new method of the java class java.util.Date could be accessed like this:

 data Date s = native java.util.Date where
     native new :: Long -> ST s (Mutable s Date)

Inside ST actions, Date values can be created and manipulated with impure native methods at will. However, such a value can never escape its ST thread.

Because ST s is an instance of Monad, ST actions can be combined, which ensures sequenced execution. For example, we could add another method to the Date type that converts the date to a string:

     native toString :: Mutable s Date -> ST s String

and a computation which yields the current time in string form:

 epoch = do
    date <- Date.new 0L
    return date.toString

This looks almost like java already! epoch has type ST s String and we can run the computation with epoch.run (see ST.run below), which gives us a nice, pure, immutable, functional, correct String value.

The IO type is just an alias for ST RealWorld, and can be thought of as indexing a unique global state thread. Values of type IO a are also called IO actions.

Any ST value can also be used in the IO thread.

This guarantees that

Constructors

private ST (s → a)

Member Functions

>>=ST u a → (a → ST u b) → ST u b
infixl  3
performUnsafeIO a → a

warning: You are breaking the rules. Expect an arbitrary result and program crashes.

return ∷ β → ST α β
run ∷ ( ß.ST ß a) → a

nowarn: performUnsafe

Run a stateful action with type ST r a and return a result of type a. The overall computation ST.run st is pure, though inside the ST action local mutable state can be employed.

This is possible only if the result type a of the state action does not mention r and if r is a type variable. Hence, it is not possible to ST.run an IO action.

data RealWorld = pure native frege.runtime.Phantom.RealWorld

This abstract data type identifies the global state (disk, network, you name it). Values of type ST RealWorld a are likely to perform input/output, manipulate global data and so on.

type IO = ST RealWorld

IO a is an abbreviation for ST RealWorld a

traceStrStringIO ()
native java.lang.System.err.print

warning: use stderr.print instead

print a String to the standard error stream

traceStrLnStringIO ()
native java.lang.System.err.println

warning: use stderr.println instead

print a String to the standard error stream and append a new line.

printStrStringIO ()
native java.lang.System.out.print

warning: use stdout.print instead

print a String to the standard output stream

printStrLnStringIO ()
native java.lang.System.out.println

warning: use stdout.println instead

print a String to the standard output stream and append a new line.

Instances

instance Bounded Bool

Member Functions

maxBoundBool
minBoundBool
instance Bounded Char

Member Functions

maxBoundChar
pure native java.lang.Character.MAX_VALUE
minBoundChar
pure native java.lang.Character.MIN_VALUE
instance Bounded Int

Member Functions

maxBoundInt

the largest Int value 2147483647 (or (2**31)-1)

minBoundInt

the smallest Int value -2147483648 (or -(2**31))

instance Bounded Long

Member Functions

maxBoundLong

the largest Long value 9223372036854775807 (or (2**63)-1)

minBoundLong

the smallest Long value -9223372036854775808 (or -(2**63))

instance Enum Bool

Member Functions

enumFromBool → [Bool]
enumFromThenBoolBool → [Bool]
enumFromThenToBoolBoolBool → [Bool]
enumFromToBoolBool → [Bool]
fromIntBool
ordBoolInt
predBoolBool
succBoolBool
instance Enum Char

Member Functions

enumFromChar → [Char]
enumFromThenCharChar → [Char]
enumFromThenToCharCharChar → [Char]
enumFromToCharChar → [Char]
fromIntChar
pure native (char)
ordCharInt
pure native (int)

c.ord is the ordinal (integer) value of the character c. It holds: c.ord.char == c, see Int.char. (But note that i.char.ord is not necessarily i)

predCharChar
succCharChar
instance Enum Int

Member Functions

enumFromInt → [Int]
enumFromThenIntInt → [Int]
enumFromThenToIntIntInt → [Int]
enumFromToIntInt → [Int]
fromIntInt
 from i = i   
ordIntInt
 ord i = i   
predIntInt

pred i is the same as i-1 except for pred Int.minBound, which is undefined

succIntInt

succ i is the same as i+1 except for succ Int.maxBound, which is undefined

instance Enum Integer

Integer is an instance of Enum

Member Functions

enumFromInteger → [Integer]
enumFromThenIntegerInteger → [Integer]
enumFromThenToIntegerIntegerInteger → [Integer]
enumFromToIntegerInteger → [Integer]
fromIntInteger

Integer.from i is the same as Int.big i

ordIntegerInt

ord b is only defined if the value of b is in the range Bounded_Int.minBound .. Bounded_Int.maxBound

predIntegerInteger

succ b is the same as b + 1.big

succIntegerInteger

succ b is the same as b + 1.big

instance Enum Long

Member Functions

enumFromLong → [Long]
enumFromThenLongLong → [Long]
enumFromThenToLongLongLong → [Long]
enumFromToLongLong → [Long]
fromIntLong

Long.from i returns a Long with the same numeric value as i.

ordLongInt

ord l is only valid if Int.minBound.long <= l && l <= Int.maxBound

predLongLong

pred a is the same as a-1L except for pred Long.minBound, which is undefined

succLongLong

succ a is the same as a+1L except for succ Long.maxBound, which is undefined

instance Eq ()

Member Functions

!=()()Bool
infix  7
==()()Bool
infix  7
hashCode()Int
instance Eq Bool

Member Functions

!=BoolBoolBool
pure native !=
infix  7
==BoolBoolBool
pure native ==
infix  7
hashCodeBoolInt
instance Eq Char

Member Functions

!=CharCharBool
pure native !=
infix  7
==CharCharBool
pure native ==
infix  7
hashCodeCharInt
pure native (int)
instance Eq Double

Member Functions

!=DoubleDoubleBool
pure native !=
infix  7
==DoubleDoubleBool
pure native ==
infix  7
hashCodeDoubleInt

the Eq.hashCode is that of the Long value used to represent the Double

instance Eq Float

Member Functions

!=FloatFloatBool
pure native !=
infix  7
==FloatFloatBool
pure native ==
infix  7
hashCodeFloatInt
pure native java.lang.Float.floatToIntBits

bit representation of a float serves as hashCode

instance Eq Int

Member Functions

!=IntIntBool
pure native !=
infix  7

Uses the java != operator for comparison of Int values.

==IntIntBool
pure native ==
infix  7

Uses the java == operator for comparison of Int values.

hashCodeIntInt

The Eq.hashCode of an Int is the identity

instance Eq Long

Member Functions

!=LongLongBool
pure native !=
infix  7

Uses the java != operator for comparison of Long values.

==LongLongBool
pure native ==
infix  7

Uses the java == operator for comparison of Long values.

hashCodeLongInt

hash code is upper half and lower half xor'ed

instance Eq String

Member Functions

!=StringStringBool
infix  7
==StringStringBool
pure native equals
infix  7
hashCodeStringInt
pure native hashCode

get the hash code

instance Eq a ⇒ Eq [a]

Member Functions

!=Eq α ⇒ [α][α]Bool
infix  7

inherited from Eq.!=

==Eq α ⇒ [α][α]Bool
infix  7

two lists are equal if their heads and tails are equal or if the lists are empty

hashCodeEq α ⇒ [α]Int
instance Integral Int

Member Functions

^Num α ⇒ αInt → α
infixr  15

inherited from Integral.^

bigIntInteger
divIntIntInt
infixl  14

inherited from Integral.div

divModIntInt → (Int, Int)

inherited from Integral.divMod

evenIntBool
fromIntegralNum α ⇒ Int → α

inherited from Integral.fromIntegral

gcdIntIntInt

inherited from Integral.gcd

gcdHelperIntIntInt

inherited from Integral.gcdHelper

lcmIntIntInt

inherited from Integral.lcm

modIntIntInt
infixl  14

inherited from Integral.mod

oddIntBool
powfNum α ⇒ αInt → α

inherited from Integral.powf

powgNum α ⇒ αIntα → α

inherited from Integral.powg

quotIntIntInt
pure native /
infixl  14
quotRemIntInt → (Int, Int)

inherited from Integral.quotRem

remIntIntInt
pure native %
infixl  14
instance Integral Integer

Integer is an instance of Integral

Member Functions

*IntegerIntegerInteger
pure native multiply
infixl  14
+IntegerIntegerInteger
pure native add
infixl  13
-IntegerIntegerInteger
pure native subtract
infixl  13
^Num α ⇒ αInteger → α
infixr  15

inherited from Integral.^

absIntegerInteger
pure native abs
bigIntegerInteger
divIntegerIntegerInteger
infixl  14

inherited from Integral.div

divModIntegerInteger → (Integer, Integer)

inherited from Integral.divMod

evenIntegerBool
fromIntIntInteger
fromIntegerIntegerInteger
fromIntegralNum α ⇒ Integer → α

inherited from Integral.fromIntegral

gcdIntegerIntegerInteger
pure native gcd
gcdHelperIntegerIntegerInteger

inherited from Integral.gcdHelper

isInfiniteIntegerBool

inherited from Num.isInfinite

isNaNIntegerBool

inherited from Num.isNaN

isNumberIntegerBool

inherited from Num.isNumber

lcmIntegerIntegerInteger

inherited from Integral.lcm

modIntegerIntegerInteger
infixl  14

inherited from Integral.mod

negateIntegerInteger
pure native negate
oddIntegerBool
oneInteger
pure native java.math.BigInteger.ONE
powfNum α ⇒ αInteger → α

inherited from Integral.powf

powgNum α ⇒ αIntegerα → α

inherited from Integral.powg

quotIntegerIntegerInteger
pure native divide
infixl  14
quotRemIntegerInteger → (Integer, Integer)

inherited from Integral.quotRem

remIntegerIntegerInteger
pure native remainder
infixl  14
signIntegerInt
pure native signum
subtractIntegerIntegerInteger

inherited from Num.subtract

zeroInteger
pure native java.math.BigInteger.ZERO
instance Integral Long

Member Functions

^Num α ⇒ αLong → α
infixr  15

inherited from Integral.^

bigLongInteger
divLongLongLong
infixl  14

inherited from Integral.div

divModLongLong → (Long, Long)

inherited from Integral.divMod

evenLongBool
fromIntegralNum α ⇒ Long → α

inherited from Integral.fromIntegral

gcdLongLongLong

inherited from Integral.gcd

gcdHelperLongLongLong

inherited from Integral.gcdHelper

lcmLongLongLong

inherited from Integral.lcm

modLongLongLong
infixl  14

inherited from Integral.mod

oddLongBool
powfNum α ⇒ αLong → α

inherited from Integral.powf

powgNum α ⇒ αLongα → α

inherited from Integral.powg

quotLongLongLong
pure native /
infixl  14
quotRemLongLong → (Long, Long)

inherited from Integral.quotRem

remLongLongLong
pure native %
infixl  14
instance Num Int

Member Functions

*IntIntInt
pure native *
infixl  14

Uses the java * operator to multiply 2 Int values.

+IntIntInt
pure native +
infixl  13

Uses the java + operator to add 2 Int values.

-IntIntInt
pure native -
infixl  13

Uses the java - operator to subtract one Int value from another.

absIntInt

Returns the negated argument if it is negative, otherwise the argument itself.

This does not work for Bounded_Int.minBound since there is no corresponding positive value that can be represented as an Int. Rather

 abs Int.minBound == Int.minBound
fromIntIntInt

For Int values, this is the identity function.

fromIntegerIntegerInt
isInfiniteIntBool

inherited from Num.isInfinite

isNaNIntBool

inherited from Num.isNaN

isNumberIntBool

inherited from Num.isNumber

negateIntInt
pure native -

negate i computes 0-i using the java negation operator -.

This does not work for Bounded_Int.minBound since there is no corresponding positive value that can be represented as an Int. Rather

 negate Int.minBound == Int.minBound
oneInt

the integer constant 1

signIntInt

inherited from Num.sign

subtractIntIntInt

inherited from Num.subtract

zeroInt

the integer constant 0

instance Num Long

Member Functions

*LongLongLong
pure native *
infixl  14

Uses the java * operator to multiply two Long values.

+LongLongLong
pure native +
infixl  13

Uses the java + operator to add two Long values.

-LongLongLong
pure native -
infixl  13

Uses the java - operator to subtract a Long value from another.

absLongLong

Returns the negated argument if it is negative, otherwise the argument itself.

This does not work for Bounded_Long.minBound since there is no corresponding positive value that can be represented as a Long. Rather

 abs Long.minBound == Long.minBound
fromIntIntLong

applies the widening primitive conversion (JLS §5.1.2) from int to long

fromIntegerIntegerLong
isInfiniteLongBool

inherited from Num.isInfinite

isNaNLongBool

inherited from Num.isNaN

isNumberLongBool

inherited from Num.isNumber

negateLongLong
pure native -

negate a computes 0L-a using the java negation operator -.

This does not work for Bounded_Long.minBound since there is no corresponding positive value that can be represented as a Long. Rather

 negate Long.minBound == Long.minBound
oneLong

The constant 1L.

signLongInt

inherited from Num.sign

subtractLongLongLong

inherited from Num.subtract

zeroLong

The constant 0L.

instance Ord Bool

Member Functions

<BoolBoolBool
infix  9
<=BoolBoolBool
infix  9
<=>BoolBoolOrdering
infix  8
>BoolBoolBool
infix  9
>=BoolBoolBool
infix  9
compareBoolBoolOrdering
infix  8

inherited from Ord.compare

maxBoolBoolBool

inherited from Ord.max

minBoolBoolBool

inherited from Ord.min

instance Ord Char

Member Functions

<CharCharBool
pure native <
infix  9
<=CharCharBool
pure native <=
infix  9
<=>CharCharOrdering
infix  8
>CharCharBool
pure native >
infix  9
>=CharCharBool
pure native >=
infix  9
compareCharCharOrdering
infix  8

inherited from Ord.compare

maxCharCharChar

inherited from Ord.max

minCharCharChar

inherited from Ord.min

instance Ord Double

Member Functions

<DoubleDoubleBool
pure native <
infix  9
<=DoubleDoubleBool
pure native <=
infix  9
<=>DoubleDoubleOrdering
infix  8
>DoubleDoubleBool
pure native >
infix  9
>=DoubleDoubleBool
pure native >=
infix  9
compareDoubleDoubleOrdering
infix  8

inherited from Ord.compare

maxDoubleDoubleDouble

inherited from Ord.max

minDoubleDoubleDouble

inherited from Ord.min

instance Ord Float

Member Functions

<FloatFloatBool
pure native <
infix  9
<=FloatFloatBool
pure native <=
infix  9
<=>FloatFloatOrdering
infix  8
>FloatFloatBool
pure native >
infix  9
>=FloatFloatBool
pure native >=
infix  9
compareFloatFloatOrdering
infix  8

inherited from Ord.compare

maxFloatFloatFloat

inherited from Ord.max

minFloatFloatFloat

inherited from Ord.min

instance Ord Int

Member Functions

<IntIntBool
pure native <
infix  9

Uses the java < operator for comparison of Int values.

<=IntIntBool
pure native <=
infix  9

Uses the java <= operator for comparison of Int values.

<=>IntIntOrdering
infix  8
>IntIntBool
pure native >
infix  9

Uses the java > operator for comparison of Int values.

>=IntIntBool
pure native >=
infix  9

Uses the java >= operator for comparison of Int values.

compareIntIntOrdering
infix  8

inherited from Ord.compare

maxIntIntInt

inherited from Ord.max

minIntIntInt

inherited from Ord.min

instance Ord Integer

Integer is an instance of Ord

Member Functions

!=IntegerIntegerBool
infix  7
<IntegerIntegerBool
infix  9
<=IntegerIntegerBool
infix  9
<=>IntegerIntegerOrdering
infix  8
==IntegerIntegerBool
infix  7
>IntegerIntegerBool
infix  9
>=IntegerIntegerBool
infix  9
compareIntegerIntegerOrdering
infix  8

inherited from Ord.compare

hashCodeIntegerInt
pure native hashCode
maxIntegerIntegerInteger
pure native max
minIntegerIntegerInteger
pure native min
instance Ord Long

Member Functions

<LongLongBool
pure native <
infix  9

Uses the java < operator for comparison of Long values.

<=LongLongBool
pure native <=
infix  9

Uses the java <= operator for comparison of Long values.

<=>LongLongOrdering
infix  8
>LongLongBool
pure native >
infix  9

Uses the java > operator for comparison of Long values.

>=LongLongBool
pure native >=
infix  9

Uses the java >= operator for comparison of Long values.

compareLongLongOrdering
infix  8

inherited from Ord.compare

maxLongLongLong

inherited from Ord.max

minLongLongLong

inherited from Ord.min

instance Ord String

Member Functions

<StringStringBool
infix  9
<=StringStringBool
infix  9
<=>StringStringOrdering
infix  8
>StringStringBool
infix  9
>=StringStringBool
infix  9
compareStringStringOrdering
infix  8

inherited from Ord.compare

maxStringStringString

inherited from Ord.max

minStringStringString

inherited from Ord.min

instance Real Double

Member Functions

*DoubleDoubleDouble
pure native *
infixl  14
+DoubleDoubleDouble
pure native +
infixl  13
-DoubleDoubleDouble
pure native -
infixl  13
/DoubleDoubleDouble
pure native /
infixl  14
absDoubleDouble

inherited from Num.abs

fromDoubleDoubleDouble
fromIntIntDouble
fromIntegerIntegerDouble
isInfiniteDoubleBool
pure native java.lang.Double.isInfinite
isNaNDoubleBool
pure native java.lang.Double.isNaN
isNumberDoubleBool

inherited from Num.isNumber

negateDoubleDouble
pure native -
oneDouble
signDoubleInt

inherited from Num.sign

subtractDoubleDoubleDouble

inherited from Num.subtract

zeroDouble
instance Real Float

Member Functions

*FloatFloatFloat
pure native *
infixl  14
+FloatFloatFloat
pure native +
infixl  13
-FloatFloatFloat
pure native -
infixl  13
/FloatFloatFloat
pure native /
infixl  14
absFloatFloat

inherited from Num.abs

fromDoubleDoubleFloat
fromIntIntFloat
fromIntegerIntegerFloat
isInfiniteFloatBool
pure native java.lang.Float.isInfinite
isNaNFloatBool
pure native java.lang.Float.isNaN
isNumberFloatBool

inherited from Num.isNumber

negateFloatFloat
pure native -
oneFloat
signFloatInt

inherited from Num.sign

subtractFloatFloatFloat

inherited from Num.subtract

zeroFloat

Functions and Values by Type

StringStringString

Ord_String.min, Ord_String.max

StringStringBool

Eq_String.!=, Eq_String.==, Ord_String.>, Ord_String.<, Ord_String.<=, Ord_String.>=, StringJ.startsWith

StringStringInt

StringJ.compareTo

StringStringOrdering

Ord_String.compare, Ord_String.<=>

StringCharInt

StringJ.indexOf

StringIntChar

StringJ.charAt

StringThrowableUndefined

Undefined.newβ

String → (NumberFormatException | Double)

StringJ.double

String → (NumberFormatException | Float)

StringJ.float

String → (NumberFormatException | Int)

StringJ.int

String → (NumberFormatException | Integer)

StringJ.integer

String → (NumberFormatException | Long)

StringJ.long

StringIO ()

printStr, printStrLn, traceStr, traceStrLn, StringJ.wait, StringJ.notifyAll, StringJ.notify

StringString

StringJ.toLowerCase, StringJ.toUpperCase, StringJ.quoteReplacement, StringJ.quote

StringDouble

StringJ.atod

StringFloat

StringJ.atof

StringInt

atoi, Eq_String.hashCode, StringJ.atoi

StringInteger

StringJ.aton

StringLong

StringJ.atol

StringUndefined

Undefined.newα

()()Bool

Eq_().!=, Eq_().==

()Int

Eq_().hashCode

BoolBoolBool → [Bool]

Enum_Bool.enumFromThenTo

BoolBool → [Bool]

Enum_Bool.enumFromTo, Enum_Bool.enumFromThen

BoolBoolBool

&&, ^^, oder, und, ||, Eq_Bool.!=, Eq_Bool.==, Ord_Bool.min, Ord_Bool.max, Ord_Bool.>, Ord_Bool.<, Ord_Bool.<=, Ord_Bool.>=

BoolBoolOrdering

Ord_Bool.compare, Ord_Bool.<=>

Bool → [Bool]

Enum_Bool.enumFrom

BoolBool

!, not, Enum_Bool.succ, Enum_Bool.pred

BoolInt

Enum_Bool.ord, Eq_Bool.hashCode

CharCharChar → [Char]

Enum_Char.enumFromThenTo

CharChar → [Char]

Enum_Char.enumFromTo, Enum_Char.enumFromThen

CharCharBool

Eq_Char.!=, Eq_Char.==, Ord_Char.>, Ord_Char.<, Ord_Char.<=, Ord_Char.>=, Char.isSurrogatePair

CharCharChar

Ord_Char.min, Ord_Char.max

CharCharInt

Char.toCodePoint

CharCharOrdering

Ord_Char.compare, Ord_Char.<=>

CharIntInt

Char.digit

CharMaybe String

Char.getNameα

CharString

ctos

Char → [Char]

Enum_Char.enumFrom

CharBool

Char.isUpperCaseα, Char.isWhitespaceα, Char.isSurrogate, Char.isLowSurrogate, Char.isLetterα, Char.isLowerCaseα, Char.isLetterOrDigitα, Char.isHighSurrogate, Char.isDigitα, Char.isDefinedα, Char.isISOControlα

CharChar

Enum_Char.pred, Enum_Char.succ, Char.toUpperCaseα, Char.toTitleCaseα, Char.toLowerCaseα

CharInt

Enum_Char.ord, Eq_Char.hashCode, Char.getTypeα

DoubleDoubleBool

Eq_Double.!=, Eq_Double.==, Ord_Double.>, Ord_Double.<, Ord_Double.<=, Ord_Double.>=

DoubleDoubleDouble

Ord_Double.min, Ord_Double.max, Real_Double.subtract, Real_Double./, Real_Double.*, Real_Double.+, Real_Double.-

DoubleDoubleOrdering

Ord_Double.compare, Ord_Double.<=>

DoubleBool

Real_Double.isNumber, Real_Double.isInfinite, Real_Double.isNaN

DoubleDouble

Real_Double.fromDouble, Real_Double.abs, Real_Double.negate

DoubleFloat

Real_Float.fromDouble, Double.float

DoubleInt

Eq_Double.hashCode, Real_Double.sign

DoubleLong

Double.long, Double.longBits

FloatFloatBool

Eq_Float.!=, Eq_Float.==, Ord_Float.>, Ord_Float.<, Ord_Float.<=, Ord_Float.>=

FloatFloatFloat

Ord_Float.min, Ord_Float.max, Real_Float.subtract, Real_Float./, Real_Float.*, Real_Float.+, Real_Float.-

FloatFloatOrdering

Ord_Float.compare, Ord_Float.<=>

FloatBool

Real_Float.isNumber, Real_Float.isInfinite, Real_Float.isNaN

FloatDouble

Float.double

FloatFloat

Real_Float.abs, Real_Float.negate

FloatInt

Eq_Float.hashCode, Real_Float.sign, Float.int

IntIntInt → [Int]

Enum_Int.enumFromThenTo

IntInt → (Int, Int)

Integral_Int.quotRem, Integral_Int.divMod

IntInt → [Int]

Enum_Int.enumFromTo, Enum_Int.enumFromThen

IntIntBool

Eq_Int.!=, Eq_Int.==, Ord_Int.>, Ord_Int.<, Ord_Int.<=, Ord_Int.>=

IntIntChar

Char.forDigit

IntIntInt

Integral_Int.rem, Integral_Int.quot, Integral_Int.mod, Integral_Int.gcdHelper, Integral_Int.gcd, Integral_Int.div, Integral_Int.lcm, Num_Int.subtract, Num_Int.-, Num_Int.*, Num_Int.+, Ord_Int.min, Ord_Int.max, Int.ushiftR, Int.shiftL, Int.shiftR, Int.rotateL, Int.rotateR, Int..^., Int..&., Int..|.

IntIntOrdering

Ord_Int.compare, Ord_Int.<=>

IntMaybe String

Char.getNameβ

IntString

Int.toHexString, StringJ.intToString

Int → [Int]

Enum_Int.enumFrom

IntBool

Enum_Bool.from, Integral_Int.odd, Integral_Int.even, Num_Int.isNaN, Num_Int.isNumber, Num_Int.isInfinite, Char.isWhitespaceβ, Char.isValidCodePoint, Char.isUpperCaseβ, Char.isLowerCaseβ, Char.isSupplementaryCodePoint, Char.isLetterβ, Char.isISOControlβ, Char.isLetterOrDigitβ, Char.isDigitβ, Char.isDefinedβ

IntChar

chr, Enum_Char.from, Char.lowSurrogate, Char.highSurrogate, Int.char

IntDouble

Real_Double.fromInt, Int.double

IntFloat

Real_Float.fromInt, Int.float

IntInt

?, Enum_Int.succ, Enum_Int.ord, Enum_Int.from, Enum_Int.pred, Eq_Int.hashCode, Num_Int.negate, Num_Int.sign, Num_Int.fromInt, Num_Int.abs, Char.toUpperCaseβ, Char.toTitleCaseβ, Char.toLowerCaseβ, Char.getTypeβ, Int.complement

IntInteger

Enum_Integer.from, Integral_Int.big, Integral_Integer.fromInt

IntLong

Enum_Long.from, Num_Long.fromInt, Int.long

IntegerIntInteger

Integer.ushiftR, Integer.shiftR, Integer.shiftL

IntegerIntegerInteger → [Integer]

Enum_Integer.enumFromThenTo

IntegerInteger → (Integer, Integer)

Integral_Integer.quotRem, Integral_Integer.divMod

IntegerInteger → [Integer]

Enum_Integer.enumFromThen, Enum_Integer.enumFromTo

IntegerIntegerBool

Ord_Integer.>, Ord_Integer.==, Ord_Integer.!=, Ord_Integer.<, Ord_Integer.<=, Ord_Integer.>=

IntegerIntegerInt

Integer.compareTo

IntegerIntegerInteger

Integral_Integer.subtract, Integral_Integer.quot, Integral_Integer.rem, Integral_Integer.lcm, Integral_Integer.mod, Integral_Integer.gcd, Integral_Integer.gcdHelper, Integral_Integer.div, Integral_Integer.+, Integral_Integer.*, Integral_Integer.-, Ord_Integer.min, Ord_Integer.max, Integer.nMod, Integer..^., Integer..&., Integer..|.

IntegerIntegerOrdering

Ord_Integer.compare, Ord_Integer.<=>

IntegerString

Integer.toString

Integer → [Integer]

Enum_Integer.enumFrom

IntegerBool

Integral_Integer.odd, Integral_Integer.isNaN, Integral_Integer.isInfinite, Integral_Integer.even, Integral_Integer.isNumber

IntegerDouble

Real_Double.fromInteger, Integer.double

IntegerFloat

Real_Float.fromInteger

IntegerInt

Enum_Integer.ord, Integral_Integer.sign, Num_Int.fromInteger, Ord_Integer.hashCode, Integer.int, Integer.bitLength

IntegerInteger

Enum_Integer.succ, Enum_Integer.pred, Integral_Integer.negate, Integral_Integer.fromInteger, Integral_Integer.big, Integral_Integer.abs, Integer.complement

IntegerLong

Num_Long.fromInteger, Integer.long

LongIntLong

Long.ushiftR, Long.shiftL, Long.rotateL, Long.rotateR, Long.shiftR

LongLongLong → [Long]

Enum_Long.enumFromThenTo

LongLong → (Long, Long)

Integral_Long.quotRem, Integral_Long.divMod

LongLong → [Long]

Enum_Long.enumFromTo, Enum_Long.enumFromThen

LongLongBool

Eq_Long.!=, Eq_Long.==, Ord_Long.>, Ord_Long.<, Ord_Long.<=, Ord_Long.>=

LongLongLong

Integral_Long.rem, Integral_Long.quot, Integral_Long.mod, Integral_Long.gcdHelper, Integral_Long.gcd, Integral_Long.div, Integral_Long.lcm, Num_Long.subtract, Num_Long.-, Num_Long.*, Num_Long.+, Ord_Long.min, Ord_Long.max, Long..^., Long..&., Long..|.

LongLongOrdering

Ord_Long.compare, Ord_Long.<=>

Long → [Long]

Enum_Long.enumFrom

LongBool

Integral_Long.odd, Integral_Long.even, Num_Long.isNaN, Num_Long.isNumber, Num_Long.isInfinite

LongDouble

Long.double

LongFloat

Long.float

LongInt

Enum_Long.ord, Eq_Long.hashCode, Num_Long.sign, Long.int

LongInteger

Integral_Long.big, Integer.valueOf

LongLong

Enum_Long.succ, Enum_Long.pred, Num_Long.negate, Num_Long.abs, Long.complement

ObjectIO ()

Object.wait, Object.notify, Object.notifyAll

ThrowableIO ()

Throwable.printStackTrace

ThrowableString

Throwable.getMessage, Throwable.caught, Throwable.getLocalizedMessage

ThrowableUndefined

Undefined.newX

UndefinedBool

Undefined.die

()

().()

Bool

otherwise, Bounded_Bool.minBound, Bounded_Bool.maxBound

Char

Bounded_Char.minBound, Bounded_Char.maxBound

Double

Real_Double.zero, Real_Double.one

Float

Real_Float.zero, Real_Float.one

HaskellBool

HaskellBool.False, HaskellBool.True

Int

Bounded_Int.minBound, Bounded_Int.maxBound, Num_Int.zero, Num_Int.one, Int.size, Long.size

Integer

Integral_Integer.zero, Integral_Integer.one, Integer.ten

Long

Bounded_Long.minBound, Bounded_Long.maxBound, Num_Long.zero, Num_Long.one

Ordering

Ordering.Lt, Ordering.Eq, Ordering.Gt

IO a → a

ST.performUnsafe

Class a → String

Class.getName

String → a → String

StringJ.formatα

StringIO (ClassNotFoundException | Class a)

Class.forName

String → u

error

StringJ a → StringJ a → StringJ a

StringJ.++

StringJ a → IntIntStringJ a

substr, StringJ.substr

StringJ a → IntStringJ a

strtail

StringJ a → Int → a

StringJ.polymorphicElemAt

StringJ a → Int

StringJ.length

Bool → α → α → α

lazyif

Throwable → α

throw

a → [a] → [a]

[].:

a → a → Bool

!==, ===

a → a → a

asTypeOf

a → Class a

Object.getClass

a → Maybe a

Maybe.Just

a → Int

constructor

α → [α] → [α]

!:

α → α → Bool → α

bool

α → α

id

( ß.ST ß a) → a

ST.run

Enum e ⇒ Int → e

Enum.from

Enum e ⇒ e → e → e → [e]

Enum.enumFromThenTo

Enum e ⇒ e → e → [e]

Enum.enumFromTo, Enum.enumFromThen

Enum e ⇒ e → e → Ordering

Enum.<=>

Enum e ⇒ e → [e]

Enum.enumFrom

Enum e ⇒ e → Int

Enum.ord, Enum.hashCode

Enum e ⇒ e → e

Enum.succ, Enum.pred

Eq e ⇒ e → e → Bool

Eq.!=, Eq.==

Eq e ⇒ e → Int

Eq.hashCode

Eq α ⇒ [α] → [α] → Bool

Eq_[].!=, Eq_[].==

Eq α ⇒ [α] → Int

Eq_[].hashCode

Integral i ⇒ i → i → (i, i)

Integral.quotRem, Integral.divMod

Integral i ⇒ i → i → i

Integral.rem, Integral.mod, Integral.quot, Integral.gcdHelper, Integral.gcd, Integral.div, Integral.lcm

Integral i ⇒ i → Bool

Integral.odd, Integral.even

Integral i ⇒ i → Integer

Integral.big

Num n ⇒ Int → n

Num.fromInt

Num n ⇒ Integer → n

Num.fromInteger

Num n ⇒ n → n → n

Num.subtract, Num.-, Num.*, Num.+

Num n ⇒ n → Bool

Num.isInfinite, Num.isNaN, Num.isNumber

Num n ⇒ n → Int

Num.sign

Num n ⇒ n → n

Num.negate, Num.abs

Num α ⇒ Int → α

Integral_Int.fromIntegral

Num α ⇒ Integer → α

Integral_Integer.fromIntegral

Num α ⇒ Long → α

Integral_Long.fromIntegral

Num α ⇒ α → Int → α → α

Integral_Int.powg

Num α ⇒ α → Int → α

Integral_Int.powf, Integral_Int.^

Num α ⇒ α → Integer → α → α

Integral_Integer.powg

Num α ⇒ α → Integer → α

Integral_Integer.powf, Integral_Integer.^

Num α ⇒ α → Long → α → α

Integral_Long.powg

Num α ⇒ α → Long → α

Integral_Long.powf, Integral_Long.^

Ord o ⇒ o → o → Bool

Ord.>=, Ord.==, Ord.<=, Ord.!=, Ord.<, Ord.>

Ord o ⇒ o → o → Ordering

Ord.compare, Ord.<=>

Ord o ⇒ o → o → o

Ord.min, Ord.max

Real r ⇒ Double → r

Real.fromDouble

Real r ⇒ r → r → r

Real./

Maybe a

Maybe.Nothing

[a]

[].[]

u

undefined

ω

Char.toUpperCase, Char.toTitleCase, Char.toLowerCase, Char.isWhitespace, Char.isUpperCase, Char.isLowerCase, Char.isLetter, Char.isLetterOrDigit, Char.isISOControl, Char.isDigit, Char.isDefined, Char.getType, Char.getName, StringJ.format, Undefined.new

Bounded b ⇒ b

Bounded.minBound, Bounded.maxBound

Num n ⇒ n

Num.zero, Num.one

(s → a) → ST s a

ST.ST

(α, β) → α

fst

(α, β) → β

snd

(α→β) → α → β

$!

(β→α) → β → α

$

String → a → b → String

StringJ.formatβ

a → b → (a, b)

strictTuple2, (,).(,)

a → (a | b)

Either.Left

b → (a | b)

Either.Right

α → (β→α) → Maybe β → α

maybe

α → β → α

const

β → α → ()

@

β → α → α

seq

β → ST α β

ST.return

Eq α ⇒ (β→α) → β → β → Bool

using

(Integral i, Num a) ⇒ a → i → a → a

Integral.powg

(Integral i, Num a) ⇒ a → i → a

Integral.powf, Integral.^

(Integral i, Num b) ⇒ i → b

Integral.fromIntegral

Ord α ⇒ (β→α) → β → β → Ordering

descending

Ord β ⇒ (α→β) → α → α → Ordering

comparing

((α, γ)→β) → α → γ → β

curry

(α→γ) → (β→γ) → (α | β) → γ

either

(β→β→α) → (γ→β) → γ → γ → α

on

(β→γ→α) → γ → β → α

flip

(γ→β→α) → (γ, β) → α

uncurry

ST u a → (a → ST u b) → ST u b

ST.>>=

String → a → b → c → String

StringJ.formatγ

a → b → c → (a, b, c)

strictTuple3, (,,).(,,)

String → a → b → c → d → String

StringJ.formatδ

a → b → c → d → (a, b, c, d)

strictTuple4, (,,,).(,,,)

String → a → b → c → d → e → String

StringJ.formatε

a → b → c → d → e → (a, b, c, d, e)

strictTuple5, (,,,,).(,,,,)

String → a → b → c → d → e → f → String

StringJ.formatζ

a → b → c → d → e → f → (a, b, c, d, e, f)

strictTuple6, (,,,,,).(,,,,,)

String → a → b → c → d → e → f → g → String

StringJ.formatη

a → b → c → d → e → f → g → (a, b, c, d, e, f, g)

strictTuple7, (,,,,,,).(,,,,,,)

String → a → b → c → d → e → f → g → h → String

StringJ.formatθ

a → b → c → d → e → f → g → h → (a, b, c, d, e, f, g, h)

strictTuple8, (,,,,,,,).(,,,,,,,)

String → a → b → c → d → e → f → g → h → i → String

StringJ.formatι

a → b → c → d → e → f → g → h → i → (a, b, c, d, e, f, g, h, i)

strictTuple9, (,,,,,,,,).(,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → (a, b, c, d, e, f, g, h, i, j)

strictTuple10, (,,,,,,,,,).(,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → (a, b, c, d, e, f, g, h, i, j, k)

strictTuple11, (,,,,,,,,,,).(,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → (a, b, c, d, e, f, g, h, i, j, k, l)

strictTuple12, (,,,,,,,,,,,).(,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → (a, b, c, d, e, f, g, h, i, j, k, l, m)

strictTuple13, (,,,,,,,,,,,,).(,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → (a, b, c, d, e, f, g, h, i, j, k, l, m, n)

strictTuple14, (,,,,,,,,,,,,,).(,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

strictTuple15, (,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)

strictTuple16, (,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)

strictTuple17, (,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)

strictTuple18, (,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)

strictTuple19, (,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)

strictTuple20, (,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → u → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)

strictTuple21, (,,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → u → v → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)

strictTuple22, (,,,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → u → v → w → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)

strictTuple23, (,,,,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → u → v → w → x → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)

strictTuple24, (,,,,,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → u → v → w → x → y → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)

strictTuple25, (,,,,,,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,,,,,,)

a → b → c → d → e → f → g → h → i → j → k → l → m → n → o → p → q → r → s → t → u → v → w → x → y → z → (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)

strictTuple26, (,,,,,,,,,,,,,,,,,,,,,,,,,).(,,,,,,,,,,,,,,,,,,,,,,,,,)

Valid HTML 4.01 Strict