Package frege.prelude.PreludeBase

Compiled: Tue Dec 04 23:59:41 PST 2012 from source file: frege/prelude/PreludeBase.fr

Package Documentation

Copyright © 2011, 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 implicetly 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 programmaticaly 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.

Table of Content

Imports

Type Aliases

type Exception a = Exception a

This is the principal return type for java methods that are expected to throw exceptions.

type Frozen n = Frozen n

Frozen MyType is an abbrevation for MyType Immutable

type IO = IO

IO a is an abbrevation for ST RealWorld a

type IORef a = IORef a
type Mutable n s = Mutable n s

Mutable MyType s is an abbrevation for ST s (MyType s)

type String = String

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

Classes

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

Long, Char, Bool, Int

Member Functions

maxBound :: Bounded b => b

the upper bound

minBound :: Bounded b => b

the lower bound

class Enum (Eq e, Ord e) => 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.

Known Instances

Long, Int, Bool, Char, Integer

Member Functions

.. :: Enum e => e -> e -> [e]

a .. b is the list [a, succ a, succ (succ a), ..., b ] if a < b, or [a] if a == b or the empty list if a > b.

<=> :: Enum e => e -> e -> Ordering

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

 a <=> b  =  (ord a).<=>  (ord b)
from :: Enum 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.

hashCode :: Enum e => e -> Int

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

ord :: Enum 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.

pred :: Enum e => e -> e

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

succ :: Enum e => e -> e

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

class Eq eq

The 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, StringJ, Float, Char, Double, (), Bool, Int

Member Functions

!= :: Eq eq => eq -> eq -> Bool

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 eq => eq -> eq -> Bool

provided for Haskell compatibility as an alias for Eq.!=

== :: Eq eq => eq -> eq -> Bool

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

Ayn Rand's favorite law

 a == a

shall be obeyed by all implementations.

hashCode :: Eq eq => eq -> Int

Compute a hash code.

The follwoing 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 hashcodes more likely than not.

class Integral (Eq integ, Ord integ, Num integ) => integ

Class Integral provides bit arithmetic, division and remainder operations for integral numbers.

Known Instances

Long, Int, Integer

Member Functions

band :: Integral integ => integ -> integ -> integ

binary and, supposed to work like Java & on all integral types

bcmpl :: Integral integ => integ -> integ

one's complement, supposed to work like Java operator ~

big :: Integral integ => integ -> Integer

every integral number can be converted to a big Integer

bor :: Integral integ => integ -> integ -> integ

binary or, supposed to work like Java | on all integral types

bshl :: Integral integ => integ -> Int -> integ

binary left shift, supposed to work like Java << on all integral types

bshr :: Integral integ => integ -> Int -> integ

binary right shift, supposed to work like Java >> on all integral types

bxor :: Integral integ => integ -> integ -> integ

binary exclusive or, supposed to work like Java ^ on all integral types

div :: Integral integ => integ -> integ -> integ

integer division

divMod :: Integral integ => integ -> integ -> (integ, integ)
even :: Integral integ => integ -> Bool
gcd :: Integral integ => integ -> integ -> integ

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.

lcm :: Integral integ => integ -> integ -> integ

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

mod :: Integral integ => integ -> integ -> integ

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))

odd :: Integral integ => integ -> Bool
quot :: Integral integ => integ -> integ -> integ
quotRem :: Integral integ => integ -> integ -> (integ, integ)

Haskell compatibility

rem :: Integral integ => integ -> integ -> integ

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

ushr :: Integral integ => integ -> Int -> integ

unsigned right shift, supposed to work like Java >>> on all integral types

class Num (Eq n, Ord n) => 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, Double, Float, Int, Long

Member Functions

* :: Num n => n -> n -> n

Computes the product of two numbers

+ :: Num n => n -> n -> n

Computes the sum of two numbers

- :: Num n => n -> n -> n

Computes the difference of two numbers

abs :: Num n => n -> n

Computes the absolute value

fromInt :: Num n => Int -> n

converts an Int value to the instantiated type

isInfinite :: Num 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.

isNaN :: Num 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.

isNumber :: Num n => n -> Bool

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

Note that certain properties for funtions 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.

negate :: Num n => n -> n

Negates a number n such that if n is a number

> n + negate n == 0

one :: Num n => n

the number 1 in the instantiated type

sign :: Num n => n -> Int

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

subtract :: Num n => n -> n -> n

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

zero :: Num n => n

the number 0 in the instantiated type

class Ord Eq ord => ord

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

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

Member Functions

!= :: Ord ord => ord -> ord -> Bool

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 ord => ord -> ord -> Bool

Relational < operator. Obeys the following laws:

 if a < b && b < c then a < c
 a < b == b > a
<= :: Ord ord => ord -> ord -> Bool

Relational <= operator. Obeys the following laws:

 if a <= b && b <= c then a <= c
 a <= b == b >= a
 a <= b == !(a > b)
<=> :: Ord ord => ord -> ord -> Ordering

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 ord => ord -> ord -> Bool

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 ord => ord -> ord -> Bool

Relational > operator. Obeys the following laws:

 if a > b && b > c then a > c
 a > b == b < a
>= :: Ord ord => ord -> ord -> Bool

Relational >= operator. Obeys the following laws:

 if a >= b && b >= c then a >= c
 a >= b == b <= a
 a >= b == !(a < b)
compare :: Ord ord => ord -> ord -> Ordering
max :: Ord ord => ord -> ord -> ord

> max a b = if a > b then a else b

min :: Ord ord => ord -> ord -> ord

> min a b = if a < b then a else b

class Real (Eq r, Ord r, Num r) => r

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

Known Instances

Double, Float

Member Functions

/ :: Real r => r -> r -> r

the division operator

Instances

instance Bounded Bool

Member Functions

maxBound :: Bool
minBound :: Bool
instance Bounded Char

Member Functions

maxBound :: Char
pure native java.lang.Character.MAX_VALUE
minBound :: Char
pure native java.lang.Character.MIN_VALUE
instance Bounded Int

Member Functions

maxBound :: Int

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

minBound :: Int

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

instance Bounded Long

Member Functions

maxBound :: Long

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

minBound :: Long

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

instance Enum Bool

Member Functions

.. :: Bool -> Bool -> [Bool]

inherited from Enum

from :: Int -> Bool
ord :: Bool -> Int
pred :: Bool -> Bool
succ :: Bool -> Bool
instance Enum Char

Member Functions

.. :: Char -> Char -> [Char]

inherited from Enum

from :: Int -> Char
pure native (char)
ord :: Char -> Int
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)

pred :: Char -> Char
succ :: Char -> Char
instance Enum Int

Member Functions

.. :: Int -> Int -> [Int]

inherited from Enum

from :: Int -> Int

> from i = i

ord :: Int -> Int

> ord i = i

pred :: Int -> Int

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

succ :: Int -> Int

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

.. :: Integer -> Integer -> [Integer]

inherited from Enum

from :: Int -> Integer

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

