Safe Haskell | None |
---|
- type Char = Char
- type String = [Char]
- type Int = Int
- type Double = Double
- data Bool
- (+) :: Int -> Int -> Int
- (-) :: Int -> Int -> Int
- (*) :: Int -> Int -> Int
- mod :: Int -> Int -> Int
- (>) :: Int -> Int -> Bool
- (<) :: Int -> Int -> Bool
- (>=) :: Int -> Int -> Bool
- (<=) :: Int -> Int -> Bool
- (==) :: Int -> Int -> Bool
- (/=) :: Int -> Int -> Bool
- (+.) :: Double -> Double -> Double
- (-.) :: Double -> Double -> Double
- (*.) :: Double -> Double -> Double
- (>.) :: Double -> Double -> Bool
- (<.) :: Double -> Double -> Bool
- (>=.) :: Double -> Double -> Bool
- (<=.) :: Double -> Double -> Bool
- (==.) :: Double -> Double -> Bool
- (/=.) :: Double -> Double -> Bool
- (||) :: Bool -> Bool -> Bool
- (&&) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- doubleToString :: Double -> String
- intToString :: Int -> String
- charToString :: Char -> String
- intToDouble :: Int -> Double
- intToChar :: Int -> Char
- charToInt :: Char -> Int
- data BasicList a
- empty :: BasicList a
- prepend :: a -> BasicList a -> BasicList a
- get :: Int -> BasicList a -> a
- (<>) :: String -> String -> String
- (.) :: (b -> c) -> (a -> b) -> a -> c
- trace :: String -> a -> a
- error :: [Char] -> a
- print :: Show a => a -> IO ()
- (>>) :: Monad m => forall a b. m a -> m b -> m b
- return :: Monad m => forall a. a -> m a
Basic Types
Arithmetic arithmetic and comparison
Integer arithmetic and comparison
Double arithmetic and comparison
Boolean operators
Type conversion functions
doubleToString :: Double -> StringSource
intToString :: Int -> StringSource
charToString :: Char -> StringSource
intToDouble :: Int -> DoubleSource
Very basic lists
String operations
Other convenient operators
(.) :: (b -> c) -> (a -> b) -> a -> c
Function composition.
The trace
function outputs the trace message given as its first argument,
before returning the second argument as its result.
For example, this returns the value of f x
but first outputs the message.
trace ("calling f with x = " ++ show x) (f x)
The trace
function should only be used for debugging, or for monitoring
execution. The function is not referentially transparent: its type indicates
that it is a pure function but it has the side effect of outputting the
trace message.
Output
The print
function outputs a value of any printable type to the
standard output device.
Printable types are those that are instances of class Show
; print
converts values to strings for output using the show
operation and
adds a newline.
For example, a program to print the first 20 integers and their powers of 2 could be written as:
main = print ([(n, 2^n) | n <- [0..19]])