| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
AOPPrelude
Synopsis
- (.) :: (b -> c) -> (a -> b) -> a -> c
- const :: a -> b -> a
- id :: a -> a
- outl :: (a, b) -> a
- outr :: (a, b) -> b
- swap :: (a, b) -> (b, a)
- assocl :: (a, (b, c)) -> ((a, b), c)
- assocr :: ((a, b), c) -> (a, (b, c))
- dupl :: (a, (b, c)) -> ((a, b), (a, c))
- dupr :: ((a, b), c) -> ((a, c), (b, c))
- pair :: (a -> b, a -> c) -> a -> (b, c)
- cross :: (a -> c, b -> d) -> (a, b) -> (c, d)
- cond :: (a -> Bool) -> (a -> b, a -> b) -> a -> b
- curry :: ((a, b) -> c) -> a -> b -> c
- uncurry :: (a -> b -> c) -> (a, b) -> c
- false :: a -> Bool
- true :: a -> Bool
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- not :: Bool -> Bool
- otherwise :: Bool
- leq :: Ord a => (a, a) -> Bool
- less :: Ord a => (a, a) -> Bool
- eql :: Ord a => (a, a) -> Bool
- neq :: Ord a => (a, a) -> Bool
- gtr :: Ord a => (a, a) -> Bool
- geq :: Ord a => (a, a) -> Bool
- meet :: (a -> Bool, a -> Bool) -> a -> Bool
- join :: (a -> Bool, a -> Bool) -> a -> Bool
- wok :: ((b, a) -> c) -> (a, b) -> c
- zero :: Num a => t -> a
- succ :: Num a => a -> a
- pred :: Num a => a -> a
- plus :: Num a => (a, a) -> a
- minus :: Num a => (a, a) -> a
- times :: Num a => (a, a) -> a
- divide :: Fractional a => (a, a) -> a
- negative :: (Ord a, Num a) => a -> Bool
- positive :: (Ord a, Num a) => a -> Bool
- (++) :: [a] -> [a] -> [a]
- null :: [a] -> Bool
- nil :: t -> [a]
- wrap :: a -> [a]
- cons :: (a, [a]) -> [a]
- cat :: ([a], [a]) -> [a]
- concat :: [[a]] -> [a]
- snoc :: ([a], a) -> [a]
- head :: [a] -> a
- tail :: [a] -> [a]
- split :: [a] -> (a, [a])
- last :: [a] -> a
- init :: [a] -> [a]
- inits :: [a] -> [[a]]
- tails :: [a] -> [[a]]
- splits :: [a] -> [([a], [a])]
- cpp :: ([a], [b]) -> [(a, b)]
- cpl :: ([a], b) -> [(a, b)]
- cpr :: (a, [b]) -> [(a, b)]
- cplist :: [[a]] -> [[a]]
- minlist :: ((a, a) -> Bool) -> [a] -> a
- bmin :: ((a, a) -> Bool) -> (a, a) -> a
- maxlist :: ((a, a) -> Bool) -> [a] -> a
- bmax :: ((a, a) -> Bool) -> (a, a) -> a
- thinlist :: ((a, a) -> Bool) -> [a] -> [a]
- length :: Num a => [t] -> a
- sum :: Num a => [a] -> a
- trans :: [[a]] -> [[a]]
- list :: (a -> b) -> [a] -> [b]
- filter :: (a -> Bool) -> [a] -> [a]
- catalist :: (b, (a, b) -> b) -> [a] -> b
- cata1list :: (a -> b, (a, b) -> b) -> [a] -> b
- cata2list :: ((a, a) -> b, (a, b) -> b) -> [a] -> b
- loop :: ((a, b) -> a) -> (a, [b]) -> a
- merge :: ((a, a) -> Bool) -> ([a], [a]) -> [a]
- zip :: ([a], [b]) -> [(a, b)]
- unzip :: [(a, b)] -> ([a], [b])
- words :: String -> [String]
- lines :: String -> [String]
- unwords :: [String] -> String
- unlines :: [String] -> String
- ord :: Char -> Int
- chr :: Int -> Char
- (==) :: Eq a => a -> a -> Bool
- (/=) :: Eq a => a -> a -> Bool
- (<=) :: Ord a => a -> a -> Bool
- (<) :: Ord a => a -> a -> Bool
- (>=) :: Ord a => a -> a -> Bool
- (>) :: Ord a => a -> a -> Bool
- (+) :: Num a => a -> a -> a
- (-) :: Num a => a -> a -> a
- (/) :: Fractional a => a -> a -> a
- div :: Integral a => a -> a -> a
- mod :: Integral a => a -> a -> a
- (*) :: Num a => a -> a -> a
- negate :: Num a => a -> a
- primPrint :: Show a => a -> IO ()
- strict :: (a -> b) -> a -> b
- error :: HasCallStack => [Char] -> a
- show :: Show a => a -> String
- flip :: (a -> b -> c) -> b -> a -> c
- type String = [Char]
- class Num a
- class Num a => Fractional a
- class Show a
- data Natural
- module GHC.Types
Documentation
divide :: Fractional a => (a, a) -> a Source #
(/) :: Fractional a => a -> a -> a infixl 7 #
fractional division
mod :: Integral a => a -> a -> a infixl 7 #
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
error :: HasCallStack => [Char] -> a #
error stops execution and displays an error message.
Basic numeric class.
The Haskell Report defines no laws for Num. However, '(+)' and '(*)' are
customarily expected to define a ring and have the following properties:
- Associativity of (+)
(x + y) + z=x + (y + z)- Commutativity of (+)
x + y=y + xfromInteger 0is the additive identityx + fromInteger 0=xnegategives the additive inversex + negate x=fromInteger 0- Associativity of (*)
(x * y) * z=x * (y * z)fromInteger 1is the multiplicative identityx * fromInteger 1=xandfromInteger 1 * x=x- Distributivity of (*) with respect to (+)
a * (b + c)=(a * b) + (a * c)and(b + c) * a=(b * a) + (c * a)
Note that it isn't customarily expected that a type instance of both Num
and Ord implement an ordered ring. Indeed, in base only Integer and
Rational do.
class Num a => Fractional a #
Fractional numbers, supporting real division.
The Haskell Report defines no laws for Fractional. However, '(+)' and
'(*)' are customarily expected to define a division ring and have the
following properties:
recipgives the multiplicative inversex * recip x=recip x * x=fromInteger 1
Note that it isn't customarily expected that a type instance of
Fractional implement a field. However, all instances in base do.
Minimal complete definition
fromRational, (recip | (/))
Conversion of values to readable Strings.
Derived instances of Show have the following properties, which
are compatible with derived instances of Read:
- The result of
showis a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrecwill produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
xis less thand(associativity is ignored). Thus, ifdis0then the result is never surrounded in parentheses; ifdis11it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
showwill produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show is equivalent to
instance (Show a) => Show (Tree a) where
showsPrec d (Leaf m) = showParen (d > app_prec) $
showString "Leaf " . showsPrec (app_prec+1) m
where app_prec = 10
showsPrec d (u :^: v) = showParen (d > up_prec) $
showsPrec (up_prec+1) u .
showString " :^: " .
showsPrec (up_prec+1) v
where up_prec = 5Note that right-associativity of :^: is ignored. For example,
produces the stringshow(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
Instances
| Show Bool | Since: base-2.1 |
| Show Char | Since: base-2.1 |
| Show Int | Since: base-2.1 |
| Show Integer | Since: base-2.1 |
| Show Natural | Since: base-4.8.0.0 |
| Show Ordering | Since: base-2.1 |
| Show Word | Since: base-2.1 |
| Show RuntimeRep | Since: base-4.11.0.0 |
Defined in GHC.Show Methods showsPrec :: Int -> RuntimeRep -> ShowS # show :: RuntimeRep -> String # showList :: [RuntimeRep] -> ShowS # | |
| Show VecCount | Since: base-4.11.0.0 |
| Show VecElem | Since: base-4.11.0.0 |
| Show CallStack | Since: base-4.9.0.0 |
| Show () | Since: base-2.1 |
| Show TyCon | Since: base-2.1 |
| Show Module | Since: base-4.9.0.0 |
| Show TrName | Since: base-4.9.0.0 |
| Show KindRep | |
| Show TypeLitSort | Since: base-4.11.0.0 |
Defined in GHC.Show Methods showsPrec :: Int -> TypeLitSort -> ShowS # show :: TypeLitSort -> String # showList :: [TypeLitSort] -> ShowS # | |
| Show SrcLoc | Since: base-4.9.0.0 |
| Show a => Show [a] | Since: base-2.1 |
| Show a => Show (Maybe a) | Since: base-2.1 |
| Show a => Show (Ratio a) | Since: base-2.0.1 |
| Show a => Show (NonEmpty a) | Since: base-4.11.0.0 |
| (Show a, Show b) => Show (a, b) | Since: base-2.1 |
| (Show a, Show b, Show c) => Show (a, b, c) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d) => Show (a, b, c, d) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n) | Since: base-2.1 |
| (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) | Since: base-2.1 |
Type representing arbitrary-precision non-negative integers.
>>>2^100 :: Natural1267650600228229401496703205376
Operations whose result would be negative ,throw (Underflow :: ArithException)
>>>-1 :: Natural*** Exception: arithmetic underflow
Since: base-4.8.0.0
Instances
| Eq Natural | Since: base-4.8.0.0 |
| Integral Natural | Since: base-4.8.0.0 |
Defined in GHC.Real | |
| Num Natural | Note that Since: base-4.8.0.0 |
| Ord Natural | Since: base-4.8.0.0 |
| Real Natural | Since: base-4.8.0.0 |
Defined in GHC.Real Methods toRational :: Natural -> Rational # | |
| Show Natural | Since: base-4.8.0.0 |
module GHC.Types