ord :: Integer -> Int

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

pred :: Integer -> Integer

succ b is the same as b + 1.big

succ :: Integer -> Integer

succ b is the same as b + 1.big

instance Enum Long

Member Functions

.. :: Long -> Long -> [Long]

inherited from Enum

from :: Int -> Long

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

ord :: Long -> Int

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

pred :: Long -> Long

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

succ :: Long -> Long

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

instance Eq ()

Member Functions

!= :: () -> () -> Bool
/= :: () -> () -> Bool

inherited from Eq./=

== :: () -> () -> Bool
hashCode :: () -> Int
instance Eq Bool

Member Functions

!= :: Bool -> Bool -> Bool
pure native !=
/= :: Bool -> Bool -> Bool

inherited from Eq./=

== :: Bool -> Bool -> Bool
pure native ==
hashCode :: Bool -> Int
instance Eq Char

Member Functions

!= :: Char -> Char -> Bool
pure native !=
/= :: Char -> Char -> Bool

inherited from Eq./=

== :: Char -> Char -> Bool
pure native ==
hashCode :: Char -> Int
pure native (int)
instance Eq Double

Member Functions

!= :: Double -> Double -> Bool
pure native !=
/= :: Double -> Double -> Bool

inherited from Eq./=

== :: Double -> Double -> Bool
pure native ==
hashCode :: Double -> Int

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

instance Eq Float

Member Functions

!= :: Float -> Float -> Bool
pure native !=
/= :: Float -> Float -> Bool

inherited from Eq./=

== :: Float -> Float -> Bool
pure native ==
hashCode :: Float -> Int
pure native java.lang.Float.floatToIntBits

bit representation of a float serves as hashCode

instance Eq Int

Member Functions

!= :: Int -> Int -> Bool
pure native !=

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

/= :: Int -> Int -> Bool

inherited from Eq./=

== :: Int -> Int -> Bool
pure native ==

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

hashCode :: Int -> Int

The Eq.hashCode of an Int is the identity

instance Eq Long

Member Functions

!= :: Long -> Long -> Bool
pure native !=

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

/= :: Long -> Long -> Bool

inherited from Eq./=

== :: Long -> Long -> Bool
pure native ==

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

hashCode :: Long -> Int

hash code is upper half and lower half xor'ed

instance Eq String

Member Functions

!= :: String -> String -> Bool
/= :: String -> String -> Bool

inherited from Eq./=

== :: String -> String -> Bool
pure native equals
hashCode :: String -> Int
pure native hashCode

get the has code

instance Eq Eq a => [a]

Member Functions

!= :: Eq α => [α] -> [α] -> Bool

inherited from Eq.!=

/= :: Eq α => [α] -> [α] -> Bool

inherited from Eq./=

== :: Eq α => [α] -> [α] -> Bool

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

hashCode :: Eq α => [α] -> Int
instance Integral Int

Member Functions

band :: Int -> Int -> Int
pure native &

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

bcmpl :: Int -> Int
pure native ~
big :: Int -> Integer
bor :: Int -> Int -> Int
pure native |

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

bshl :: Int -> Int -> Int
pure native <<
bshr :: Int -> Int -> Int
pure native >>
bxor :: Int -> Int -> Int
pure native ^

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

div :: Int -> Int -> Int

inherited from Integral.div

divMod :: Int -> Int -> (Int, Int)

inherited from Integral.divMod

even :: Int -> Bool

inherited from Integral.even

gcd :: Int -> Int -> Int

inherited from Integral.gcd

lcm :: Int -> Int -> Int

inherited from Integral.lcm

mod :: Int -> Int -> Int

inherited from Integral.mod

odd :: Int -> Bool

inherited from Integral.odd

quot :: Int -> Int -> Int
pure native /
quotRem :: Int -> Int -> (Int, Int)

inherited from Integral.quotRem

rem :: Int -> Int -> Int
pure native %
ushr :: Int -> Int -> Int
pure native >>>

unsigned right shift

instance Integral Integer

Integer is an instance of Integral

Member Functions

* :: Integer -> Integer -> Integer
pure native multiply
+ :: Integer -> Integer -> Integer
pure native add
- :: Integer -> Integer -> Integer
pure native subtract
abs :: Integer -> Integer
pure native abs
band :: Integer -> Integer -> Integer
pure native and
bcmpl :: Integer -> Integer
pure native not
big :: Integer -> Integer
bor :: Integer -> Integer -> Integer
pure native or
bshl :: Integer -> Int -> Integer
pure native shiftLeft
bshr :: Integer -> Int -> Integer
pure native shiftRight
bxor :: Integer -> Integer -> Integer
pure native xor
div :: Integer -> Integer -> Integer

inherited from Integral.div

divMod :: Integer -> Integer -> (Integer, Integer)

inherited from Integral.divMod

even :: Integer -> Bool

inherited from Integral.even

fromInt :: Int -> Integer
gcd :: Integer -> Integer -> Integer
pure native gcd
isInfinite :: Integer -> Bool

inherited from Num.isInfinite

isNaN :: Integer -> Bool

inherited from Num.isNaN

isNumber :: Integer -> Bool

inherited from Num.isNumber

lcm :: Integer -> Integer -> Integer

inherited from Integral.lcm

mod :: Integer -> Integer -> Integer

inherited from Integral.mod

negate :: Integer -> Integer
pure native negate
odd :: Integer -> Bool

inherited from Integral.odd

one :: Integer
pure native java.math.BigInteger.ONE
quot :: Integer -> Integer -> Integer
pure native divide
quotRem :: Integer -> Integer -> (Integer, Integer)

inherited from Integral.quotRem

rem :: Integer -> Integer -> Integer
pure native remainder
sign :: Integer -> Int
pure native signum
subtract :: Integer -> Integer -> Integer

inherited from Num.subtract

ushr :: Integer -> Int -> Integer

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

zero :: Integer
pure native java.math.BigInteger.ZERO
instance Integral Long

Member Functions

band :: Long -> Long -> Long
pure native &

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

bcmpl :: Long -> Long
pure native ~
big :: Long -> Integer
bor :: Long -> Long -> Long
pure native |

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

bshl :: Long -> Int -> Long
pure native <<
bshr :: Long -> Int -> Long
pure native >>
bxor :: Long -> Long -> Long
pure native ^

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

div :: Long -> Long -> Long

inherited from Integral.div

divMod :: Long -> Long -> (Long, Long)

inherited from Integral.divMod

even :: Long -> Bool

inherited from Integral.even

gcd :: Long -> Long -> Long

inherited from Integral.gcd

lcm :: Long -> Long -> Long

inherited from Integral.lcm

mod :: Long -> Long -> Long

inherited from Integral.mod

odd :: Long -> Bool

inherited from Integral.odd

quot :: Long -> Long -> Long
pure native /
quotRem :: Long -> Long -> (Long, Long)

inherited from Integral.quotRem

rem :: Long -> Long -> Long
pure native %
ushr :: Long -> Int -> Long
pure native >>>

