gofer-prelude-2.30.3: The Gofer 2.30 standard prelude

Prelude.Gofer

Contents

Description

Copyright Mark P Jones 1991-1994. Copyright Don Stewart, 2009

Functional programming environment, Version 2.30 Standard prelude for use of overloaded values using type classes. Based on the Haskell standard prelude version 1.2.

Synopsis

Documentation

       __________   __________   __________   __________   ________
      /  _______/  /  ____   /  /  _______/  /  _______/  /  ____  \
     /  / _____   /  /   /  /  /  /______   /  /______   /  /___/  /
    /  / /_   /  /  /   /  /  /  _______/  /  _______/  /  __   __/
   /  /___/  /  /  /___/  /  /  /         /  /______   /  /  \  \ 
  /_________/  /_________/  /__/         /_________/  /__/    \__\

Functional programming environment, Version 2.30 Copyright Mark P Jones 1991-1994.

Standard prelude for use of overloaded values using type classes. Based on the Haskell standard prelude version 1.2.

Standard combinators

strict :: (t1 -> t) -> t1 -> tSource

const :: a -> b -> aSource

primitive strict primStrict :: (a -> b) -> a -> b

id :: a -> aSource

curry :: ((a, b) -> c) -> a -> b -> cSource

uncurry :: (a -> b -> c) -> (a, b) -> cSource

fst :: (a, b) -> aSource

snd :: (a, b) -> bSource

fst3 :: (a, b, c) -> aSource

snd3 :: (a, b, c) -> bSource

thd3 :: (a, b, c) -> cSource

(.) :: (b -> c) -> (a -> b) -> a -> cSource

flip :: (a -> b -> c) -> b -> a -> cSource

($)Source

Arguments

:: (a -> b) 
-> a 
-> b

pronounced as apply elsewhere

Boolean functions

any :: (a -> Bool) -> [a] -> BoolSource

all :: (a -> Bool) -> [a] -> BoolSource

Character functions

Standard type classes

(==) :: Eq a => a -> a -> BoolSource

(/=) :: Eq a => a -> a -> BoolSource

(<) :: Ord a => a -> a -> BoolSource

(<=) :: Ord a => a -> a -> BoolSource

(>) :: Ord a => a -> a -> BoolSource

(>=) :: Ord a => a -> a -> BoolSource

max :: Ord a => a -> a -> aSource

min :: Ord a => a -> a -> aSource

range :: Ix a => (a, a) -> [a]Source

index :: Ix a => (a, a) -> a -> IntSource

inRange :: Ix a => (a, a) -> a -> BoolSource

enumFrom :: Enum a => a -> [a]Source

enumFromThen :: Enum a => a -> a -> [a]Source

enumFromTo :: Enum a => a -> a -> [a]Source

enumFromThenTo :: Enum a => a -> a -> a -> [a]Source

(+) :: Num a => a -> a -> aSource

(-) :: Num a => a -> a -> aSource

(*) :: Num a => a -> a -> aSource

(/) :: Num a => a -> a -> aSource

negate :: Num a => a -> aSource

fromInteger_ :: Num a => Int -> aSource

Standard numerical functions

div :: Int -> Int -> IntSource

rem :: Int -> Int -> IntSource

mod :: Int -> Int -> IntSource

subtract :: Num a => a -> a -> aSource

gcd :: Int -> Int -> IntSource

lcm :: Int -> Int -> IntSource

(^) :: Num a => a -> Int -> aSource

abs :: (Num a, Ord a) => a -> aSource

signum :: (Num a, Ord a) => a -> IntSource

sum :: Num a => [a] -> aSource

product :: Num a => [a] -> aSource

sums :: Num a => [a] -> [a]Source

products :: Num a => [a] -> [a]Source

Standard list processing functions

head :: [a] -> aSource

last :: [a] -> aSource

tail :: [a] -> [a]Source

init :: [a] -> [a]Source

(++)Source

Arguments

:: [a] 
-> [a] 
-> [a]

append lists. Associative with

genericLength :: Num a => [b] -> aSource

lengthSource

Arguments

:: [a] 
-> Int

calculate length of list

(!!)Source

Arguments

:: [a] 
-> Int 
-> a

xs!!n selects the nth element of

iterateSource

Arguments

:: (a -> a) 
-> a 
-> [a]

generate the infinite list

repeatSource

Arguments

:: a 
-> [a]

generate the infinite list

cycleSource

Arguments

:: [a] 
-> [a]

generate the infinite list

copySource

Arguments

:: Int 
-> a 
-> [a]

make list of n copies of x

nubSource

Arguments

:: Eq a 
=> [a] 
-> [a]

remove duplicates from list

reverseSource

Arguments

:: [a] 
-> [a]

reverse elements of list

elem :: Eq a => a -> [a] -> BoolSource

notElem :: Eq a => a -> [a] -> BoolSource

test for membership in list

maximum :: Ord a => [a] -> aSource

minimum :: Ord a => [a] -> aSource