unsigned right shift

instance Num Int

Member Functions

* :: Int -> Int -> Int
pure native *

Uses the java * operator to multiply 2 Int values.

+ :: Int -> Int -> Int
pure native +

Uses the java + operator to add 2 Int values.

- :: Int -> Int -> Int
pure native -

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

abs :: Int -> Int

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
fromInt :: Int -> Int

For Int values, this is the identity function.

isInfinite :: Int -> Bool

inherited from Num.isInfinite

isNaN :: Int -> Bool

inherited from Num.isNaN

isNumber :: Int -> Bool

inherited from Num.isNumber

negate :: Int -> Int
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
one :: Int

the integer constant 1

sign :: Int -> Int

inherited from Num.sign

subtract :: Int -> Int -> Int

inherited from Num.subtract

zero :: Int

the integer constant 0

instance Num Long

Member Functions

* :: Long -> Long -> Long
pure native *

Uses the java * operator to multiply two Long values.

+ :: Long -> Long -> Long
pure native +

Uses the java + operator to add two Long values.

- :: Long -> Long -> Long
pure native -

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

abs :: Long -> Long

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
fromInt :: Int -> Long

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

isInfinite :: Long -> Bool

inherited from Num.isInfinite

isNaN :: Long -> Bool

inherited from Num.isNaN

isNumber :: Long -> Bool

inherited from Num.isNumber

negate :: Long -> Long
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
one :: Long

The constant 1L.

sign :: Long -> Int

inherited from Num.sign

subtract :: Long -> Long -> Long

inherited from Num.subtract

zero :: Long

The constant 0L.

instance Ord Bool

Member Functions

< :: Bool -> Bool -> Bool
<= :: Bool -> Bool -> Bool
<=> :: Bool -> Bool -> Ordering
> :: Bool -> Bool -> Bool
>= :: Bool -> Bool -> Bool
compare :: Bool -> Bool -> Ordering

inherited from Ord.compare

max :: Bool -> Bool -> Bool

inherited from Ord.max

min :: Bool -> Bool -> Bool

inherited from Ord.min

instance Ord Char

Member Functions

< :: Char -> Char -> Bool
pure native <
<= :: Char -> Char -> Bool
pure native <=
<=> :: Char -> Char -> Ordering
> :: Char -> Char -> Bool
pure native >
>= :: Char -> Char -> Bool
pure native >=
compare :: Char -> Char -> Ordering

inherited from Ord.compare

max :: Char -> Char -> Char

inherited from Ord.max

min :: Char -> Char -> Char

inherited from Ord.min

instance Ord Double

Member Functions

< :: Double -> Double -> Bool
pure native <
<= :: Double -> Double -> Bool
pure native <=
<=> :: Double -> Double -> Ordering
> :: Double -> Double -> Bool
pure native >
>= :: Double -> Double -> Bool
pure native >=
compare :: Double -> Double -> Ordering

inherited from Ord.compare

max :: Double -> Double -> Double

inherited from Ord.max

min :: Double -> Double -> Double

inherited from Ord.min

instance Ord Float

Member Functions

< :: Float -> Float -> Bool
pure native <
<= :: Float -> Float -> Bool
pure native <=
<=> :: Float -> Float -> Ordering
> :: Float -> Float -> Bool
pure native >
>= :: Float -> Float -> Bool
pure native >=
compare :: Float -> Float -> Ordering

inherited from Ord.compare

max :: Float -> Float -> Float

inherited from Ord.max

min :: Float -> Float -> Float

inherited from Ord.min

instance Ord Int

Member Functions

< :: Int -> Int -> Bool
pure native <

Uses the java < operator for comparision of Int values.

<= :: Int -> Int -> Bool
pure native <=

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

<=> :: Int -> Int -> Ordering
> :: Int -> Int -> Bool
pure native >

Uses the java > operator for comparision of Int values.

>= :: Int -> Int -> Bool
pure native >=

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

compare :: Int -> Int -> Ordering

inherited from Ord.compare

max :: Int -> Int -> Int

inherited from Ord.max

min :: Int -> Int -> Int

inherited from Ord.min

instance Ord Integer

Integer is an instance of Ord

Member Functions

!= :: Integer -> Integer -> Bool
/= :: Integer -> Integer -> Bool

inherited from Eq./=

< :: Integer -> Integer -> Bool
<= :: Integer -> Integer -> Bool
<=> :: Integer -> Integer -> Ordering
== :: Integer -> Integer -> Bool
> :: Integer -> Integer -> Bool
>= :: Integer -> Integer -> Bool
compare :: Integer -> Integer -> Ordering

inherited from Ord.compare

hashCode :: Integer -> Int
pure native hashCode
max :: Integer -> Integer -> Integer
pure native max
min :: Integer -> Integer -> Integer
pure native min
instance Ord Long

Member Functions

< :: Long -> Long -> Bool
pure native <

Uses the java < operator for comparision of Long values.

<= :: Long -> Long -> Bool
pure native <=

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

<=> :: Long -> Long -> Ordering
> :: Long -> Long -> Bool
pure native >

Uses the java > operator for comparision of Long values.

>= :: Long -> Long -> Bool
pure native >=

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

compare :: Long -> Long -> Ordering

inherited from Ord.compare

max :: Long -> Long -> Long

inherited from Ord.max

min :: Long -> Long -> Long

inherited from Ord.min

instance Ord String

Member Functions

< :: String -> String -> Bool
<= :: String -> String -> Bool
<=> :: String -> String -> Ordering
> :: String -> String -> Bool
>= :: String -> String -> Bool
compare :: String -> String -> Ordering

inherited from Ord.compare

max :: String -> String -> String

inherited from Ord.max

min :: String -> String -> String

inherited from Ord.min

instance Real Double

Member Functions

* :: Double -> Double -> Double
pure native *
+ :: Double -> Double -> Double
pure native +
- :: Double -> Double -> Double
pure native -
/ :: Double -> Double -> Double
pure native /
abs :: Double -> Double

inherited from Num.abs

fromInt :: Int -> Double
isInfinite :: Double -> Bool
pure native java.lang.Double.isInfinite
isNaN :: Double -> Bool
pure native java.lang.Double.isNaN
isNumber :: Double -> Bool

inherited from Num.isNumber

negate :: Double -> Double
pure native -
one :: Double
sign :: Double -> Int

inherited from Num.sign

subtract :: Double -> Double -> Double

inherited from Num.subtract

zero :: Double
instance Real Float

Member Functions

* :: Float -> Float -> Float
pure native *
+ :: Float -> Float -> Float
pure native +
- :: Float -> Float -> Float
pure native -
/ :: Float -> Float -> Float
pure native /
abs :: Float -> Float

inherited from Num.abs

fromInt :: Int -> Float
isInfinite :: Float -> Bool
pure native java.lang.Float.isInfinite
isNaN :: Float -> Bool
pure native java.lang.Float.isNaN
isNumber :: Float -> Bool

inherited from Num.isNumber

negate :: Float -> Float
pure native -
one :: Float
sign :: Float -> Int

inherited from Num.sign

subtract :: Float -> Float -> Float

inherited from Num.subtract

zero :: Float

Data Types

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 Bool = native boolean

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

data Char = native char

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

Member Functions

isLetterOrDigit :: Char -> Bool
pure native java.lang.Character.isLetterOrDigit
isLowerCase :: Char -> Bool
pure native java.lang.Character.isLowerCase
isUpperCase :: Char -> Bool
pure native java.lang.Character.isUpperCase
isWhitespace :: Char -> Bool
pure native java.lang.Character.isWhitespace
toLowerCase :: Char -> Char
pure native java.lang.Character.toLowerCase
toUpperCase :: Char -> Char
pure native java.lang.Character.toUpperCase
data Class = native java.lang.Class

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

Member Functions

forName :: String -> Exception Class
pure native java.lang.Class.forName
getName :: Class -> String
pure native getName
data Double = 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 speicified in the IEEE Standard for Binary Floating-Point Arithmetic.

Member Functions

float :: Double -> Float
pure native (float)

Applies the java narrowing primitive conversion from double to float

floor :: Double -> Double
pure native java.lang.Math.floor

Returns the largest (closest to positive infinity) value that is less than or equal to the argument and is equal to a mathematical integer.

Special cases:

  • If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
  • If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
long :: Double -> Long
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 Double.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:

longBits :: Double -> Long
pure native java.lang.Double.doubleToLongBits

bit representation of a double

data Either a b

Constructors

Left a
Right b
data Float = 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 speicified in the IEEE Standard for Binary Floating-Point Arithmetic.

Member Functions

double :: Float -> Double
pure native (double)

Applies the java widening primitive conversion from float to double.

floor :: Float -> Float

Returns the largest (closest to positive infinity) value that is less than or equal to the argument and is equal to a mathematical integer.

Special cases:

  • If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
  • If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
int :: Float -> Int
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 Float.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 Immutable

Some native values can be detached from the stateful realm so as to make it possible to apply them to pure (native) functions, see Freezable.

Such values will have Immutable as last type argument.

Constructors

Immutable
data Int = 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 spezialized 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

char :: Int -> Char
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

double :: Int -> Double
pure native java.lang.Double.valueOf

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

float :: Int -> Float
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.

long :: Int -> Long
pure native java.lang.Long.valueOf

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

toHexString :: Int -> String
pure native java.lang.Integer.toHexString

convert to a hexadecimal string

data Integer = 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

bitLength :: Integer -> Int
pure native bitLength
compareTo :: Integer -> Integer -> Int
pure native compareTo
int :: Integer -> Int
pure native intValue
long :: Integer -> Long
pure native longValue
nMod :: Integer -> Integer -> Integer
pure native mod

/Warning/! Throws ArithmeticException when divisor is negative.

ten :: Integer
pure native java.math.BigInteger.TEN
toString :: Integer -> String
pure native toString
valueOf :: Long -> Integer
pure native java.math.BigInteger.valueOf

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

data JException = native java.lang.Exception

Frege wrapper for java exceptions.

Member Functions

catched :: JException -> String

give the name of this exception

getClass :: JException -> Class
pure native getClass
getLocalizedMessage :: JException -> String
pure native getLocalizedMessage
getMessage :: JException -> String
pure native getMessage
data Long = 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

double :: Long -> Double
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.

float :: Long -> Float
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.

int :: Long -> Int
pure native (int)

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

data Matcher = native java.util.regex.Matcher

Matcher values are based on Java's java.util.regex.Matcher objects. Code generation relies on the existence of this type and its operations.

The native Matcher functions that correspond to java methods of the java.util.regex.Matcher class that modify the state of the object they are invoked on (Matcher.find, Matcher.matches, Matcher.replaceFirst, Matcher.replaceAll, Matcher.usePattern, Matcher.useAnchoringBounds) are implemented so that they make a copy of the Matcher and invoke the impure java method on the copy.

Frege Matchers can thus be regarded as read-only values and the functions defined here as pure. If you need to pass a Matcher to other native functions, be sure that the function is pure. If it is not because it would modify the matcher, and you do not need the match result, always pass a clone of the Matcher (see Matcher.clone)

Member Functions

clone :: Matcher -> Matcher
pure native frege.RT.clone
end :: Matcher -> Int -> Int
pure native end

Returns the offset after the last character of the subsequence captured by the given group during the previous match operation where group 0 denotes the entire pattern.

If the specified capturing group failed to match, the return value will be -1.

The follwoing property holds:

 (m.group n == Nothing) ==> (m.end n < 0)
find :: Matcher -> Maybe Matcher
pure native frege.RT.find

Tries a match and if it succeeds, returns Just m, where m is a new Matcher that contains the result. If there is no match, Nothing is returned.

The following java fragment appends all matched substrings of a string:

 String s = "cats and dogs are not concatenated.";
 Pattern p = Pattern.compile("cat|dog");
 String result = "";
 Matcher m = p.matcher(s);
 while (m.find()) result += m.group(0);  // "catdogcat"

The follwoing frege fragment computes the same result:

 result = loop m "" where
      s = "cats and dogs are not concatenated."
      p = #cat|dog#
      m = p.matcher s
      loop :: Matcher -> String -> String
      loop m1 r | Just m2 <- m1.find = loop m2 (r++m2.match)
                | otherwise = r
group :: Matcher -> Int -> Maybe String
pure native group

Retrieves the input subsequence captured by the given group during the previous match operation.

Capturing groups are indexed from left to right, starting at one. Group zero denotes the entire pattern, so the expression (m.group 0) retrieves that portion of the input string that was matched by the pattern.

If the match was successful but the group specified failed to match any part of the input sequence, then Maybe.Nothing is returned. Note that some groups, for example (a?), match the empty string. This functon will return Just "" when such a group successfully matches the empty string in the input.

The folloing property holds for a Matcher /m/ with input sequence /s/ and group index /g/:

 isJust (m.group g) ==> (m.group g) == Just (s.substr (m.start g) (m.end g))
match :: Matcher -> String
pure native group

Matcher.match m returns the input subsequence matched by the previous match. The result is undefined if the last match was not successful.

For a Matcher m with input sequence s, the following holds:

 isJust (m.group 0) ==> unJust (m.group 0) == m.match

Note that some patterns, for example a?, match the empty string. This method will return the empty string when the pattern successfully matches the empty string in the input.

matches :: Matcher -> Maybe Matcher
pure native frege.RT.matches

Tries to match the entire string and returns Just m on success and otherwise Nothing.

replaceAll :: Matcher -> String -> String
pure native frege.RT.replaceAll

Like Matcher.replaceFirst, but replaces all matches.

replaceFirst :: Matcher -> String -> String
pure native frege.RT.replaceFirst

Replaces the first subsequence of the input sequence that matches the pattern with the given replacement string.