max element in non-empty list. min element in non-empty list

concatSource

Arguments

:: [[a]] 
-> [a]

concatenate list of lists

transposeSource

Arguments

:: [[a]] 
-> [[a]]

transpose list of lists

null :: [a] -> BoolSource

null provides a simple and efficient way of determining whether a given list is empty, without using (==) and hence avoiding a constraint of the form Eq [a].

(\\) :: Eq a => [a] -> [a] -> [a]Source

(\) is used to remove the first occurrence of each element in the second list from the first list. It is a kind of inverse of (++) in the sense that (xs ++ ys) \ xs = ys for any finite list xs of proper values xs.

map :: (a -> b) -> [a] -> [b]Source

map f xs applies the function f to each element of the list xs returning the corresponding list of results. filter p xs returns the sublist of xs containing those elements which satisfy the predicate p.

filter :: (a -> Bool) -> [a] -> [a]Source

foldl :: (a -> b -> a) -> a -> [b] -> aSource

Fold primitives: The foldl and scanl functions, variants foldl1 and scanl1 for non-empty lists, and strict variants foldl' scanl' describe common patterns of recursion over lists. Informally:

 foldl f a [x1, x2, ..., xn]  = f (...(f (f a x1) x2)...) xn
                              = (...((a `f` x1) `f` x2)...) `f` xn

etc...

The functions foldr, scanr and variants foldr1, scanr1 are duals of these functions:

   foldr f a xs = foldl (flip f) a (reverse xs)  for finite lists xs.

foldl1 :: (a -> a -> a) -> [a] -> aSource

foldl' :: (a -> b -> a) -> a -> [b] -> aSource

scanl :: (a -> b -> a) -> a -> [b] -> [a]Source

scanl1 :: (a -> a -> a) -> [a] -> [a]Source

scanl' :: (a -> b -> a) -> a -> [b] -> [a]Source

foldr :: (a -> b -> b) -> b -> [a] -> bSource

foldr1 :: (a -> a -> a) -> [a] -> aSource

scanr :: (a -> b -> b) -> b -> [a] -> [b]Source

scanr1 :: (a -> a -> a) -> [a] -> [a]Source

List breaking functions

take :: Int -> [a] -> [a]Source

List breaking functions:

take n xs returns the first n elements of xs drop n xs returns the remaining elements of xs splitAt n xs = (take n xs, drop n xs)

takeWhile p xs returns the longest initial segment of xs whose elements satisfy p dropWhile p xs returns the remaining portion of the list span p xs = (takeWhile p xs, dropWhile p xs)

takeUntil p xs returns the list of elements upto and including the first element of xs which satisfies p

drop :: Int -> [a] -> [a]Source

splitAt :: Int -> [a] -> ([a], [a])Source

takeWhile :: (a -> Bool) -> [a] -> [a]Source

takeUntil :: (a -> Bool) -> [a] -> [a]Source

dropWhile :: (a -> Bool) -> [a] -> [a]Source

span :: (a -> Bool) -> [a] -> ([a], [a])Source

break :: (a -> Bool) -> [a] -> ([a], [a])Source

Text processing:

lines :: String -> [String]Source

Text processing: lines s returns the list of lines in the string s. words s returns the list of words in the string s. unlines ls joins the list of lines ls into a single string with lines separated by newline characters. unwords ws joins the list of words ws into a single string with words separated by spaces.

Merging and sorting lists:

merge :: Ord a => [a] -> [a] -> [a]Source

sort :: Ord a => [a] -> [a]Source

insert :: Ord a => a -> [a] -> [a]Source

qsort :: Ord a => [a] -> [a]Source

zip and zipWith families of functions:

zip :: [a] -> [b] -> [(a, b)]Source

zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]Source

zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]Source

zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]Source

zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)]Source

zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)]Source

zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]Source

zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]Source

zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]Source

zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f]Source

zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g]Source

zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h]Source

unzip :: [(a, b)] -> ([a], [b])Source

Formatted output

Miscellaneous

until :: (a -> Bool) -> (a -> a) -> a -> aSource

until' :: (a -> Bool) -> (a -> a) -> a -> [a]Source

error :: [Char] -> aSource

asTypeOf :: a -> a -> aSource

A trimmed down version of the Haskell Text class

showsPrec :: Text a => Int -> a -> ShowSSource

showList :: Text a => [a] -> ShowSSource

shows :: Text a => a -> ShowSSource

show :: Text a => a -> StringSource

I/O functions and definitions

data Request Source

The Dialogue, Request, Response and IOError datatypes are now builtin:

strDispatch :: (IOError -> [Response] -> t) -> (String -> [Response] -> t) -> [Response] -> tSource

succDispatch :: (IOError -> [Response] -> t) -> ([Response] -> t) -> [Response] -> tSource

strListDispatch :: (IOError -> [Response] -> t) -> ([String] -> [Response] -> t) -> [Response] -> tSource

print :: Text a => a -> DialogueSource

prints :: Text a => a -> String -> DialogueSource