This method scans the input sequence from the start looking for a match of the pattern. Characters that are not part of the match are appended directly to the result string; the match is replaced in the result by the replacement string. The replacement string may contain references to captured subsequences.

Note that backslashes (\\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string.

Given the regular expression #dog#, the input "zzzdogzzzdogzzz", and the replacement string "cat", an invocation of this function on a matcher for that expression would yield the string "zzzcatzzzdogzzz".

start :: Matcher -> Int -> Int
pure native start

Returns the start index of the subsequence captured by the given group during the previous match operation where group 0 denotes the entire pattern.

If the specified capturing group failed to match, the return value will be -1.

The follwoing property holds:

 (m.group n == Nothing) ==> (m.start n < 0)
toString :: Matcher -> String
pure native toString

Returns the string representation of this matcher. The string representation of a Matcher contains information that may be useful for debugging. The exact format is unspecified.

useAnchoringBounds :: Matcher -> Bool -> Matcher
pure native frege.RT.useAnchoringBounds

Requires or forbids the matcher to acknowledge anchors.

usePattern :: Matcher -> Regex -> Matcher
pure native frege.RT.usePattern

Makes a new Matcher and causes it to use a different Regex for future matches.

The original matchers position in the input and its last append position is copied, but information about the last match, if any, is not.

This is most useful with patterns that start with the \\G anchor.

Note that, due to a java bug, if the last find operation matched the empty string, the next find will fail. For a workaround see Matcher.usePatternAndFind

usePatternAndFind :: Matcher -> Regex -> Maybe Matcher
pure native frege.RT.usePatternAndFind

Makes a new Matcher with a different Regex and tries to find a match. If the last find on the original Matcher returned an empty result, it calls mnew.find(morig.end(0)) to work around a bug in the java API. Therefore, this function must only be used on a matcher whose last match attempt was successful.

data Maybe a

Constructors

Just a
Nothing
data Ordering

The type of the result of Ord.<=>

Constructors

Eq
Gt
Lt
data 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.

Constructors

RealWorld
data Regex = native java.util.regex.Pattern

Regex values are based on Java's java.util.regex.Pattern objects. All regular expression literals are values of this type.

Member Functions

matcher :: Regex -> String -> Matcher
pure native matcher

create a Matcher from a regular expression and a String

pattern :: Regex -> String
pure native pattern
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 independend 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 will have a phantom type paramter 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 :: () -> ST s (Date s)

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 :: Date s -> ST s String

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

 now = do
    date <- Date.new ()
    return date.toString

This looks almost like java already! now has type ST s String and we can run the computation with now.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

ST (s->a)

Member Functions

>>= :: ST γ α -> (α->ST γ β) -> ST γ β
performUnsafe :: IO α -> α
return :: α -> ST β α
run :: (forall ß.ST ß a) -> a

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 run an IO action.

data STRef a s = native frege.rt.Ref

Member Functions

get :: STRef a s -> ST s a
native get
new :: a -> Mutable (STRef a) s
native new
put :: STRef a s -> a -> ST s ()
native put
data State s a

State s a is an abstrac data type that resembles a stateful computation with state s and result a, i.e. functions of type s -> (a, s) where the state is immutable.

Constructors

State (s->(a, s))

Member Functions

>> :: State α γ -> State α β -> State α β
>>= :: State γ α -> (α->State γ β) -> State γ β

monadic bind for the State monad

change :: (α->α) -> State α ()

change the State

get :: State α α

get the current State

put :: α -> State α ()

update the State

return :: α -> State β α

lift a value to the State monad

run :: State α β -> α -> (β, α)

run a stateful computation

data StringJ a = 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 a -> StringJ a -> StringJ a
pure native +

Concatenate two strings, uses Java's + operator

atod :: String -> Double
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.

atof :: String -> Float
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.

atoi :: String -> Int
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.

atol :: String -> Long
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.

aton :: String -> Integer
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.

charAt :: String -> Int -> Char
pure native charAt

retrieve character at index

compareTo :: String -> String -> Int
pure native compareTo

StringJ.compareTo is used in the Ord instance of String

compile :: String -> Regex
pure native java.util.regex.Pattern.compile

interpret this string as regex (unsafe, does not catch exceptions)

see regcomp for an alternative

double :: String -> Exception Double
pure native java.lang.Double.parseDouble

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

elemAt :: String -> Int -> Char
pure native charAt
float :: String -> Exception Float
pure native java.lang.Float.parseFloat

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

frozenGetAt :: String -> Int -> Char
pure native charAt

Get character at index.

This will allow to use a string like an array, e.g. "xyz".[1]

int :: String -> Exception Int
pure native java.lang.Integer.parseInt

Safe way to parse an integer from a string. java.lang.NumberFormatException will be catched 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
integer :: String -> Exception Integer
pure native new

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

itemAt :: StringJ a -> Int -> a
pure native frege.RT.itemAt

Polymorphic variant of elemAt

Always returns a character (what else?) for nonempty strings.

length :: StringJ a -> Int
pure native length

The length of a String

long :: String -> Exception Long
pure native java.lang.Long.parseLong

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

quote :: String -> String
pure native java.util.regex.Pattern.quote

quote regular expression metacharacters in string

quoteReplacement :: String -> String
pure native java.util.regex.Matcher.quoteReplacement

quote replacement string metacharacters in string

toLowerCase :: String -> String
pure native toLowerCase

convert to lower case

toUpperCase :: String -> String
pure native toUpperCase

convert to upper case

data Undefined = native frege.RT.Undefined

Member Functions

die :: Undefined -> Bool
pure native die

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

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

new :: String -> Undefined
pure native new
newSX :: String -> JException -> Undefined
pure native new

create an Undefined value from a string and a cause

newX :: JException -> Undefined

create an Undefined value from a JException. The message will be taken from the exception.

toException :: Undefined -> JException
pure native (java.lang.Exception)

convert an Undefined value to a JException

This is actually a no-op, since frege.RT.Undefined is a subclass of java.lang.Exception. However, the type checker knows nothing about subclasses.

This function is used in the Monad (Exception a).

data [a]

list type

Constructors

: a   [a]

list construction

[]

empty list

Functions and Values

! :: Bool -> Bool
pure native !

The Java ! operator on booleans

!== :: a -> a -> Bool
pure native !=

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

!~ :: String -> Regex -> Bool
 s !~ p == !(s ~ p)
$ :: (α->β) -> α -> β

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, becuase $ is right associative, f $ g $ h y is f (g (h y))

$! :: (α->β) -> α -> β

Same as `$` but argument is strict

&& :: Bool -> Bool -> Bool
pure native &&

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

/~ :: Matcher -> Regex -> Maybe String
 m /~ p

is like

 m ?~ p

but instead of the matcher it returns the matched string, if any.

<~ :: (α->β) -> (γ->α) -> γ -> β

Function composition.

(f <~ g) is a function whose argument is passed to /g/, and the result to /f/, yielding the overall result.

One can imagine that the data flow from right to left through a function pipe.

 (a) <~ (b)  = \x -> a (b x)
=== :: a -> a -> Bool
pure native ==

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

=~ :: String -> Regex -> Maybe Matcher
 string =~ regex

tries to match string against regex and returns Just matcher if it succeeds, Nothing otherwise.

?~ :: Matcher -> Regex -> Maybe Matcher

m ?~ p binds pattern p to the matcher m and tries a match. There must have been a successful match on m before.

Returns Maybe.Nothing if match fails, else (Maybe.Just m).

This function is most usefull in conjunction with patterns that use the G-anchor when one wants to extract multiple differnt adjacent items from a string.

@ :: (β->γ) -> (α->β) -> α -> γ

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 }}

^^ :: Bool -> Bool -> Bool

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

 a ^^ b = if a then not b else b
asTypeOf :: a -> a -> a

asTypeOf a b is a with the type of b.

This is a type restricted version of const.

ascending :: Ord β => (α->β) -> α -> α -> Ordering

this is just an alias for comparing

atoi :: String -> Int
chr :: Int -> Char
comparing :: Ord β => (α->β) -> α -> α -> Ordering

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

 sortBy (comparing snd) [(1, "z"), (2, "b")] == [(2, "b"), (1, "z")]
const :: α -> β -> α

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

constructor :: a -> Int
pure native frege.RT.constructor

Determines the constructor of a value. This is used like

constructor arg

where arg is any frege value.

Returns 0 for product types and native types or the /constructor number/ for constructed types. The /constructor number/ is a small integer stored in every constructed value. It indicates by what data constructor a value was constructed.

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.

ctos :: Char -> String
pure native java.lang.Character.toString
curry :: ((α, γ)->β) -> α -> γ -> β

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

descending :: Ord β => (α->β) -> α -> α -> 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")]
either :: (α->β) -> (γ->β) -> Either α γ -> β
error :: String -> u

Construct an undefined value with an informative message.

flip :: (α->γ->β) -> γ -> α -> β

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

> flip f a b = f b a

fst :: (α, β) -> α

return the first element of a 2-tuple

gcda :: Integral integ => integ -> integ -> integ

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.

id :: α -> α

The identity function

lazyif :: 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.

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.

not :: Bool -> Bool
pure native !

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

oder :: Bool -> Bool -> Bool

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.

otherwise :: Bool

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 = ...
printStr :: String -> IO ()
native java.lang.System.out.print

print a string to the standard output stream

printStrLn :: String -> IO ()
native java.lang.System.out.println

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

regcomp :: String -> Exception Regex
pure native java.util.regex.Pattern.compile

compile a String to a Regex

seq :: α -> β -> β

a `seq` b evaluates a before it returns b

This is a right associative operator with precedence 15.

snd :: (α, β) -> β

return the second element of a 2-tuple

strictTuple10 :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> (a, b, c, d, e, f, g, h, i, j)
pure native PreludeBase.TTuple10.mk

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

strictTuple11 :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> (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.

strictTuple12 :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> (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.

strictTuple13 :: 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)
pure native PreludeBase.TTuple13.mk

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

strictTuple14 :: 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)
pure native PreludeBase.TTuple14.mk

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

strictTuple15 :: 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)
pure native PreludeBase.TTuple15.mk

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

strictTuple16 :: 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)
pure native PreludeBase.TTuple16.mk

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

strictTuple17 :: 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)
pure native PreludeBase.TTuple17.mk

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

strictTuple18 :: 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)
pure native PreludeBase.TTuple18.mk

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

strictTuple19 :: 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)
pure native PreludeBase.TTuple19.mk

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

strictTuple2 :: a -> b -> (a, b)
pure native PreludeBase.TTuple2.mk

Constructs a strict tuple. The difference to (,) is that both argument values will be evaluated before the tuple is constructed. Thus:

fst (42; undefined) == undefined
fst (42, undefined) == 42

Implementation specific: The compiler will rewrite (a;b) as (PreludeBase.strictTuple2 a b).

strictTuple20 :: 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)
pure native PreludeBase.TTuple20.mk

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

strictTuple21 :: 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)
pure native PreludeBase.TTuple21.mk

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

strictTuple22 :: 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)
pure native PreludeBase.TTuple22.mk

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

strictTuple23 :: 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)
pure native PreludeBase.TTuple23.mk

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

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 -> (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.

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 -> (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.

strictTuple26 :: 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)
pure native PreludeBase.TTuple26.mk

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

strictTuple3 :: a -> b -> c -> (a, b, c)
pure native PreludeBase.TTuple3.mk

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

strictTuple4 :: a -> b -> c -> d -> (a, b, c, d)
pure native PreludeBase.TTuple4.mk

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

strictTuple5 :: a -> b -> c -> d -> e -> (a, b, c, d, e)
pure native PreludeBase.TTuple5.mk

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

strictTuple6 :: a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f)
pure native PreludeBase.TTuple6.mk

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

strictTuple7 :: a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g)
pure native PreludeBase.TTuple7.mk

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

strictTuple8 :: a -> b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h)
pure native PreludeBase.TTuple8.mk

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

strictTuple9 :: a -> b -> c -> d -> e -> f -> g -> h -> i -> (a, b, c, d, e, f, g, h, i)
pure native PreludeBase.TTuple9.mk

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

strtail :: StringJ a -> Int -> StringJ 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.

substr :: StringJ a -> Int -> Int -> StringJ 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.

throw :: JException -> α

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

traceStr :: String -> IO ()
native java.lang.System.err.print

print a string to the standard error stream

traceStrLn :: String -> IO ()
native java.lang.System.err.println

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

uncurry :: (α->γ->β) -> (α, γ) -> β

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

und :: Bool -> Bool -> Bool

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.

undefined :: u

This is the standard undefined value.

using :: Eq β => (α->β) -> α -> α -> Bool

using f applies a projection function f on both sides of Eq.==. The example for uniqBy could be written easier

 uniqBy (using fst) [(1, 1), (2, 2), (2, 3), (3,4), (2,5)]
|| :: Bool -> Bool -> Bool
pure native ||

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

~ :: String -> Regex -> Bool
string ~ regex

true if string matches regex, false otherwise

~> :: (γ->α) -> (α->β) -> γ -> β

Function composition.

(f ~> g) is a function whose argument is first passed to /f/, and the result to /g/, yielding the overall result.

One can imagine that the data flows from left to right through a function pipe.

 (a) ~> (b)  = \x -> b (a x)
~~ :: String -> Regex -> Maybe String
 ("string" ~~ #r??#) == Just "rin"

Tries a match and returns Just x where x is the matched substring or Nothing if there was no match.

~~~ :: String -> Regex -> Int -> Maybe String
 string ~~~ regex

Matches string with regex and returns a function that can be used to extract the matched part of the string and the captured substrings.

   let f = "frege" ~~~ #(..).(..)#
   in [ f i | i <- 0..3 ]

yields

[Just "frege", Just "fr", Just "ge", Nothing]
:: (α->β) -> (γ->α) -> γ -> β

Another operator for function composition, which is identical to <~

> (f • g) a = f (g a)

Functions and Values by Type

String -> String -> String

Ord_String.max, Ord_String.min

String -> String -> Bool

Eq_String./=, Eq_String.!=, Eq_String.==, Ord_String.>, Ord_String.<=, Ord_String.<, Ord_String.>=

String -> String -> Int

StringJ.compareTo

String -> String -> Ordering

Ord_String.<=>, Ord_String.compare

String -> Int -> Char

StringJ.charAt, StringJ.elemAt, StringJ.frozenGetAt

String -> JException -> Undefined

Undefined.newSX

String -> Regex -> Int -> Maybe String

~~~

String -> Regex -> Maybe String

~~

String -> Regex -> Maybe Matcher

=~

String -> Regex -> Bool

!~, ~

String -> Exception Class

Class.forName

String -> Exception Double

StringJ.double

String -> Exception Float

StringJ.float

String -> Exception Int

StringJ.int

String -> Exception Integer

StringJ.integer

String -> Exception Long

StringJ.long

String -> Exception Regex

regcomp

String -> IO ()

printStr, printStrLn, traceStr, traceStrLn

String -> String

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

String -> Double

StringJ.atod

String -> Float

StringJ.atof

String -> Int

atoi, Eq_String.hashCode, StringJ.atoi

String -> Integer

StringJ.aton

String -> Long

StringJ.atol

String -> Regex

StringJ.compile

String -> Undefined

Undefined.new

() -> () -> Bool

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

() -> Int

Eq_().hashCode

Bool -> Bool -> [Bool]

Enum_Bool...

Bool -> Bool -> Bool

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

Bool -> Bool -> Ordering

Ord_Bool.<=>, Ord_Bool.compare

Bool -> Bool

!, not, Enum_Bool.pred, Enum_Bool.succ

Bool -> Int

Enum_Bool.ord, Eq_Bool.hashCode

Char -> Char -> [Char]

Enum_Char...

Char -> Char -> Bool

Eq_Char./=, Eq_Char.!=, Eq_Char.==, Ord_Char.>, Ord_Char.<=, Ord_Char.<, Ord_Char.>=

Char -> Char -> Char

Ord_Char.max, Ord_Char.min

Char -> Char -> Ordering

Ord_Char.<=>, Ord_Char.compare

Char -> String

ctos

Char -> Bool

Char.isLowerCase, Char.isLetterOrDigit, Char.isWhitespace, Char.isUpperCase

Char -> Char

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

Char -> Int

Enum_Char.ord, Eq_Char.hashCode

Class -> String

Class.getName

Double -> Double -> Bool

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

Double -> Double -> Double

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

Double -> Double -> Ordering

Ord_Double.<=>, Ord_Double.compare

Double -> Bool

Real_Double.isNaN, Real_Double.isInfinite, Real_Double.isNumber

Double -> Double

Real_Double.abs, Real_Double.negate, Double.floor

Double -> Float

Double.float

Double -> Int

Eq_Double.hashCode, Real_Double.sign

Double -> Long

Double.long, Double.longBits

Float -> Float -> Bool

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

Float -> Float -> Float

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

Float -> Float -> Ordering

Ord_Float.<=>, Ord_Float.compare

Float -> Bool

Real_Float.isNaN, Real_Float.isInfinite, Real_Float.isNumber

Float -> Double

Float.double

Float -> Float

Real_Float.abs, Real_Float.negate, Float.floor

Float -> Int

Eq_Float.hashCode, Real_Float.sign, Float.int

Int -> Int -> (Int, Int)

Integral_Int.divMod, Integral_Int.quotRem

Int -> Int -> [Int]

Enum_Int...

Int -> Int -> Bool

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

Int -> Int -> Int

Integral_Int.bxor, Integral_Int.band, Integral_Int.bshl, Integral_Int.bor, Integral_Int.bshr, Integral_Int.gcd, Integral_Int.div, Integral_Int.quot, Integral_Int.mod, Integral_Int.lcm, Integral_Int.rem, Integral_Int.ushr, Num_Int.-, Num_Int.+, Num_Int.*, Num_Int.subtract, Ord_Int.max, Ord_Int.min

Int -> Int -> Ordering

Ord_Int.<=>, Ord_Int.compare

Int -> String

Int.toHexString

Int -> Bool

Enum_Bool.from, Integral_Int.even, Integral_Int.odd, Num_Int.isNaN, Num_Int.isInfinite, Num_Int.isNumber

Int -> Char

chr, Enum_Char.from, Int.char

Int -> Double

Real_Double.fromInt, Int.double

Int -> Float

Real_Float.fromInt, Int.float

Int -> Int

Enum_Int.from, Enum_Int.pred, Enum_Int.ord, Enum_Int.succ, Eq_Int.hashCode, Integral_Int.bcmpl, Num_Int.fromInt, Num_Int.abs, Num_Int.sign, Num_Int.negate

Int -> Integer

Enum_Integer.from, Integral_Int.big, Integral_Integer.fromInt

Int -> Long

Enum_Long.from, Num_Long.fromInt, Int.long

Integer -> Int -> Integer

Integral_Integer.bshr, Integral_Integer.bshl, Integral_Integer.ushr

Integer -> Integer -> (Integer, Integer)

Integral_Integer.divMod, Integral_Integer.quotRem

Integer -> Integer -> [Integer]

Enum_Integer...

Integer -> Integer -> Bool

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

Integer -> Integer -> Int

Integer.compareTo

Integer -> Integer -> Integer

Integral_Integer.-, Integral_Integer.+, Integral_Integer.*, Integral_Integer.band, Integral_Integer.bor, Integral_Integer.bxor, Integral_Integer.div, Integral_Integer.lcm, Integral_Integer.gcd, Integral_Integer.rem, Integral_Integer.mod, Integral_Integer.quot, Integral_Integer.subtract, Ord_Integer.max, Ord_Integer.min, Integer.nMod

Integer -> Integer -> Ordering

Ord_Integer.<=>, Ord_Integer.compare

Integer -> String

Integer.toString

Integer -> Bool

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

Integer -> Int

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

Integer -> Integer

Enum_Integer.pred, Enum_Integer.succ, Integral_Integer.bcmpl, Integral_Integer.abs, Integral_Integer.big, Integral_Integer.negate

Integer -> Long

Integer.long

JException -> String

JException.catched, JException.getLocalizedMessage, JException.getMessage

JException -> Class

JException.getClass

JException -> Undefined

Undefined.newX

Long -> Int -> Long

Integral_Long.bshl, Integral_Long.bshr, Integral_Long.ushr

Long -> Long -> (Long, Long)

Integral_Long.divMod, Integral_Long.quotRem

Long -> Long -> [Long]

Enum_Long...

Long -> Long -> Bool

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

Long -> Long -> Long

Integral_Long.bxor, Integral_Long.band, Integral_Long.bor, Integral_Long.gcd, Integral_Long.div, Integral_Long.quot, Integral_Long.mod, Integral_Long.lcm, Integral_Long.rem, Num_Long.-, Num_Long.+, Num_Long.*, Num_Long.subtract, Ord_Long.max, Ord_Long.min

Long -> Long -> Ordering

Ord_Long.<=>, Ord_Long.compare

Long -> Bool

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

Long -> Double

Long.double

Long -> Float

Long.float

Long -> Int

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

Long -> Integer

Integral_Long.big, Integer.valueOf

Long -> Long

Enum_Long.pred, Enum_Long.succ, Integral_Long.bcmpl, Num_Long.abs, Num_Long.negate

Matcher -> String -> String

Matcher.replaceAll, Matcher.replaceFirst

Matcher -> Bool -> Matcher

Matcher.useAnchoringBounds

Matcher -> Int -> Maybe String

Matcher.group

Matcher -> Int -> Int

Matcher.end, Matcher.start

Matcher -> Regex -> Maybe String

/~

Matcher -> Regex -> Maybe Matcher

?~, Matcher.usePatternAndFind

Matcher -> Regex -> Matcher

Matcher.usePattern

Matcher -> Maybe Matcher

Matcher.find, Matcher.matches

Matcher -> String

Matcher.match, Matcher.toString

Matcher -> Matcher

Matcher.clone

Regex -> String -> Matcher

Regex.matcher

Regex -> String

Regex.pattern

Undefined -> Bool

Undefined.die

Undefined -> JException

Undefined.toException

()

().()

Bool

otherwise, Bounded_Bool.minBound, Bounded_Bool.maxBound

Char

Bounded_Char.minBound, Bounded_Char.maxBound

Double

Real_Double.one, Real_Double.zero

Float

Real_Float.one, Real_Float.zero

Immutable

Immutable.Immutable

Int

Bounded_Int.minBound, Bounded_Int.maxBound, Num_Int.one, Num_Int.zero

Integer

Integral_Integer.one, Integral_Integer.zero, Integer.ten

Long

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

Ordering

Ordering.Gt, Ordering.Eq, Ordering.Lt

RealWorld

RealWorld.RealWorld

(α->α) -> State α ()

State.change

IO α -> α

ST.performUnsafe

String -> u

error

StringJ a -> StringJ a -> StringJ a

StringJ.++

StringJ a -> Int -> Int -> StringJ a

substr

StringJ a -> Int -> StringJ a

strtail

StringJ a -> Int -> a

StringJ.itemAt

StringJ a -> Int

StringJ.length

Bool -> α -> α -> α

lazyif

JException -> α

throw

a -> [a] -> [a]

[].:

a -> a -> Bool

!==, ===

a -> a -> a

asTypeOf

a -> Maybe a

Maybe.Just

a -> Int

constructor

α -> State α ()

State.put

α -> α

id

(forall ß.ST ß a) -> a

ST.run

Enum e => Int -> e

Enum.from

Enum e => e -> e -> [e]

Enum...

Enum e => e -> e -> Ordering

Enum.<=>

Enum e => e -> Int

Enum.hashCode, Enum.ord

Enum e => e -> e

Enum.pred, Enum.succ

Eq eq => eq -> eq -> Bool

Eq./=, Eq.!=, Eq.==

Eq eq => eq -> Int

Eq.hashCode

Eq α => [α] -> [α] -> Bool

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

Eq α => [α] -> Int

Eq_[].hashCode

Integral integ => integ -> Int -> integ

Integral.bshl, Integral.bshr, Integral.ushr

Integral integ => integ -> integ -> (integ, integ)

Integral.divMod, Integral.quotRem

Integral integ => integ -> integ -> integ

gcda, Integral.bxor, Integral.bor, Integral.band, Integral.gcd, Integral.div, Integral.quot, Integral.mod, Integral.lcm, Integral.rem

Integral integ => integ -> Bool

Integral.even, Integral.odd

Integral integ => integ -> Integer

Integral.big

Integral integ => integ -> integ

Integral.bcmpl

Num n => Int -> n

Num.fromInt

Num n => n -> n -> n

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

Num n => n -> Bool

Num.isNaN, Num.isInfinite, Num.isNumber

Num n => n -> Int

Num.sign

Num n => n -> n

Num.abs, Num.negate

Ord ord => ord -> ord -> Bool

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

Ord ord => ord -> ord -> Ordering

Ord.<=>, Ord.compare

Ord ord => ord -> ord -> ord

Ord.max, Ord.min

Real r => r -> r -> r

Real./

State α α

State.get

Maybe a

Maybe.Nothing

[a]

[].[]

u

undefined

Bounded b => b

Bounded.minBound, Bounded.maxBound

Num n => n

Num.one, Num.zero

(α, β) -> α

fst

(α, β) -> β

snd

(s->(a, s)) -> State s a

State.State

(s->a) -> ST s a

ST.ST

(α->β) -> α -> β

$, $!

STRef a s -> a -> ST s ()

STRef.put

STRef a s -> ST s a

STRef.get

State α β -> α -> (β, α)

State.run

a -> b -> (a, b)

strictTuple2, (,).(,)

a -> Either a b

Either.Left

a -> Mutable (STRef a) s

STRef.new

b -> Either a b

Either.Right

α -> (β->α) -> Maybe β -> α

maybe

α -> β -> α

const

α -> β -> β

seq

α -> ST β α

ST.return

α -> State β α

State.return

Eq β => (α->β) -> α -> α -> Bool

using

Ord β => (α->β) -> α -> α -> Ordering

ascending, comparing, descending

((α, γ)->β) -> α -> γ -> β

curry

(α->γ->β) -> (α, γ) -> β

uncurry

(α->γ->β) -> γ -> α -> β

flip

(α->β) -> (γ->α) -> γ -> β

<~,

(α->β) -> (γ->β) -> Either α γ -> β

either

(β->γ) -> (α->β) -> α -> γ

@

(γ->α) -> (α->β) -> γ -> β

~>

ST γ α -> (α->ST γ β) -> ST γ β

ST.>>=

State α γ -> State α β -> State α β

State.>>

State γ α -> (α->State γ β) -> State γ β

State.>>=

a -> b -> c -> (a, b, c)

strictTuple3

a -> b -> c -> (a, b, c)

(,,).(,,)

a -> b -> c -> d -> (a, b, c, d)

strictTuple4

a -> b -> c -> d -> (a, b, c, d)

(,,,).(,,,)

a -> b -> c -> d -> e -> (a, b, c, d, e)

strictTuple5

a -> b -> c -> d -> e -> (a, b, c, d, e)

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

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

strictTuple6

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

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

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

strictTuple7

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

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

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

strictTuple8

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

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

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 -> (a, b, c, d, e, f, g, h, i)

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

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 -> (a, b, c, d, e, f, g, h, i, j)

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

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 -> (a, b, c, d, e, f, g, h, i, j, k)

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

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 -> (a, b, c, d, e, f, g, h, i, j, k, l)

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

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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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 -> (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 -> 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

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)

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

Valid HTML 4.01 Strict