base-4.9.0.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilitystable
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Prelude

Contents

Description

The Prelude: a standard module. The Prelude is imported by default into all Haskell modules unless either there is an explicit import statement for it, or the NoImplicitPrelude extension is enabled.

Synopsis

Standard types, classes and related functions

Basic data types

data Bool :: TYPE Lifted Source

Constructors

False 
True 

Instances

Bounded Bool 
Enum Bool 
Eq Bool 

Methods

(==) :: Bool -> Bool -> Bool Source

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

Data Bool 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bool -> c Bool Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Bool Source

toConstr :: Bool -> Constr Source

dataTypeOf :: Bool -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Bool) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Bool) Source

gmapT :: (forall b. Data b => b -> b) -> Bool -> Bool Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bool -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Bool -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Bool -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bool -> m Bool Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bool -> m Bool Source

Ord Bool 
Read Bool 
Show Bool 
Ix Bool 
Generic Bool 

Associated Types

type Rep Bool :: * -> * Source

Methods

from :: Bool -> Rep Bool x Source

to :: Rep Bool x -> Bool Source

FiniteBits Bool 
Bits Bool 
Storable Bool 
type Rep Bool = D1 (MetaData "Bool" "GHC.Types" "ghc-prim" False) ((:+:) (C1 (MetaCons "False" PrefixI False) U1) (C1 (MetaCons "True" PrefixI False) U1)) 
type (==) Bool a b 

(&&) :: Bool -> Bool -> Bool infixr 3 Source

Boolean "and"

(||) :: Bool -> Bool -> Bool infixr 2 Source

Boolean "or"

not :: Bool -> Bool Source

Boolean "not"

otherwise :: Bool Source

otherwise is defined as the value True. It helps to make guards more readable. eg.

 f x | x < 0     = ...
     | otherwise = ...

data Maybe a Source

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing. A richer error monad can be built using the Either type.

Constructors

Nothing 
Just a 

Instances

Monad Maybe 

Methods

(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b Source

(>>) :: Maybe a -> Maybe b -> Maybe b Source

return :: a -> Maybe a Source

fail :: String -> Maybe a Source

Functor Maybe 

Methods

fmap :: (a -> b) -> Maybe a -> Maybe b Source

(<$) :: a -> Maybe b -> Maybe a Source

MonadFix Maybe 

Methods

mfix :: (a -> Maybe a) -> Maybe a Source

MonadFail Maybe 

Methods

fail :: String -> Maybe a Source

Applicative Maybe 

Methods

pure :: a -> Maybe a Source

(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b Source

(*>) :: Maybe a -> Maybe b -> Maybe b Source

(<*) :: Maybe a -> Maybe b -> Maybe a Source

Foldable Maybe 

Methods

fold :: Monoid m => Maybe m -> m Source

foldMap :: Monoid m => (a -> m) -> Maybe a -> m Source

foldr :: (a -> b -> b) -> b -> Maybe a -> b Source

foldr' :: (a -> b -> b) -> b -> Maybe a -> b Source

foldl :: (b -> a -> b) -> b -> Maybe a -> b Source

foldl' :: (b -> a -> b) -> b -> Maybe a -> b Source

foldr1 :: (a -> a -> a) -> Maybe a -> a Source

foldl1 :: (a -> a -> a) -> Maybe a -> a Source

toList :: Maybe a -> [a] Source

null :: Maybe a -> Bool Source

length :: Maybe a -> Int Source

elem :: Eq a => a -> Maybe a -> Bool Source

maximum :: Ord a => Maybe a -> a Source

minimum :: Ord a => Maybe a -> a Source

sum :: Num a => Maybe a -> a Source

product :: Num a => Maybe a -> a Source

Traversable Maybe 

Methods

traverse :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) Source

sequenceA :: Applicative f => Maybe (f a) -> f (Maybe a) Source

mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) Source

sequence :: Monad m => Maybe (m a) -> m (Maybe a) Source

Generic1 Maybe 

Associated Types

type Rep1 (Maybe :: * -> TYPE Lifted) :: * -> * Source

Methods

from1 :: Maybe a -> Rep1 Maybe a Source

to1 :: Rep1 Maybe a -> Maybe a Source

MonadPlus Maybe 

Methods

mzero :: Maybe a Source

mplus :: Maybe a -> Maybe a -> Maybe a Source

Alternative Maybe 

Methods

empty :: Maybe a Source

(<|>) :: Maybe a -> Maybe a -> Maybe a Source

some :: Maybe a -> Maybe [a] Source

many :: Maybe a -> Maybe [a] Source

MonadZip Maybe 

Methods

mzip :: Maybe a -> Maybe b -> Maybe (a, b) Source

mzipWith :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c Source

munzip :: Maybe (a, b) -> (Maybe a, Maybe b) Source

Show1 Maybe 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Maybe a -> ShowS Source

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Maybe a] -> ShowS Source

Read1 Maybe 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Maybe a) Source

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Maybe a] Source

Ord1 Maybe 

Methods

liftCompare :: (a -> b -> Ordering) -> Maybe a -> Maybe b -> Ordering Source

Eq1 Maybe 

Methods

liftEq :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool Source

Eq a => Eq (Maybe a) 

Methods

(==) :: Maybe a -> Maybe a -> Bool Source

(/=) :: Maybe a -> Maybe a -> Bool Source

Data a => Data (Maybe a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Maybe a -> c (Maybe a) Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Maybe a) Source

toConstr :: Maybe a -> Constr Source

dataTypeOf :: Maybe a -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c (Maybe a)) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Maybe a)) Source

gmapT :: (forall b. Data b => b -> b) -> Maybe a -> Maybe a Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Maybe a -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Maybe a -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Maybe a -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Maybe a -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Maybe a -> m (Maybe a) Source

Ord a => Ord (Maybe a) 

Methods

compare :: Maybe a -> Maybe a -> Ordering Source

(<) :: Maybe a -> Maybe a -> Bool Source

(<=) :: Maybe a -> Maybe a -> Bool Source

(>) :: Maybe a -> Maybe a -> Bool Source

(>=) :: Maybe a -> Maybe a -> Bool Source

max :: Maybe a -> Maybe a -> Maybe a Source

min :: Maybe a -> Maybe a -> Maybe a Source

Read a => Read (Maybe a) 
Show a => Show (Maybe a) 
Generic (Maybe a) 

Associated Types

type Rep (Maybe a) :: * -> * Source

Methods

from :: Maybe a -> Rep (Maybe a) x Source

to :: Rep (Maybe a) x -> Maybe a Source

Semigroup a => Semigroup (Maybe a) 

Methods

(<>) :: Maybe a -> Maybe a -> Maybe a Source

sconcat :: NonEmpty (Maybe a) -> Maybe a Source

stimes :: Integral b => b -> Maybe a -> Maybe a Source

Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Methods

mempty :: Maybe a Source

mappend :: Maybe a -> Maybe a -> Maybe a Source

mconcat :: [Maybe a] -> Maybe a Source

type Rep1 Maybe = D1 (MetaData "Maybe" "GHC.Base" "base" False) ((:+:) (C1 (MetaCons "Nothing" PrefixI False) U1) (C1 (MetaCons "Just" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))) 
type Rep (Maybe a) = D1 (MetaData "Maybe" "GHC.Base" "base" False) ((:+:) (C1 (MetaCons "Nothing" PrefixI False) U1) (C1 (MetaCons "Just" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))) 
type (==) (Maybe k) a b 

maybe :: b -> (a -> b) -> Maybe a -> b Source

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

Examples

Basic usage:

>>> maybe False odd (Just 3)
True
>>> maybe False odd Nothing
False

Read an integer from a string using readMaybe. If we succeed, return twice the integer; that is, apply (*2) to it. If instead we fail to parse an integer, return 0 by default:

>>> import Text.Read ( readMaybe )
>>> maybe 0 (*2) (readMaybe "5")
10
>>> maybe 0 (*2) (readMaybe "")
0

Apply show to a Maybe Int. If we have Just n, we want to show the underlying Int n. But if we have Nothing, we return the empty string instead of (for example) "Nothing":

>>> maybe "" show (Just 5)
"5"
>>> maybe "" show Nothing
""

data Either a b Source

The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b.

The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct").

Examples

The type Either String Int is the type of values which can be either a String or an Int. The Left constructor can be used only on Strings, and the Right constructor can be used only on Ints:

>>> let s = Left "foo" :: Either String Int
>>> s
Left "foo"
>>> let n = Right 3 :: Either String Int
>>> n
Right 3
>>> :type s
s :: Either String Int
>>> :type n
n :: Either String Int

The fmap from our Functor instance will ignore Left values, but will apply the supplied function to values contained in a Right:

>>> let s = Left "foo" :: Either String Int
>>> let n = Right 3 :: Either String Int
>>> fmap (*2) s
Left "foo"
>>> fmap (*2) n
Right 6

The Monad instance for Either allows us to chain together multiple actions which may fail, and fail overall if any of the individual steps failed. First we'll write a function that can either parse an Int from a Char, or fail.

>>> import Data.Char ( digitToInt, isDigit )
>>> :{
    let parseEither :: Char -> Either String Int
        parseEither c
          | isDigit c = Right (digitToInt c)
          | otherwise = Left "parse error"
>>> :}

The following should work, since both '1' and '2' can be parsed as Ints.

>>> :{
    let parseMultiple :: Either String Int
        parseMultiple = do
          x <- parseEither '1'
          y <- parseEither '2'
          return (x + y)
>>> :}
>>> parseMultiple
Right 3

But the following should fail overall, since the first operation where we attempt to parse 'm' as an Int will fail:

>>> :{
    let parseMultiple :: Either String Int
        parseMultiple = do
          x <- parseEither 'm'
          y <- parseEither '2'
          return (x + y)
>>> :}
>>> parseMultiple
Left "parse error"

Constructors

Left a 
Right b 

Instances

Bifunctor Either 

Methods

bimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d Source

first :: (a -> b) -> Either a c -> Either b c Source

second :: (b -> c) -> Either a b -> Either a c Source

Show2 Either 

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Either a b -> ShowS Source

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Either a b] -> ShowS Source

Read2 Either 

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Either a b) Source

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Either a b] Source

Ord2 Either 

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Either a c -> Either b d -> Ordering Source

Eq2 Either 

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Either a c -> Either b d -> Bool Source

Monad (Either e) 

Methods

(>>=) :: Either e a -> (a -> Either e b) -> Either e b Source

(>>) :: Either e a -> Either e b -> Either e b Source

return :: a -> Either e a Source

fail :: String -> Either e a Source

Functor (Either a) 

Methods

fmap :: (a -> b) -> Either a a -> Either a b Source

(<$) :: a -> Either a b -> Either a a Source

MonadFix (Either e) 

Methods

mfix :: (a -> Either e a) -> Either e a Source

Applicative (Either e) 

Methods

pure :: a -> Either e a Source

(<*>) :: Either e (a -> b) -> Either e a -> Either e b Source

(*>) :: Either e a -> Either e b -> Either e b Source

(<*) :: Either e a -> Either e b -> Either e a Source

Foldable (Either a) 

Methods

fold :: Monoid m => Either a m -> m Source

foldMap :: Monoid m => (a -> m) -> Either a a -> m Source

foldr :: (a -> b -> b) -> b -> Either a a -> b Source

foldr' :: (a -> b -> b) -> b -> Either a a -> b Source

foldl :: (b -> a -> b) -> b -> Either a a -> b Source

foldl' :: (b -> a -> b) -> b -> Either a a -> b Source

foldr1 :: (a -> a -> a) -> Either a a -> a Source

foldl1 :: (a -> a -> a) -> Either a a -> a Source

toList :: Either a a -> [a] Source

null :: Either a a -> Bool Source

length :: Either a a -> Int Source

elem :: Eq a => a -> Either a a -> Bool Source

maximum :: Ord a => Either a a -> a Source

minimum :: Ord a => Either a a -> a Source

sum :: Num a => Either a a -> a Source

product :: Num a => Either a a -> a Source

Traversable (Either a) 

Methods

traverse :: Applicative f => (a -> f b) -> Either a a -> f (Either a b) Source

sequenceA :: Applicative f => Either a (f a) -> f (Either a a) Source

mapM :: Monad m => (a -> m b) -> Either a a -> m (Either a b) Source

sequence :: Monad m => Either a (m a) -> m (Either a a) Source

Generic1 (Either a) 

Associated Types

type Rep1 (Either a :: * -> TYPE Lifted) :: * -> * Source

Methods

from1 :: Either a a -> Rep1 (Either a) a Source

to1 :: Rep1 (Either a) a -> Either a a Source

Show a => Show1 (Either a) 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Either a a -> ShowS Source

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Either a a] -> ShowS Source

Read a => Read1 (Either a) 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Either a a) Source

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Either a a] Source

Ord a => Ord1 (Either a) 

Methods

liftCompare :: (a -> b -> Ordering) -> Either a a -> Either a b -> Ordering Source

Eq a => Eq1 (Either a) 

Methods

liftEq :: (a -> b -> Bool) -> Either a a -> Either a b -> Bool Source

(Eq a, Eq b) => Eq (Either a b) 

Methods

(==) :: Either a b -> Either a b -> Bool Source

(/=) :: Either a b -> Either a b -> Bool Source

(Data a, Data b) => Data (Either a b) 

Methods

gfoldl :: (forall d c. Data d => c (d -> c) -> d -> c c) -> (forall g. g -> c g) -> Either a b -> c (Either a b) Source

gunfold :: (forall c r. Data c => c (c -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Either a b) Source

toConstr :: Either a b -> Constr Source

dataTypeOf :: Either a b -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c (Either a b)) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Either a b)) Source

gmapT :: (forall c. Data c => c -> c) -> Either a b -> Either a b Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Either a b -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Either a b -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Either a b -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Either a b -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Either a b -> m (Either a b) Source

(Ord a, Ord b) => Ord (Either a b) 

Methods

compare :: Either a b -> Either a b -> Ordering Source

(<) :: Either a b -> Either a b -> Bool Source

(<=) :: Either a b -> Either a b -> Bool Source

(>) :: Either a b -> Either a b -> Bool Source

(>=) :: Either a b -> Either a b -> Bool Source

max :: Either a b -> Either a b -> Either a b Source

min :: Either a b -> Either a b -> Either a b Source

(Read a, Read b) => Read (Either a b) 
(Show a, Show b) => Show (Either a b) 

Methods

showsPrec :: Int -> Either a b -> ShowS Source

show :: Either a b -> String Source

showList :: [Either a b] -> ShowS Source

Generic (Either a b) 

Associated Types

type Rep (Either a b) :: * -> * Source

Methods

from :: Either a b -> Rep (Either a b) x Source

to :: Rep (Either a b) x -> Either a b Source

Semigroup (Either a b) 

Methods

(<>) :: Either a b -> Either a b -> Either a b Source

sconcat :: NonEmpty (Either a b) -> Either a b Source

stimes :: Integral b => b -> Either a b -> Either a b Source

type Rep1 (Either a) = D1 (MetaData "Either" "Data.Either" "base" False) ((:+:) (C1 (MetaCons "Left" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) (C1 (MetaCons "Right" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))) 
type Rep (Either a b) = D1 (MetaData "Either" "Data.Either" "base" False) ((:+:) (C1 (MetaCons "Left" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) (C1 (MetaCons "Right" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 b)))) 
type (==) (Either k k1) a b 

either :: (a -> c) -> (b -> c) -> Either a b -> c Source

Case analysis for the Either type. If the value is Left a, apply the first function to a; if it is Right b, apply the second function to b.

Examples

We create two values of type Either String Int, one using the Left constructor and another using the Right constructor. Then we apply "either" the length function (if we have a String) or the "times-two" function (if we have an Int):

>>> let s = Left "foo" :: Either String Int
>>> let n = Right 3 :: Either String Int
>>> either length (*2) s
3
>>> either length (*2) n
6

data Ordering :: TYPE Lifted Source

Constructors

LT 
EQ 
GT 

Instances

Bounded Ordering 
Enum Ordering 
Eq Ordering 
Data Ordering 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Ordering -> c Ordering Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Ordering Source

toConstr :: Ordering -> Constr Source

dataTypeOf :: Ordering -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Ordering) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ordering) Source

gmapT :: (forall b. Data b => b -> b) -> Ordering -> Ordering Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ordering -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Ordering -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Ordering -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Ordering -> m Ordering Source

Ord Ordering 
Read Ordering 
Show Ordering 
Ix Ordering 
Generic Ordering 

Associated Types

type Rep Ordering :: * -> * Source

Semigroup Ordering 
Monoid Ordering 
type Rep Ordering = D1 (MetaData "Ordering" "GHC.Types" "ghc-prim" False) ((:+:) (C1 (MetaCons "LT" PrefixI False) U1) ((:+:) (C1 (MetaCons "EQ" PrefixI False) U1) (C1 (MetaCons "GT" PrefixI False) U1))) 
type (==) Ordering a b 

data Char :: TYPE Lifted Source

The character type Char is an enumeration whose values represent Unicode (or equivalently ISO/IEC 10646) characters (see http://www.unicode.org/ for details). This set extends the ISO 8859-1 (Latin-1) character set (the first 256 characters), which is itself an extension of the ASCII character set (the first 128 characters). A character literal in Haskell has type Char.

To convert a Char to or from the corresponding Int value defined by Unicode, use toEnum and fromEnum from the Enum class respectively (or equivalently ord and chr).

Instances

Bounded Char 
Enum Char 
Eq Char 

Methods

(==) :: Char -> Char -> Bool Source

(/=) :: Char -> Char -> Bool Source

Data Char 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Char -> c Char Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Char Source

toConstr :: Char -> Constr Source

dataTypeOf :: Char -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Char) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Char) Source

gmapT :: (forall b. Data b => b -> b) -> Char -> Char Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Char -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Char -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Char -> m Char Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char Source

Ord Char 
Read Char 
Show Char 
Ix Char 
Storable Char 
IsChar Char 
PrintfArg Char 
Eq (URec Char p) 

Methods

(==) :: URec Char p -> URec Char p -> Bool Source

(/=) :: URec Char p -> URec Char p -> Bool Source

Ord (URec Char p) 
Show (URec Char p) 
Generic (URec Char p) 

Associated Types

type Rep (URec Char p) :: * -> * Source

Methods

from :: URec Char p -> Rep (URec Char p) x Source

to :: Rep (URec Char p) x -> URec Char p Source

data URec Char = UChar {}

Used for marking occurrences of Char#

type Rep (URec Char p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UChar" PrefixI True) (S1 (MetaSel (Just Symbol "uChar#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UChar)) 

type String = [Char] Source

A String is a list of characters. String constants in Haskell are values of type String.

Tuples

fst :: (a, b) -> a Source

Extract the first component of a pair.

snd :: (a, b) -> b Source

Extract the second component of a pair.

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

curry converts an uncurried function to a curried function.

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

uncurry converts a curried function to a function on pairs.

Basic type classes

class Eq a where Source

The Eq class defines equality (==) and inequality (/=). All the basic datatypes exported by the Prelude are instances of Eq, and Eq may be derived for any datatype whose constituents are also instances of Eq.

Minimal complete definition: either == or /=.

Minimal complete definition

(==) | (/=)

Instances

Eq Bool 

Methods

(==) :: Bool -> Bool -> Bool Source

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

Eq Char 

Methods

(==) :: Char -> Char -> Bool Source

(/=) :: Char -> Char -> Bool Source

Eq Double 
Eq Float 

Methods

(==) :: Float -> Float -> Bool Source

(/=) :: Float -> Float -> Bool Source

Eq Int 

Methods

(==) :: Int -> Int -> Bool Source

(/=) :: Int -> Int -> Bool Source

Eq Int8 

Methods

(==) :: Int8 -> Int8 -> Bool Source

(/=) :: Int8 -> Int8 -> Bool Source

Eq Int16 

Methods

(==) :: Int16 -> Int16 -> Bool Source

(/=) :: Int16 -> Int16 -> Bool Source

Eq Int32 

Methods

(==) :: Int32 -> Int32 -> Bool Source

(/=) :: Int32 -> Int32 -> Bool Source

Eq Int64 

Methods

(==) :: Int64 -> Int64 -> Bool Source

(/=) :: Int64 -> Int64 -> Bool Source

Eq Integer 
Eq Ordering 
Eq Word 

Methods

(==) :: Word -> Word -> Bool Source

(/=) :: Word -> Word -> Bool Source

Eq Word8 

Methods

(==) :: Word8 -> Word8 -> Bool Source

(/=) :: Word8 -> Word8 -> Bool Source

Eq Word16 
Eq Word32 
Eq Word64 
Eq TypeRep 
Eq () 

Methods

(==) :: () -> () -> Bool Source

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

Eq TyCon 

Methods

(==) :: TyCon -> TyCon -> Bool Source

(/=) :: TyCon -> TyCon -> Bool Source

Eq BigNat 
Eq GeneralCategory 
Eq Number 
Eq Lexeme 
Eq SomeSymbol 
Eq SomeNat 
Eq DecidedStrictness 
Eq SourceStrictness 
Eq SourceUnpackedness 
Eq Associativity 
Eq Fixity 
Eq Any 

Methods

(==) :: Any -> Any -> Bool Source

(/=) :: Any -> Any -> Bool Source

Eq All 

Methods

(==) :: All -> All -> Bool Source

(/=) :: All -> All -> Bool Source

Eq IOMode 
Eq Fingerprint 
Eq ArithException 
Eq ErrorCall 
Eq IOException 
Eq MaskingState 
Eq CUIntMax 
Eq CIntMax 
Eq CUIntPtr 
Eq CIntPtr 
Eq CSUSeconds 
Eq CUSeconds 
Eq CTime 

Methods

(==) :: CTime -> CTime -> Bool Source

(/=) :: CTime -> CTime -> Bool Source

Eq CClock 
Eq CSigAtomic 
Eq CWchar 
Eq CSize 

Methods

(==) :: CSize -> CSize -> Bool Source

(/=) :: CSize -> CSize -> Bool Source

Eq CPtrdiff 
Eq CDouble 
Eq CFloat 
Eq CULLong 
Eq CLLong 
Eq CULong 
Eq CLong 

Methods

(==) :: CLong -> CLong -> Bool Source

(/=) :: CLong -> CLong -> Bool Source

Eq CUInt 

Methods

(==) :: CUInt -> CUInt -> Bool Source

(/=) :: CUInt -> CUInt -> Bool Source

Eq CInt 

Methods

(==) :: CInt -> CInt -> Bool Source

(/=) :: CInt -> CInt -> Bool Source

Eq CUShort 
Eq CShort 
Eq CUChar 
Eq CSChar 
Eq CChar 

Methods

(==) :: CChar -> CChar -> Bool Source

(/=) :: CChar -> CChar -> Bool Source

Eq IntPtr 
Eq WordPtr 
Eq BufferState 
Eq CodingProgress 
Eq SeekMode 
Eq IODeviceType 
Eq NewlineMode 
Eq Newline 
Eq BufferMode 
Eq Handle 
Eq IOErrorType 
Eq ExitCode 
Eq ArrayException 
Eq AsyncException 
Eq Errno 

Methods

(==) :: Errno -> Errno -> Bool Source

(/=) :: Errno -> Errno -> Bool Source

Eq Fd 

Methods

(==) :: Fd -> Fd -> Bool Source

(/=) :: Fd -> Fd -> Bool Source

Eq CRLim 

Methods

(==) :: CRLim -> CRLim -> Bool Source

(/=) :: CRLim -> CRLim -> Bool Source

Eq CTcflag 
Eq CSpeed 
Eq CCc 

Methods

(==) :: CCc -> CCc -> Bool Source

(/=) :: CCc -> CCc -> Bool Source

Eq CUid 

Methods

(==) :: CUid -> CUid -> Bool Source

(/=) :: CUid -> CUid -> Bool Source

Eq CNlink 
Eq CGid 

Methods

(==) :: CGid -> CGid -> Bool Source

(/=) :: CGid -> CGid -> Bool Source

Eq CSsize 
Eq CPid 

Methods

(==) :: CPid -> CPid -> Bool Source

(/=) :: CPid -> CPid -> Bool Source

Eq COff 

Methods

(==) :: COff -> COff -> Bool Source

(/=) :: COff -> COff -> Bool Source

Eq CMode 

Methods

(==) :: CMode -> CMode -> Bool Source

(/=) :: CMode -> CMode -> Bool Source

Eq CIno 

Methods

(==) :: CIno -> CIno -> Bool Source

(/=) :: CIno -> CIno -> Bool Source

Eq CDev 

Methods

(==) :: CDev -> CDev -> Bool Source

(/=) :: CDev -> CDev -> Bool Source

Eq Lifetime 
Eq Event 

Methods

(==) :: Event -> Event -> Bool Source

(/=) :: Event -> Event -> Bool Source

Eq ThreadStatus 
Eq BlockReason 
Eq ThreadId 
Eq FdKey 

Methods

(==) :: FdKey -> FdKey -> Bool Source

(/=) :: FdKey -> FdKey -> Bool Source

Eq TimeoutKey 
Eq HandlePosn 
Eq Version 
Eq Fixity 
Eq ConstrRep 
Eq DataRep 
Eq Constr

Equality of constructors

Eq Natural 
Eq SpecConstrAnnotation 
Eq Void 

Methods

(==) :: Void -> Void -> Bool Source

(/=) :: Void -> Void -> Bool Source

Eq Unique 
Eq a => Eq [a] 

Methods

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

(/=) :: [a] -> [a] -> Bool Source

Eq a => Eq (Maybe a) 

Methods

(==) :: Maybe a -> Maybe a -> Bool Source

(/=) :: Maybe a -> Maybe a -> Bool Source

Eq a => Eq (Ratio a) 

Methods

(==) :: Ratio a -> Ratio a -> Bool Source

(/=) :: Ratio a -> Ratio a -> Bool Source

Eq (StablePtr a) 
Eq (Ptr a) 

Methods

(==) :: Ptr a -> Ptr a -> Bool Source

(/=) :: Ptr a -> Ptr a -> Bool Source

Eq (FunPtr a) 

Methods

(==) :: FunPtr a -> FunPtr a -> Bool Source

(/=) :: FunPtr a -> FunPtr a -> Bool Source

Eq (U1 p) 

Methods

(==) :: U1 p -> U1 p -> Bool Source

(/=) :: U1 p -> U1 p -> Bool Source

Eq p => Eq (Par1 p) 

Methods

(==) :: Par1 p -> Par1 p -> Bool Source

(/=) :: Par1 p -> Par1 p -> Bool Source

Eq (MVar a) 

Methods

(==) :: MVar a -> MVar a -> Bool Source

(/=) :: MVar a -> MVar a -> Bool Source

Eq a => Eq (Down a) 

Methods

(==) :: Down a -> Down a -> Bool Source

(/=) :: Down a -> Down a -> Bool Source

Eq a => Eq (Last a) 

Methods

(==) :: Last a -> Last a -> Bool Source

(/=) :: Last a -> Last a -> Bool Source

Eq a => Eq (First a) 

Methods

(==) :: First a -> First a -> Bool Source

(/=) :: First a -> First a -> Bool Source

Eq a => Eq (Product a) 

Methods

(==) :: Product a -> Product a -> Bool Source

(/=) :: Product a -> Product a -> Bool Source

Eq a => Eq (Sum a) 

Methods

(==) :: Sum a -> Sum a -> Bool Source

(/=) :: Sum a -> Sum a -> Bool Source

Eq a => Eq (Dual a) 

Methods

(==) :: Dual a -> Dual a -> Bool Source

(/=) :: Dual a -> Dual a -> Bool Source

Eq (IORef a) 

Methods

(==) :: IORef a -> IORef a -> Bool Source

(/=) :: IORef a -> IORef a -> Bool Source

Eq (ForeignPtr a) 
Eq (TVar a) 

Methods

(==) :: TVar a -> TVar a -> Bool Source

(/=) :: TVar a -> TVar a -> Bool Source

Eq a => Eq (ZipList a) 

Methods

(==) :: ZipList a -> ZipList a -> Bool Source

(/=) :: ZipList a -> ZipList a -> Bool Source

Eq (Chan a) 

Methods

(==) :: Chan a -> Chan a -> Bool Source

(/=) :: Chan a -> Chan a -> Bool Source

Eq a => Eq (Complex a) 

Methods

(==) :: Complex a -> Complex a -> Bool Source

(/=) :: Complex a -> Complex a -> Bool Source

Eq (Fixed a) 

Methods

(==) :: Fixed a -> Fixed a -> Bool Source

(/=) :: Fixed a -> Fixed a -> Bool Source

Eq a => Eq (NonEmpty a) 

Methods

(==) :: NonEmpty a -> NonEmpty a -> Bool Source

(/=) :: NonEmpty a -> NonEmpty a -> Bool Source

Eq a => Eq (Option a) 

Methods

(==) :: Option a -> Option a -> Bool Source

(/=) :: Option a -> Option a -> Bool Source

Eq m => Eq (WrappedMonoid m) 
Eq a => Eq (Last a) 

Methods

(==) :: Last a -> Last a -> Bool Source

(/=) :: Last a -> Last a -> Bool Source

Eq a => Eq (First a) 

Methods

(==) :: First a -> First a -> Bool Source

(/=) :: First a -> First a -> Bool Source

Eq a => Eq (Max a) 

Methods

(==) :: Max a -> Max a -> Bool Source

(/=) :: Max a -> Max a -> Bool Source

Eq a => Eq (Min a) 

Methods

(==) :: Min a -> Min a -> Bool Source

(/=) :: Min a -> Min a -> Bool Source

Eq a => Eq (Identity a) 

Methods

(==) :: Identity a -> Identity a -> Bool Source

(/=) :: Identity a -> Identity a -> Bool Source

Eq (StableName a) 
(Eq a, Eq b) => Eq (Either a b) 

Methods

(==) :: Either a b -> Either a b -> Bool Source

(/=) :: Either a b -> Either a b -> Bool Source

Eq (f p) => Eq (Rec1 f p) 

Methods

(==) :: Rec1 f p -> Rec1 f p -> Bool Source

(/=) :: Rec1 f p -> Rec1 f p -> Bool Source

Eq (URec Char p) 

Methods

(==) :: URec Char p -> URec Char p -> Bool Source

(/=) :: URec Char p -> URec Char p -> Bool Source

Eq (URec Double p) 
Eq (URec Float p) 

Methods

(==) :: URec Float p -> URec Float p -> Bool Source

(/=) :: URec Float p -> URec Float p -> Bool Source

Eq (URec Int p) 

Methods

(==) :: URec Int p -> URec Int p -> Bool Source

(/=) :: URec Int p -> URec Int p -> Bool Source

Eq (URec Word p) 

Methods

(==) :: URec Word p -> URec Word p -> Bool Source

(/=) :: URec Word p -> URec Word p -> Bool Source

Eq (URec (Ptr ()) p) 

Methods

(==) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source

(/=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source

(Eq a, Eq b) => Eq (a, b) 

Methods

(==) :: (a, b) -> (a, b) -> Bool Source

(/=) :: (a, b) -> (a, b) -> Bool Source

Eq (STRef s a) 

Methods

(==) :: STRef s a -> STRef s a -> Bool Source

(/=) :: STRef s a -> STRef s a -> Bool Source

Eq (Proxy k s) 

Methods

(==) :: Proxy k s -> Proxy k s -> Bool Source

(/=) :: Proxy k s -> Proxy k s -> Bool Source

Eq a => Eq (Arg a b) 

Methods

(==) :: Arg a b -> Arg a b -> Bool Source

(/=) :: Arg a b -> Arg a b -> Bool Source

Eq c => Eq (K1 i c p) 

Methods

(==) :: K1 i c p -> K1 i c p -> Bool Source

(/=) :: K1 i c p -> K1 i c p -> Bool Source

(Eq (f p), Eq (g p)) => Eq ((:+:) f g p) 

Methods

(==) :: (f :+: g) p -> (f :+: g) p -> Bool Source

(/=) :: (f :+: g) p -> (f :+: g) p -> Bool Source

(Eq (f p), Eq (g p)) => Eq ((:*:) f g p) 

Methods

(==) :: (f :*: g) p -> (f :*: g) p -> Bool Source

(/=) :: (f :*: g) p -> (f :*: g) p -> Bool Source

Eq (f (g p)) => Eq ((:.:) f g p) 

Methods

(==) :: (f :.: g) p -> (f :.: g) p -> Bool Source

(/=) :: (f :.: g) p -> (f :.: g) p -> Bool Source

(Eq a, Eq b, Eq c) => Eq (a, b, c) 

Methods

(==) :: (a, b, c) -> (a, b, c) -> Bool Source

(/=) :: (a, b, c) -> (a, b, c) -> Bool Source

Eq ((:~:) k a b) 

Methods

(==) :: (k :~: a) b -> (k :~: a) b -> Bool Source

(/=) :: (k :~: a) b -> (k :~: a) b -> Bool Source

Eq (Coercion k a b) 

Methods

(==) :: Coercion k a b -> Coercion k a b -> Bool Source

(/=) :: Coercion k a b -> Coercion k a b -> Bool Source

Eq (f a) => Eq (Alt k f a) 

Methods

(==) :: Alt k f a -> Alt k f a -> Bool Source

(/=) :: Alt k f a -> Alt k f a -> Bool Source

Eq a => Eq (Const k a b) 

Methods

(==) :: Const k a b -> Const k a b -> Bool Source

(/=) :: Const k a b -> Const k a b -> Bool Source

Eq (f p) => Eq (M1 i c f p) 

Methods

(==) :: M1 i c f p -> M1 i c f p -> Bool Source

(/=) :: M1 i c f p -> M1 i c f p -> Bool Source

(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) 

Methods

(==) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source

(/=) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source

(Eq1 f, Eq1 g, Eq a) => Eq (Product (TYPE Lifted) f g a) 

Methods

(==) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Bool Source

(/=) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Bool Source

(Eq1 f, Eq1 g, Eq a) => Eq (Sum (TYPE Lifted) f g a) 

Methods

(==) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(/=) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) 

Methods

(==) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source

(/=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source

(Eq1 f, Eq1 g, Eq a) => Eq (Compose (TYPE Lifted) (TYPE Lifted) f g a) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) 

Methods

(==) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source

(/=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source

(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) 

Methods

(==) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source

(/=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source

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

Methods

(==) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source

(/=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source

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

Methods

(==) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source

(/=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source

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

Methods

(==) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source

(/=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source

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

Methods

(==) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source

(/=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source

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

Methods

(==) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source

(/=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source

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

Methods

(==) :: (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) -> Bool Source

(/=) :: (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) -> Bool Source

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

Methods

(==) :: (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) -> Bool Source

(/=) :: (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) -> Bool Source

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

Methods

(==) :: (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) -> Bool Source

(/=) :: (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) -> Bool Source

class Eq a => Ord a where Source

The Ord class is used for totally ordered datatypes.

Instances of Ord can be derived for any user-defined datatype whose constituent types are in Ord. The declared order of the constructors in the data declaration determines the ordering in derived Ord instances. The Ordering datatype allows a single comparison to determine the precise ordering of two objects.

Minimal complete definition: either compare or <=. Using compare can be more efficient for complex types.

Minimal complete definition

compare | (<=)

Instances

Ord Bool 
Ord Char 
Ord Double 
Ord Float 
Ord Int 

Methods

compare :: Int -> Int -> Ordering Source

(<) :: Int -> Int -> Bool Source

(<=) :: Int -> Int -> Bool Source

(>) :: Int -> Int -> Bool Source

(>=) :: Int -> Int -> Bool Source

max :: Int -> Int -> Int Source

min :: Int -> Int -> Int Source

Ord Int8 
Ord Int16 
Ord Int32 
Ord Int64 
Ord Integer 
Ord Ordering 
Ord Word 
Ord Word8 
Ord Word16 
Ord Word32 
Ord Word64 
Ord TypeRep 
Ord () 

Methods

compare :: () -> () -> Ordering Source

(<) :: () -> () -> Bool Source

(<=) :: () -> () -> Bool Source

(>) :: () -> () -> Bool Source

(>=) :: () -> () -> Bool Source

max :: () -> () -> () Source

min :: () -> () -> () Source

Ord TyCon 
Ord BigNat 
Ord GeneralCategory 
Ord SomeSymbol 
Ord SomeNat 
Ord DecidedStrictness 
Ord SourceStrictness 
Ord SourceUnpackedness 
Ord Associativity 
Ord Fixity 
Ord Any 

Methods

compare :: Any -> Any -> Ordering Source

(<) :: Any -> Any -> Bool Source

(<=) :: Any -> Any -> Bool Source

(>) :: Any -> Any -> Bool Source

(>=) :: Any -> Any -> Bool Source

max :: Any -> Any -> Any Source

min :: Any -> Any -> Any Source

Ord All 

Methods

compare :: All -> All -> Ordering Source

(<) :: All -> All -> Bool Source

(<=) :: All -> All -> Bool Source

(>) :: All -> All -> Bool Source

(>=) :: All -> All -> Bool Source

max :: All -> All -> All Source

min :: All -> All -> All Source

Ord IOMode 
Ord Fingerprint 
Ord ArithException 
Ord ErrorCall 
Ord CUIntMax 
Ord CIntMax 
Ord CUIntPtr 
Ord CIntPtr 
Ord CSUSeconds 
Ord CUSeconds 
Ord CTime 
Ord CClock 
Ord CSigAtomic 
Ord CWchar 
Ord CSize 
Ord CPtrdiff 
Ord CDouble 
Ord CFloat 
Ord CULLong 
Ord CLLong 
Ord CULong 
Ord CLong 
Ord CUInt 
Ord CInt 
Ord CUShort 
Ord CShort 
Ord CUChar 
Ord CSChar 
Ord CChar 
Ord IntPtr 
Ord WordPtr 
Ord SeekMode 
Ord NewlineMode 
Ord Newline 
Ord BufferMode 
Ord ExitCode 
Ord ArrayException 
Ord AsyncException 
Ord Fd 

Methods

compare :: Fd -> Fd -> Ordering Source

(<) :: Fd -> Fd -> Bool Source

(<=) :: Fd -> Fd -> Bool Source

(>) :: Fd -> Fd -> Bool Source

(>=) :: Fd -> Fd -> Bool Source

max :: Fd -> Fd -> Fd Source

min :: Fd -> Fd -> Fd Source

Ord CRLim 
Ord CTcflag 
Ord CSpeed 
Ord CCc 

Methods

compare :: CCc -> CCc -> Ordering Source

(<) :: CCc -> CCc -> Bool Source

(<=) :: CCc -> CCc -> Bool Source

(>) :: CCc -> CCc -> Bool Source

(>=) :: CCc -> CCc -> Bool Source

max :: CCc -> CCc -> CCc Source

min :: CCc -> CCc -> CCc Source

Ord CUid 
Ord CNlink 
Ord CGid 
Ord CSsize 
Ord CPid 
Ord COff 
Ord CMode 
Ord CIno 
Ord CDev 
Ord ThreadStatus 
Ord BlockReason 
Ord ThreadId 
Ord Version 
Ord Natural 
Ord Void 
Ord Unique 
Ord a => Ord [a] 

Methods

compare :: [a] -> [a] -> Ordering Source

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

(<=) :: [a] -> [a] -> Bool Source

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

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

max :: [a] -> [a] -> [a] Source

min :: [a] -> [a] -> [a] Source

Ord a => Ord (Maybe a) 

Methods

compare :: Maybe a -> Maybe a -> Ordering Source

(<) :: Maybe a -> Maybe a -> Bool Source

(<=) :: Maybe a -> Maybe a -> Bool Source

(>) :: Maybe a -> Maybe a -> Bool Source

(>=) :: Maybe a -> Maybe a -> Bool Source

max :: Maybe a -> Maybe a -> Maybe a Source

min :: Maybe a -> Maybe a -> Maybe a Source

Integral a => Ord (Ratio a) 

Methods

compare :: Ratio a -> Ratio a -> Ordering Source

(<) :: Ratio a -> Ratio a -> Bool Source

(<=) :: Ratio a -> Ratio a -> Bool Source

(>) :: Ratio a -> Ratio a -> Bool Source

(>=) :: Ratio a -> Ratio a -> Bool Source

max :: Ratio a -> Ratio a -> Ratio a Source

min :: Ratio a -> Ratio a -> Ratio a Source

Ord (Ptr a) 

Methods

compare :: Ptr a -> Ptr a -> Ordering Source

(<) :: Ptr a -> Ptr a -> Bool Source

(<=) :: Ptr a -> Ptr a -> Bool Source

(>) :: Ptr a -> Ptr a -> Bool Source

(>=) :: Ptr a -> Ptr a -> Bool Source

max :: Ptr a -> Ptr a -> Ptr a Source

min :: Ptr a -> Ptr a -> Ptr a Source

Ord (FunPtr a) 

Methods

compare :: FunPtr a -> FunPtr a -> Ordering Source

(<) :: FunPtr a -> FunPtr a -> Bool Source

(<=) :: FunPtr a -> FunPtr a -> Bool Source

(>) :: FunPtr a -> FunPtr a -> Bool Source

(>=) :: FunPtr a -> FunPtr a -> Bool Source

max :: FunPtr a -> FunPtr a -> FunPtr a Source

min :: FunPtr a -> FunPtr a -> FunPtr a Source

Ord (U1 p) 

Methods

compare :: U1 p -> U1 p -> Ordering Source

(<) :: U1 p -> U1 p -> Bool Source

(<=) :: U1 p -> U1 p -> Bool Source

(>) :: U1 p -> U1 p -> Bool Source

(>=) :: U1 p -> U1 p -> Bool Source

max :: U1 p -> U1 p -> U1 p Source

min :: U1 p -> U1 p -> U1 p Source

Ord p => Ord (Par1 p) 

Methods

compare :: Par1 p -> Par1 p -> Ordering Source

(<) :: Par1 p -> Par1 p -> Bool Source

(<=) :: Par1 p -> Par1 p -> Bool Source

(>) :: Par1 p -> Par1 p -> Bool Source

(>=) :: Par1 p -> Par1 p -> Bool Source

max :: Par1 p -> Par1 p -> Par1 p Source

min :: Par1 p -> Par1 p -> Par1 p Source

Ord a => Ord (Down a) 

Methods

compare :: Down a -> Down a -> Ordering Source

(<) :: Down a -> Down a -> Bool Source

(<=) :: Down a -> Down a -> Bool Source

(>) :: Down a -> Down a -> Bool Source

(>=) :: Down a -> Down a -> Bool Source

max :: Down a -> Down a -> Down a Source

min :: Down a -> Down a -> Down a Source

Ord a => Ord (Last a) 

Methods

compare :: Last a -> Last a -> Ordering Source

(<) :: Last a -> Last a -> Bool Source

(<=) :: Last a -> Last a -> Bool Source

(>) :: Last a -> Last a -> Bool Source

(>=) :: Last a -> Last a -> Bool Source

max :: Last a -> Last a -> Last a Source

min :: Last a -> Last a -> Last a Source

Ord a => Ord (First a) 

Methods

compare :: First a -> First a -> Ordering Source

(<) :: First a -> First a -> Bool Source

(<=) :: First a -> First a -> Bool Source

(>) :: First a -> First a -> Bool Source

(>=) :: First a -> First a -> Bool Source

max :: First a -> First a -> First a Source

min :: First a -> First a -> First a Source

Ord a => Ord (Product a) 
Ord a => Ord (Sum a) 

Methods

compare :: Sum a -> Sum a -> Ordering Source

(<) :: Sum a -> Sum a -> Bool Source

(<=) :: Sum a -> Sum a -> Bool Source

(>) :: Sum a -> Sum a -> Bool Source

(>=) :: Sum a -> Sum a -> Bool Source

max :: Sum a -> Sum a -> Sum a Source

min :: Sum a -> Sum a -> Sum a Source

Ord a => Ord (Dual a) 

Methods

compare :: Dual a -> Dual a -> Ordering Source

(<) :: Dual a -> Dual a -> Bool Source

(<=) :: Dual a -> Dual a -> Bool Source

(>) :: Dual a -> Dual a -> Bool Source

(>=) :: Dual a -> Dual a -> Bool Source

max :: Dual a -> Dual a -> Dual a Source

min :: Dual a -> Dual a -> Dual a Source

Ord (ForeignPtr a) 
Ord a => Ord (ZipList a) 
Ord (Fixed a) 

Methods

compare :: Fixed a -> Fixed a -> Ordering Source

(<) :: Fixed a -> Fixed a -> Bool Source

(<=) :: Fixed a -> Fixed a -> Bool Source

(>) :: Fixed a -> Fixed a -> Bool Source

(>=) :: Fixed a -> Fixed a -> Bool Source

max :: Fixed a -> Fixed a -> Fixed a Source

min :: Fixed a -> Fixed a -> Fixed a Source

Ord a => Ord (NonEmpty a) 
Ord a => Ord (Option a) 

Methods

compare :: Option a -> Option a -> Ordering Source

(<) :: Option a -> Option a -> Bool Source

(<=) :: Option a -> Option a -> Bool Source

(>) :: Option a -> Option a -> Bool Source

(>=) :: Option a -> Option a -> Bool Source

max :: Option a -> Option a -> Option a Source

min :: Option a -> Option a -> Option a Source

Ord m => Ord (WrappedMonoid m) 
Ord a => Ord (Last a) 

Methods

compare :: Last a -> Last a -> Ordering Source

(<) :: Last a -> Last a -> Bool Source

(<=) :: Last a -> Last a -> Bool Source

(>) :: Last a -> Last a -> Bool Source

(>=) :: Last a -> Last a -> Bool Source

max :: Last a -> Last a -> Last a Source

min :: Last a -> Last a -> Last a Source

Ord a => Ord (First a) 

Methods

compare :: First a -> First a -> Ordering Source

(<) :: First a -> First a -> Bool Source

(<=) :: First a -> First a -> Bool Source

(>) :: First a -> First a -> Bool Source

(>=) :: First a -> First a -> Bool Source

max :: First a -> First a -> First a Source

min :: First a -> First a -> First a Source

Ord a => Ord (Max a) 

Methods

compare :: Max a -> Max a -> Ordering Source

(<) :: Max a -> Max a -> Bool Source

(<=) :: Max a -> Max a -> Bool Source

(>) :: Max a -> Max a -> Bool Source

(>=) :: Max a -> Max a -> Bool Source

max :: Max a -> Max a -> Max a Source

min :: Max a -> Max a -> Max a Source

Ord a => Ord (Min a) 

Methods

compare :: Min a -> Min a -> Ordering Source

(<) :: Min a -> Min a -> Bool Source

(<=) :: Min a -> Min a -> Bool Source

(>) :: Min a -> Min a -> Bool Source

(>=) :: Min a -> Min a -> Bool Source

max :: Min a -> Min a -> Min a Source

min :: Min a -> Min a -> Min a Source

Ord a => Ord (Identity a) 
(Ord a, Ord b) => Ord (Either a b) 

Methods

compare :: Either a b -> Either a b -> Ordering Source

(<) :: Either a b -> Either a b -> Bool Source

(<=) :: Either a b -> Either a b -> Bool Source

(>) :: Either a b -> Either a b -> Bool Source

(>=) :: Either a b -> Either a b -> Bool Source

max :: Either a b -> Either a b -> Either a b Source

min :: Either a b -> Either a b -> Either a b Source

Ord (f p) => Ord (Rec1 f p) 

Methods

compare :: Rec1 f p -> Rec1 f p -> Ordering Source

(<) :: Rec1 f p -> Rec1 f p -> Bool Source

(<=) :: Rec1 f p -> Rec1 f p -> Bool Source

(>) :: Rec1 f p -> Rec1 f p -> Bool Source

(>=) :: Rec1 f p -> Rec1 f p -> Bool Source

max :: Rec1 f p -> Rec1 f p -> Rec1 f p Source

min :: Rec1 f p -> Rec1 f p -> Rec1 f p Source

Ord (URec Char p) 
Ord (URec Double p) 
Ord (URec Float p) 
Ord (URec Int p) 

Methods

compare :: URec Int p -> URec Int p -> Ordering Source

(<) :: URec Int p -> URec Int p -> Bool Source

(<=) :: URec Int p -> URec Int p -> Bool Source

(>) :: URec Int p -> URec Int p -> Bool Source

(>=) :: URec Int p -> URec Int p -> Bool Source

max :: URec Int p -> URec Int p -> URec Int p Source

min :: URec Int p -> URec Int p -> URec Int p Source

Ord (URec Word p) 
Ord (URec (Ptr ()) p) 

Methods

compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering Source

(<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source

(<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source

(>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source

(>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool Source

max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p Source

min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p Source

(Ord a, Ord b) => Ord (a, b) 

Methods

compare :: (a, b) -> (a, b) -> Ordering Source

(<) :: (a, b) -> (a, b) -> Bool Source

(<=) :: (a, b) -> (a, b) -> Bool Source

(>) :: (a, b) -> (a, b) -> Bool Source

(>=) :: (a, b) -> (a, b) -> Bool Source

max :: (a, b) -> (a, b) -> (a, b) Source

min :: (a, b) -> (a, b) -> (a, b) Source

Ord (Proxy k s) 

Methods

compare :: Proxy k s -> Proxy k s -> Ordering Source

(<) :: Proxy k s -> Proxy k s -> Bool Source

(<=) :: Proxy k s -> Proxy k s -> Bool Source

(>) :: Proxy k s -> Proxy k s -> Bool Source

(>=) :: Proxy k s -> Proxy k s -> Bool Source

max :: Proxy k s -> Proxy k s -> Proxy k s Source

min :: Proxy k s -> Proxy k s -> Proxy k s Source

Ord a => Ord (Arg a b) 

Methods

compare :: Arg a b -> Arg a b -> Ordering Source

(<) :: Arg a b -> Arg a b -> Bool Source

(<=) :: Arg a b -> Arg a b -> Bool Source

(>) :: Arg a b -> Arg a b -> Bool Source

(>=) :: Arg a b -> Arg a b -> Bool Source

max :: Arg a b -> Arg a b -> Arg a b Source

min :: Arg a b -> Arg a b -> Arg a b Source

Ord c => Ord (K1 i c p) 

Methods

compare :: K1 i c p -> K1 i c p -> Ordering Source

(<) :: K1 i c p -> K1 i c p -> Bool Source

(<=) :: K1 i c p -> K1 i c p -> Bool Source

(>) :: K1 i c p -> K1 i c p -> Bool Source

(>=) :: K1 i c p -> K1 i c p -> Bool Source

max :: K1 i c p -> K1 i c p -> K1 i c p Source

min :: K1 i c p -> K1 i c p -> K1 i c p Source

(Ord (f p), Ord (g p)) => Ord ((:+:) f g p) 

Methods

compare :: (f :+: g) p -> (f :+: g) p -> Ordering Source

(<) :: (f :+: g) p -> (f :+: g) p -> Bool Source

(<=) :: (f :+: g) p -> (f :+: g) p -> Bool Source

(>) :: (f :+: g) p -> (f :+: g) p -> Bool Source

(>=) :: (f :+: g) p -> (f :+: g) p -> Bool Source

max :: (f :+: g) p -> (f :+: g) p -> (f :+: g) p Source

min :: (f :+: g) p -> (f :+: g) p -> (f :+: g) p Source

(Ord (f p), Ord (g p)) => Ord ((:*:) f g p) 

Methods

compare :: (f :*: g) p -> (f :*: g) p -> Ordering Source

(<) :: (f :*: g) p -> (f :*: g) p -> Bool Source

(<=) :: (f :*: g) p -> (f :*: g) p -> Bool Source

(>) :: (f :*: g) p -> (f :*: g) p -> Bool Source

(>=) :: (f :*: g) p -> (f :*: g) p -> Bool Source

max :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p Source

min :: (f :*: g) p -> (f :*: g) p -> (f :*: g) p Source

Ord (f (g p)) => Ord ((:.:) f g p) 

Methods

compare :: (f :.: g) p -> (f :.: g) p -> Ordering Source

(<) :: (f :.: g) p -> (f :.: g) p -> Bool Source

(<=) :: (f :.: g) p -> (f :.: g) p -> Bool Source

(>) :: (f :.: g) p -> (f :.: g) p -> Bool Source

(>=) :: (f :.: g) p -> (f :.: g) p -> Bool Source

max :: (f :.: g) p -> (f :.: g) p -> (f :.: g) p Source

min :: (f :.: g) p -> (f :.: g) p -> (f :.: g) p Source

(Ord a, Ord b, Ord c) => Ord (a, b, c) 

Methods

compare :: (a, b, c) -> (a, b, c) -> Ordering Source

(<) :: (a, b, c) -> (a, b, c) -> Bool Source

(<=) :: (a, b, c) -> (a, b, c) -> Bool Source

(>) :: (a, b, c) -> (a, b, c) -> Bool Source

(>=) :: (a, b, c) -> (a, b, c) -> Bool Source

max :: (a, b, c) -> (a, b, c) -> (a, b, c) Source

min :: (a, b, c) -> (a, b, c) -> (a, b, c) Source

Ord ((:~:) k a b) 

Methods

compare :: (k :~: a) b -> (k :~: a) b -> Ordering Source

(<) :: (k :~: a) b -> (k :~: a) b -> Bool Source

(<=) :: (k :~: a) b -> (k :~: a) b -> Bool Source

(>) :: (k :~: a) b -> (k :~: a) b -> Bool Source

(>=) :: (k :~: a) b -> (k :~: a) b -> Bool Source

max :: (k :~: a) b -> (k :~: a) b -> (k :~: a) b Source

min :: (k :~: a) b -> (k :~: a) b -> (k :~: a) b Source

Ord (Coercion k a b) 

Methods

compare :: Coercion k a b -> Coercion k a b -> Ordering Source

(<) :: Coercion k a b -> Coercion k a b -> Bool Source

(<=) :: Coercion k a b -> Coercion k a b -> Bool Source

(>) :: Coercion k a b -> Coercion k a b -> Bool Source

(>=) :: Coercion k a b -> Coercion k a b -> Bool Source

max :: Coercion k a b -> Coercion k a b -> Coercion k a b Source

min :: Coercion k a b -> Coercion k a b -> Coercion k a b Source

Ord (f a) => Ord (Alt k f a) 

Methods

compare :: Alt k f a -> Alt k f a -> Ordering Source

(<) :: Alt k f a -> Alt k f a -> Bool Source

(<=) :: Alt k f a -> Alt k f a -> Bool Source

(>) :: Alt k f a -> Alt k f a -> Bool Source

(>=) :: Alt k f a -> Alt k f a -> Bool Source

max :: Alt k f a -> Alt k f a -> Alt k f a Source

min :: Alt k f a -> Alt k f a -> Alt k f a Source

Ord a => Ord (Const k a b) 

Methods

compare :: Const k a b -> Const k a b -> Ordering Source

(<) :: Const k a b -> Const k a b -> Bool Source

(<=) :: Const k a b -> Const k a b -> Bool Source

(>) :: Const k a b -> Const k a b -> Bool Source

(>=) :: Const k a b -> Const k a b -> Bool Source

max :: Const k a b -> Const k a b -> Const k a b Source

min :: Const k a b -> Const k a b -> Const k a b Source

Ord (f p) => Ord (M1 i c f p) 

Methods

compare :: M1 i c f p -> M1 i c f p -> Ordering Source

(<) :: M1 i c f p -> M1 i c f p -> Bool Source

(<=) :: M1 i c f p -> M1 i c f p -> Bool Source

(>) :: M1 i c f p -> M1 i c f p -> Bool Source

(>=) :: M1 i c f p -> M1 i c f p -> Bool Source

max :: M1 i c f p -> M1 i c f p -> M1 i c f p Source

min :: M1 i c f p -> M1 i c f p -> M1 i c f p Source

(Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) 

Methods

compare :: (a, b, c, d) -> (a, b, c, d) -> Ordering Source

(<) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source

(<=) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source

(>) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source

(>=) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source

max :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source

min :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source

(Ord1 f, Ord1 g, Ord a) => Ord (Product (TYPE Lifted) f g a) 

Methods

compare :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Ordering Source

(<) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Bool Source

(<=) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Bool Source

(>) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Bool Source

(>=) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Bool Source

max :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a Source

min :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g a Source

(Ord1 f, Ord1 g, Ord a) => Ord (Sum (TYPE Lifted) f g a) 

Methods

compare :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Ordering Source

(<) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(<=) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(>) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

(>=) :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Bool Source

max :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a Source

min :: Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g a Source

(Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) 

Methods

compare :: (a, b, c, d, e) -> (a, b, c, d, e) -> Ordering Source

(<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source

(<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source

(>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source

(>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source

max :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source

min :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source

(Ord1 f, Ord1 g, Ord a) => Ord (Compose (TYPE Lifted) (TYPE Lifted) f g a) 
(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) 

Methods

compare :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Ordering Source

(<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source

(<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source

(>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source

(>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source

max :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source

min :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source

(Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) 

Methods

compare :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Ordering Source

(<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source

(<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source

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

(>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source

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

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

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

Methods

compare :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Ordering Source

(<) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source

(<=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source

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

(>=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source

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

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

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

Methods

compare :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Ordering Source

(<) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source

(<=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source

(>) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source

(>=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source

max :: (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) Source

min :: (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) Source

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

Methods

compare :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Ordering Source

(<) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source

(<=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source

(>) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source

(>=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source

max :: (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) Source

min :: (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) Source

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

Methods

compare :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Ordering Source

(<) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source

(<=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source

(>) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source

(>=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source

max :: (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) Source

min :: (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) Source

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

Methods

compare :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Ordering Source

(<) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source

(<=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source

(>) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source

(>=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source

max :: (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) Source

min :: (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) Source

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

Methods

compare :: (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) -> Ordering Source

(<) :: (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) -> Bool Source

(<=) :: (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) -> Bool Source

(>) :: (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) -> Bool Source

(>=) :: (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) -> Bool Source

max :: (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) Source

min :: (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) Source

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

Methods

compare :: (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) -> Ordering Source

(<) :: (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) -> Bool Source

(<=) :: (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) -> Bool Source

(>) :: (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) -> Bool Source

(>=) :: (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) -> Bool Source

max :: (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) Source

min :: (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) Source

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

Methods

compare :: (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) -> Ordering Source

(<) :: (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) -> Bool Source

(<=) :: (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) -> Bool Source

(>) :: (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) -> Bool Source

(>=) :: (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) -> Bool Source

max :: (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) Source

min :: (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) Source

class Enum a where Source

Class Enum defines operations on sequentially ordered types.

The enumFrom... methods are used in Haskell's translation of arithmetic sequences.

Instances of Enum may be derived for any enumeration type (types whose constructors have no fields). The nullary constructors are assumed to be numbered left-to-right by fromEnum from 0 through n-1. See Chapter 10 of the Haskell Report for more details.

For any type that is an instance of class Bounded as well as Enum, the following should hold:

   enumFrom     x   = enumFromTo     x maxBound
   enumFromThen x y = enumFromThenTo x y bound
     where
       bound | fromEnum y >= fromEnum x = maxBound
             | otherwise                = minBound

Minimal complete definition

toEnum, fromEnum

Methods

succ :: a -> a Source

the successor of a value. For numeric types, succ adds 1.

pred :: a -> a Source

the predecessor of a value. For numeric types, pred subtracts 1.

toEnum :: Int -> a Source

Convert from an Int.

fromEnum :: a -> Int Source

Convert to an Int. It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int.

enumFrom :: a -> [a] Source

Used in Haskell's translation of [n..].

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

Used in Haskell's translation of [n,n'..].

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

Used in Haskell's translation of [n..m].

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

Used in Haskell's translation of [n,n'..m].

Instances

Enum Bool 
Enum Char 
Enum Int 
Enum Int8 
Enum Int16 
Enum Int32 
Enum Int64 
Enum Integer 
Enum Ordering 
Enum Word 
Enum Word8 
Enum Word16 
Enum Word32 
Enum Word64 
Enum () 

Methods

succ :: () -> () Source

pred :: () -> () Source

toEnum :: Int -> () Source

fromEnum :: () -> Int Source

enumFrom :: () -> [()] Source

enumFromThen :: () -> () -> [()] Source

enumFromTo :: () -> () -> [()] Source

enumFromThenTo :: () -> () -> () -> [()] Source

Enum GeneralCategory 
Enum IOMode 
Enum CUIntMax 
Enum CIntMax 
Enum CUIntPtr 
Enum CIntPtr 
Enum CSUSeconds 
Enum CUSeconds 
Enum CTime 
Enum CClock 
Enum CSigAtomic 
Enum CWchar 
Enum CSize 
Enum CPtrdiff 
Enum CDouble 
Enum CFloat 
Enum CULLong 
Enum CLLong 
Enum CULong 
Enum CLong 
Enum CUInt 
Enum CInt 
Enum CUShort 
Enum CShort 
Enum CUChar 
Enum CSChar 
Enum CChar 
Enum IntPtr 
Enum WordPtr 
Enum SeekMode 
Enum Fd 
Enum CRLim 
Enum CTcflag 
Enum CSpeed 
Enum CCc 
Enum CUid 
Enum CNlink 
Enum CGid 
Enum CSsize 
Enum CPid 
Enum COff 
Enum CMode 
Enum CIno 
Enum CDev 
Enum Natural 
Enum DoTrace 
Enum DoHeapProfile 
Enum DoCostCentres 
Enum GiveGCStats 
Integral a => Enum (Ratio a) 
Enum (Fixed a) 
Enum a => Enum (WrappedMonoid a) 
Enum a => Enum (Last a) 

Methods

succ :: Last a -> Last a Source

pred :: Last a -> Last a Source

toEnum :: Int -> Last a Source

fromEnum :: Last a -> Int Source

enumFrom :: Last a -> [Last a] Source

enumFromThen :: Last a -> Last a -> [Last a] Source

enumFromTo :: Last a -> Last a -> [Last a] Source

enumFromThenTo :: Last a -> Last a -> Last a -> [Last a] Source

Enum a => Enum (First a) 
Enum a => Enum (Max a) 

Methods

succ :: Max a -> Max a Source

pred :: Max a -> Max a Source

toEnum :: Int -> Max a Source

fromEnum :: Max a -> Int Source

enumFrom :: Max a -> [Max a] Source

enumFromThen :: Max a -> Max a -> [Max a] Source

enumFromTo :: Max a -> Max a -> [Max a] Source

enumFromThenTo :: Max a -> Max a -> Max a -> [Max a] Source

Enum a => Enum (Min a) 

Methods

succ :: Min a -> Min a Source

pred :: Min a -> Min a Source

toEnum :: Int -> Min a Source

fromEnum :: Min a -> Int Source

enumFrom :: Min a -> [Min a] Source

enumFromThen :: Min a -> Min a -> [Min a] Source

enumFromTo :: Min a -> Min a -> [Min a] Source

enumFromThenTo :: Min a -> Min a -> Min a -> [Min a] Source

Enum a => Enum (Identity a) 
Enum (Proxy k s) 

Methods

succ :: Proxy k s -> Proxy k s Source

pred :: Proxy k s -> Proxy k s Source

toEnum :: Int -> Proxy k s Source

fromEnum :: Proxy k s -> Int Source

enumFrom :: Proxy k s -> [Proxy k s] Source

enumFromThen :: Proxy k s -> Proxy k s -> [Proxy k s] Source

enumFromTo :: Proxy k s -> Proxy k s -> [Proxy k s] Source

enumFromThenTo :: Proxy k s -> Proxy k s -> Proxy k s -> [Proxy k s] Source

(~) k a b => Enum ((:~:) k a b) 

Methods

succ :: (k :~: a) b -> (k :~: a) b Source

pred :: (k :~: a) b -> (k :~: a) b Source

toEnum :: Int -> (k :~: a) b Source

fromEnum :: (k :~: a) b -> Int Source

enumFrom :: (k :~: a) b -> [(k :~: a) b] Source

enumFromThen :: (k :~: a) b -> (k :~: a) b -> [(k :~: a) b] Source

enumFromTo :: (k :~: a) b -> (k :~: a) b -> [(k :~: a) b] Source

enumFromThenTo :: (k :~: a) b -> (k :~: a) b -> (k :~: a) b -> [(k :~: a) b] Source

Coercible k a b => Enum (Coercion k a b) 

Methods

succ :: Coercion k a b -> Coercion k a b Source

pred :: Coercion k a b -> Coercion k a b Source

toEnum :: Int -> Coercion k a b Source

fromEnum :: Coercion k a b -> Int Source

enumFrom :: Coercion k a b -> [Coercion k a b] Source

enumFromThen :: Coercion k a b -> Coercion k a b -> [Coercion k a b] Source

enumFromTo :: Coercion k a b -> Coercion k a b -> [Coercion k a b] Source

enumFromThenTo :: Coercion k a b -> Coercion k a b -> Coercion k a b -> [Coercion k a b] Source

Enum (f a) => Enum (Alt k f a) 

Methods

succ :: Alt k f a -> Alt k f a Source

pred :: Alt k f a -> Alt k f a Source

toEnum :: Int -> Alt k f a Source

fromEnum :: Alt k f a -> Int Source

enumFrom :: Alt k f a -> [Alt k f a] Source

enumFromThen :: Alt k f a -> Alt k f a -> [Alt k f a] Source

enumFromTo :: Alt k f a -> Alt k f a -> [Alt k f a] Source

enumFromThenTo :: Alt k f a -> Alt k f a -> Alt k f a -> [Alt k f a] Source

Enum a => Enum (Const k a b) 

Methods

succ :: Const k a b -> Const k a b Source

pred :: Const k a b -> Const k a b Source

toEnum :: Int -> Const k a b Source

fromEnum :: Const k a b -> Int Source

enumFrom :: Const k a b -> [Const k a b] Source

enumFromThen :: Const k a b -> Const k a b -> [Const k a b] Source

enumFromTo :: Const k a b -> Const k a b -> [Const k a b] Source

enumFromThenTo :: Const k a b -> Const k a b -> Const k a b -> [Const k a b] Source

class Bounded a where Source

The Bounded class is used to name the upper and lower limits of a type. Ord is not a superclass of Bounded since types that are not totally ordered may also have upper and lower bounds.

The Bounded class may be derived for any enumeration type; minBound is the first constructor listed in the data declaration and maxBound is the last. Bounded may also be derived for single-constructor datatypes whose constituent types are in Bounded.

Minimal complete definition

minBound, maxBound

Methods

minBound, maxBound :: a Source

Instances

Bounded Bool 
Bounded Char 
Bounded Int 
Bounded Int8 
Bounded Int16 
Bounded Int32 
Bounded Int64 
Bounded Ordering 
Bounded Word 
Bounded Word8 
Bounded Word16 
Bounded Word32 
Bounded Word64 
Bounded () 

Methods

minBound :: () Source

maxBound :: () Source

Bounded GeneralCategory 
Bounded Any 
Bounded All 
Bounded CUIntMax 
Bounded CIntMax 
Bounded CUIntPtr 
Bounded CIntPtr 
Bounded CSigAtomic 
Bounded CWchar 
Bounded CSize 
Bounded CPtrdiff 
Bounded CULLong 
Bounded CLLong 
Bounded CULong 
Bounded CLong 
Bounded CUInt 
Bounded CInt 
Bounded CUShort 
Bounded CShort 
Bounded CUChar 
Bounded CSChar 
Bounded CChar 
Bounded IntPtr 
Bounded WordPtr 
Bounded Fd 
Bounded CRLim 
Bounded CTcflag 
Bounded CUid 
Bounded CNlink 
Bounded CGid 
Bounded CSsize 
Bounded CPid 
Bounded COff 
Bounded CMode 
Bounded CIno 
Bounded CDev 
Bounded a => Bounded (Product a) 
Bounded a => Bounded (Sum a) 
Bounded a => Bounded (Dual a) 
Bounded a => Bounded (WrappedMonoid a) 
Bounded a => Bounded (Last a) 
Bounded a => Bounded (First a) 
Bounded a => Bounded (Max a) 
Bounded a => Bounded (Min a) 
Bounded a => Bounded (Identity a) 
(Bounded a, Bounded b) => Bounded (a, b) 

Methods

minBound :: (a, b) Source

maxBound :: (a, b) Source

Bounded (Proxy k s) 
(Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) 

Methods

minBound :: (a, b, c) Source

maxBound :: (a, b, c) Source

(~) k a b => Bounded ((:~:) k a b) 

Methods

minBound :: (k :~: a) b Source

maxBound :: (k :~: a) b Source

Coercible k a b => Bounded (Coercion k a b) 
Bounded a => Bounded (Const k a b) 

Methods

minBound :: Const k a b Source

maxBound :: Const k a b Source

(Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) 

Methods

minBound :: (a, b, c, d) Source

maxBound :: (a, b, c, d) Source

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e) 

Methods

minBound :: (a, b, c, d, e) Source

maxBound :: (a, b, c, d, e) Source

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f) 

Methods

minBound :: (a, b, c, d, e, f) Source

maxBound :: (a, b, c, d, e, f) Source

(Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g) 

Methods

minBound :: (a, b, c, d, e, f, g) Source

maxBound :: (a, b, c, d, e, f, g) Source

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

Methods

minBound :: (a, b, c, d, e, f, g, h) Source

maxBound :: (a, b, c, d, e, f, g, h) Source

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

Methods

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

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

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

Methods

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

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

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

Methods

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

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

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

Methods

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

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

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

Methods

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

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

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

Methods

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

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

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

Methods

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

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

Numbers

Numeric types

data Int :: TYPE Lifted Source

A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]. The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class.

Instances

Bounded Int 
Enum Int 
Eq Int 

Methods

(==) :: Int -> Int -> Bool Source

(/=) :: Int -> Int -> Bool Source

Integral Int 

Methods

quot :: Int -> Int -> Int Source

rem :: Int -> Int -> Int Source

div :: Int -> Int -> Int Source

mod :: Int -> Int -> Int Source

quotRem :: Int -> Int -> (Int, Int) Source

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

toInteger :: Int -> Integer Source

Data Int 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int -> c Int Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int Source

toConstr :: Int -> Constr Source

dataTypeOf :: Int -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Int) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int) Source

gmapT :: (forall b. Data b => b -> b) -> Int -> Int Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Int -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Int -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int -> m Int Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m Int Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int -> m Int Source

Num Int 
Ord Int 

Methods

compare :: Int -> Int -> Ordering Source

(<) :: Int -> Int -> Bool Source

(<=) :: Int -> Int -> Bool Source

(>) :: Int -> Int -> Bool Source

(>=) :: Int -> Int -> Bool Source

max :: Int -> Int -> Int Source

min :: Int -> Int -> Int Source

Read Int 
Real Int 
Show Int 
Ix Int 

Methods

range :: (Int, Int) -> [Int] Source

index :: (Int, Int) -> Int -> Int Source

unsafeIndex :: (Int, Int) -> Int -> Int

inRange :: (Int, Int) -> Int -> Bool Source

rangeSize :: (Int, Int) -> Int Source

unsafeRangeSize :: (Int, Int) -> Int

FiniteBits Int 
Bits Int 
Storable Int 
PrintfArg Int 
Eq (URec Int p) 

Methods

(==) :: URec Int p -> URec Int p -> Bool Source

(/=) :: URec Int p -> URec Int p -> Bool Source

Ord (URec Int p) 

Methods

compare :: URec Int p -> URec Int p -> Ordering Source

(<) :: URec Int p -> URec Int p -> Bool Source

(<=) :: URec Int p -> URec Int p -> Bool Source

(>) :: URec Int p -> URec Int p -> Bool Source

(>=) :: URec Int p -> URec Int p -> Bool Source

max :: URec Int p -> URec Int p -> URec Int p Source

min :: URec Int p -> URec Int p -> URec Int p Source

Show (URec Int p) 
Generic (URec Int p) 

Associated Types

type Rep (URec Int p) :: * -> * Source

Methods

from :: URec Int p -> Rep (URec Int p) x Source

to :: Rep (URec Int p) x -> URec Int p Source

data URec Int = UInt {}

Used for marking occurrences of Int#

type Rep (URec Int p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UInt" PrefixI True) (S1 (MetaSel (Just Symbol "uInt#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UInt)) 

data Integer :: TYPE Lifted Source

Invariant: Jn# and Jp# are used iff value doesn't fit in S#

Useful properties resulting from the invariants:

Instances

Enum Integer 
Eq Integer 
Integral Integer 
Data Integer 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Integer -> c Integer Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Integer Source

toConstr :: Integer -> Constr Source

dataTypeOf :: Integer -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Integer) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Integer) Source

gmapT :: (forall b. Data b => b -> b) -> Integer -> Integer Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Integer -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Integer -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Integer -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Integer -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Integer -> m Integer Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Integer -> m Integer Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Integer -> m Integer Source

Num Integer 
Ord Integer 
Read Integer 
Real Integer 
Show Integer 
Ix Integer 
Bits Integer 
PrintfArg Integer 

data Float :: TYPE Lifted Source

Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.

Instances

Eq Float 

Methods

(==) :: Float -> Float -> Bool Source

(/=) :: Float -> Float -> Bool Source

Floating Float 
Data Float 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Float -> c Float Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Float Source

toConstr :: Float -> Constr Source

dataTypeOf :: Float -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Float) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Float) Source

gmapT :: (forall b. Data b => b -> b) -> Float -> Float Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Float -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Float -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Float -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Float -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Float -> m Float Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Float -> m Float Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Float -> m Float Source

Ord Float 
Read Float 
RealFloat Float 
Storable Float 
PrintfArg Float 
Eq (URec Float p) 

Methods

(==) :: URec Float p -> URec Float p -> Bool Source

(/=) :: URec Float p -> URec Float p -> Bool Source

Ord (URec Float p) 
Show (URec Float p) 
Generic (URec Float p) 

Associated Types

type Rep (URec Float p) :: * -> * Source

Methods

from :: URec Float p -> Rep (URec Float p) x Source

to :: Rep (URec Float p) x -> URec Float p Source

data URec Float = UFloat {}

Used for marking occurrences of Float#

type Rep (URec Float p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UFloat" PrefixI True) (S1 (MetaSel (Just Symbol "uFloat#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UFloat)) 

data Double :: TYPE Lifted Source

Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.

Instances

Eq Double 
Floating Double 
Data Double 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Double -> c Double Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Double Source

toConstr :: Double -> Constr Source

dataTypeOf :: Double -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Double) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Double) Source

gmapT :: (forall b. Data b => b -> b) -> Double -> Double Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Double -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Double -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Double -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Double -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Double -> m Double Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Double -> m Double Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Double -> m Double Source

Ord Double 
Read Double 
RealFloat Double 
Storable Double 
PrintfArg Double 
Eq (URec Double p) 
Ord (URec Double p) 
Show (URec Double p) 
Generic (URec Double p) 

Associated Types

type Rep (URec Double p) :: * -> * Source

Methods

from :: URec Double p -> Rep (URec Double p) x Source

to :: Rep (URec Double p) x -> URec Double p Source

data URec Double = UDouble {}

Used for marking occurrences of Double#

type Rep (URec Double p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UDouble" PrefixI True) (S1 (MetaSel (Just Symbol "uDouble#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UDouble)) 

type Rational = Ratio Integer Source

Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.

data Word :: TYPE Lifted Source

A Word is an unsigned integral type, with the same size as Int.

Instances

Bounded Word 
Enum Word 
Eq Word 

Methods

(==) :: Word -> Word -> Bool Source

(/=) :: Word -> Word -> Bool Source

Integral Word 
Data Word 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word -> c Word Source

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word Source

toConstr :: Word -> Constr Source

dataTypeOf :: Word -> DataType Source

dataCast1 :: Typeable (TYPE Lifted -> TYPE Lifted) t => (forall d. Data d => c (t d)) -> Maybe (c Word) Source

dataCast2 :: Typeable (TYPE Lifted -> TYPE Lifted -> TYPE Lifted) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word) Source

gmapT :: (forall b. Data b => b -> b) -> Word -> Word Source

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r Source

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r Source

gmapQ :: (forall d. Data d => d -> u) -> Word -> [u] Source

gmapQi :: Int -> (forall d. Data d => d -> u) -> Word -> u Source

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word -> m Word Source

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word Source

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word Source

Num Word 
Ord Word 
Read Word 
Real Word 
Show Word 
Ix Word 
FiniteBits Word 
Bits Word 
Storable Word 
PrintfArg Word 
Eq (URec Word p) 

Methods

(==) :: URec Word p -> URec Word p -> Bool Source

(/=) :: URec Word p -> URec Word p -> Bool Source

Ord (URec Word p) 
Show (URec Word p) 
Generic (URec Word p) 

Associated Types

type Rep (URec Word p) :: * -> * Source

Methods

from :: URec Word p -> Rep (URec Word p) x Source

to :: Rep (URec Word p) x -> URec Word p Source

data URec Word = UWord {}

Used for marking occurrences of Word#

type Rep (URec Word p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UWord" PrefixI True) (S1 (MetaSel (Just Symbol "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) UWord)) 

Numeric type classes

class Num a where Source

Basic numeric class.

Minimal complete definition

(+), (*), abs, signum, fromInteger, (negate | (-))

Methods

(+), (-), (*) :: a -> a -> a infixl 7 *infixl 6 +, - Source

negate :: a -> a Source

Unary negation.

abs :: a -> a Source

Absolute value.

signum :: a -> a Source

Sign of a number. The functions abs and signum should satisfy the law:

abs x * signum x == x

For real numbers, the signum is either -1 (negative), 0 (zero) or 1 (positive).

fromInteger :: Integer -> a Source

Conversion from an Integer. An integer literal represents the application of the function fromInteger to the appropriate value of type Integer, so such literals have type (Num a) => a.

Instances

Num Int 
Num Int8 
Num Int16 
Num Int32 
Num Int64 
Num Integer 
Num Word 
Num Word8 
Num Word16 
Num Word32 
Num Word64 
Num CUIntMax 
Num CIntMax 
Num CUIntPtr 
Num CIntPtr 
Num CSUSeconds 
Num CUSeconds 
Num CTime 
Num CClock 
Num CSigAtomic 
Num CWchar 
Num CSize 
Num CPtrdiff 
Num CDouble 
Num CFloat 
Num CULLong 
Num CLLong 
Num CULong 
Num CLong 
Num CUInt 
Num CInt 
Num CUShort 
Num CShort 
Num CUChar 
Num CSChar 
Num CChar 
Num IntPtr 
Num WordPtr 
Num Fd 

Methods

(+) :: Fd -> Fd -> Fd Source

(-) :: Fd -> Fd -> Fd Source

(*) :: Fd -> Fd -> Fd Source

negate :: Fd -> Fd Source

abs :: Fd -> Fd Source

signum :: Fd -> Fd Source

fromInteger :: Integer -> Fd Source

Num CRLim 
Num CTcflag 
Num CSpeed 
Num CCc 
Num CUid 
Num CNlink 
Num CGid 
Num CSsize 
Num CPid 
Num COff 
Num CMode 
Num CIno 
Num CDev 
Num Natural 
Integral a => Num (Ratio a) 

Methods

(+) :: Ratio a -> Ratio a -> Ratio a Source

(-) :: Ratio a -> Ratio a -> Ratio a Source

(*) :: Ratio a -> Ratio a -> Ratio a Source

negate :: Ratio a -> Ratio a Source

abs :: Ratio a -> Ratio a Source

signum :: Ratio a -> Ratio a Source

fromInteger :: Integer -> Ratio a Source

Num a => Num (Product a) 
Num a => Num (Sum a) 

Methods

(+) :: Sum a -> Sum a -> Sum a Source

(-) :: Sum a -> Sum a -> Sum a Source

(*) :: Sum a -> Sum a -> Sum a Source

negate :: Sum a -> Sum a Source

abs :: Sum a -> Sum a Source

signum :: Sum a -> Sum a Source

fromInteger :: Integer -> Sum a Source

RealFloat a => Num (Complex a) 
HasResolution a => Num (Fixed a) 

Methods

(+) :: Fixed a -> Fixed a -> Fixed a Source

(-) :: Fixed a -> Fixed a -> Fixed a Source

(*) :: Fixed a -> Fixed a -> Fixed a Source

negate :: Fixed a -> Fixed a Source

abs :: Fixed a -> Fixed a Source

signum :: Fixed a -> Fixed a Source

fromInteger :: Integer -> Fixed a Source

Num a => Num (Max a) 

Methods

(+) :: Max a -> Max a -> Max a Source

(-) :: Max a -> Max a -> Max a Source

(*) :: Max a -> Max a -> Max a Source

negate :: Max a -> Max a Source

abs :: Max a -> Max a Source

signum :: Max a -> Max a Source

fromInteger :: Integer -> Max a Source

Num a => Num (Min a) 

Methods

(+) :: Min a -> Min a -> Min a Source

(-) :: Min a -> Min a -> Min a Source

(*) :: Min a -> Min a -> Min a Source

negate :: Min a -> Min a Source

abs :: Min a -> Min a Source

signum :: Min a -> Min a Source

fromInteger :: Integer -> Min a Source

Num (f a) => Num (Alt k f a) 

Methods

(+) :: Alt k f a -> Alt k f a -> Alt k f a Source

(-) :: Alt k f a -> Alt k f a -> Alt k f a Source

(*) :: Alt k f a -> Alt k f a -> Alt k f a Source

negate :: Alt k f a -> Alt k f a Source

abs :: Alt k f a -> Alt k f a Source

signum :: Alt k f a -> Alt k f a Source

fromInteger :: Integer -> Alt k f a Source

class (Num a, Ord a) => Real a where Source

Minimal complete definition

toRational

Methods

toRational :: a -> Rational Source

the rational equivalent of its real argument with full precision

Instances

Real Int 
Real Int8 
Real Int16 
Real Int32 
Real Int64 
Real Integer 
Real Word 
Real Word8 
Real Word16 
Real Word32 
Real Word64 
Real CUIntMax 
Real CIntMax 
Real CUIntPtr 
Real CIntPtr 
Real CSUSeconds 
Real CUSeconds 
Real CTime 
Real CClock 
Real CSigAtomic 
Real CWchar 
Real CSize 
Real CPtrdiff 
Real CDouble 
Real CFloat 
Real CULLong 
Real CLLong 
Real CULong 
Real CLong 
Real CUInt 
Real CInt 
Real CUShort 
Real CShort 
Real CUChar 
Real CSChar 
Real CChar 
Real IntPtr 
Real WordPtr 
Real Fd 
Real CRLim 
Real CTcflag 
Real CSpeed 
Real CCc 
Real CUid 
Real CNlink 
Real CGid 
Real CSsize 
Real CPid 
Real COff 
Real CMode 
Real CIno 
Real CDev 
Real Natural 
Integral a => Real (Ratio a) 
HasResolution a => Real (Fixed a) 

class (Real a, Enum a) => Integral a where Source

Integral numbers, supporting integer division.

Minimal complete definition

quotRem, toInteger

Methods

quot :: a -> a -> a infixl 7 Source

integer division truncated toward zero

rem :: a -> a -> a infixl 7 Source

integer remainder, satisfying

(x `quot` y)*y + (x `rem` y) == x

div :: a -> a -> a infixl 7 Source

integer division truncated toward negative infinity

mod :: a -> a -> a infixl 7 Source

integer modulus, satisfying

(x `div` y)*y + (x `mod` y) == x

quotRem :: a -> a -> (a, a) Source

simultaneous quot and rem

divMod :: a -> a -> (a, a) Source

simultaneous div and mod

toInteger :: a -> Integer Source

conversion to Integer

Instances

Integral Int 

Methods

quot :: Int -> Int -> Int Source

rem :: Int -> Int -> Int Source

div :: Int -> Int -> Int Source

mod :: Int -> Int -> Int Source

quotRem :: Int -> Int -> (Int, Int) Source

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

toInteger :: Int -> Integer Source

Integral Int8 
Integral Int16 
Integral Int32 
Integral Int64 
Integral Integer 
Integral Word 
Integral Word8 
Integral Word16 
Integral Word32 
Integral Word64 
Integral CUIntMax 
Integral CIntMax 
Integral CUIntPtr 
Integral CIntPtr 
Integral CSigAtomic 
Integral CWchar 
Integral CSize 
Integral CPtrdiff 
Integral CULLong 
Integral CLLong 
Integral CULong 
Integral CLong 
Integral CUInt 
Integral CInt 
Integral CUShort 
Integral CShort 
Integral CUChar 
Integral CSChar 
Integral CChar 
Integral IntPtr 
Integral WordPtr 
Integral Fd 

Methods

quot :: Fd -> Fd -> Fd Source

rem :: Fd -> Fd -> Fd Source

div :: Fd -> Fd -> Fd Source

mod :: Fd -> Fd -> Fd Source

quotRem :: Fd -> Fd -> (Fd, Fd) Source

divMod :: Fd -> Fd -> (Fd, Fd) Source

toInteger :: Fd -> Integer Source

Integral CRLim 
Integral CTcflag 
Integral CUid 
Integral CNlink 
Integral CGid 
Integral CSsize 
Integral CPid 
Integral COff 
Integral CMode 
Integral CIno 
Integral CDev 
Integral Natural 

class Num a => Fractional a where Source

Fractional numbers, supporting real division.

Minimal complete definition

fromRational, (recip | (/))

Methods

(/) :: a -> a -> a infixl 7 Source

fractional division

recip :: a -> a Source

reciprocal fraction

fromRational :: Rational -> a Source

Conversion from a Rational (that is Ratio Integer). A floating literal stands for an application of fromRational to a value of type Rational, so such literals have type (Fractional a) => a.

class Fractional a => Floating a where Source

Trigonometric and hyperbolic functions and related functions.

Minimal complete definition

pi, exp, log, sin, cos, asin, acos, atan, sinh, cosh, asinh, acosh, atanh

Methods

pi :: a Source

exp, log, sqrt :: a -> a Source

(**), logBase :: a -> a -> a infixr 8 Source

sin, cos, tan :: a -> a Source

asin, acos, atan :: a -> a Source

sinh, cosh, tanh :: a -> a Source

asinh, acosh, atanh :: a -> a Source

Instances

Floating Double 
Floating Float 
Floating CDouble 
Floating CFloat 
RealFloat a => Floating (Complex a) 

class (Real a, Fractional a) => RealFrac a where Source

Extracting components of fractions.

Minimal complete definition

properFraction

Methods

properFraction :: Integral b => a -> (b, a) Source

The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f, and:

  • n is an integral number with the same sign as x; and
  • f is a fraction with the same type and sign as x, and with absolute value less than 1.

The default definitions of the ceiling, floor, truncate and round functions are in terms of properFraction.

truncate :: Integral b => a -> b Source

truncate x returns the integer nearest x between zero and x

round :: Integral b => a -> b Source

round x returns the nearest integer to x; the even integer if x is equidistant between two integers

ceiling :: Integral b => a -> b Source

ceiling x returns the least integer not less than x

floor :: Integral b => a -> b Source

floor x returns the greatest integer not greater than x

class (RealFrac a, Floating a) => RealFloat a where Source

Efficient, machine-independent access to the components of a floating-point number.

Methods

floatRadix :: a -> Integer Source

a constant function, returning the radix of the representation (often 2)

floatDigits :: a -> Int Source

a constant function, returning the number of digits of floatRadix in the significand

floatRange :: a -> (Int, Int) Source

a constant function, returning the lowest and highest values the exponent may assume

decodeFloat :: a -> (Integer, Int) Source

The function decodeFloat applied to a real floating-point number returns the significand expressed as an Integer and an appropriately scaled exponent (an Int). If decodeFloat x yields (m,n), then x is equal in value to m*b^^n, where b is the floating-point radix, and furthermore, either m and n are both zero or else b^(d-1) <= abs m < b^d, where d is the value of floatDigits x. In particular, decodeFloat 0 = (0,0). If the type contains a negative zero, also decodeFloat (-0.0) = (0,0). The result of decodeFloat x is unspecified if either of isNaN x or isInfinite x is True.

encodeFloat :: Integer -> Int -> a Source

encodeFloat performs the inverse of decodeFloat in the sense that for finite x with the exception of -0.0, uncurry encodeFloat (decodeFloat x) = x. encodeFloat m n is one of the two closest representable floating-point numbers to m*b^^n (or ±Infinity if overflow occurs); usually the closer, but if m contains too many bits, the result may be rounded in the wrong direction.

exponent :: a -> Int Source

exponent corresponds to the second component of decodeFloat. exponent 0 = 0 and for finite nonzero x, exponent x = snd (decodeFloat x) + floatDigits x. If x is a finite floating-point number, it is equal in value to significand x * b ^^ exponent x, where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values.

significand :: a -> a Source

The first component of decodeFloat, scaled to lie in the open interval (-1,1), either 0.0 or of absolute value >= 1/b, where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values.

scaleFloat :: Int -> a -> a Source

multiplies a floating-point number by an integer power of the radix

isNaN :: a -> Bool Source

True if the argument is an IEEE "not-a-number" (NaN) value

isInfinite :: a -> Bool Source

True if the argument is an IEEE infinity or negative infinity

isDenormalized :: a -> Bool Source

True if the argument is too small to be represented in normalized format

isNegativeZero :: a -> Bool Source

True if the argument is an IEEE negative zero

isIEEE :: a -> Bool Source

True if the argument is an IEEE floating point number

atan2 :: a -> a -> a Source

a version of arctangent taking two real floating-point arguments. For real floating x and y, atan2 y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y). atan2 y x returns a value in the range [-pi, pi]. It follows the Common Lisp semantics for the origin when signed zeroes are supported. atan2 y 1, with y in a type that is RealFloat, should return the same value as atan y. A default definition of atan2 is provided, but implementors can provide a more accurate implementation.

Instances

RealFloat Double 
RealFloat Float 
RealFloat CDouble 
RealFloat CFloat 

Numeric functions

subtract :: Num a => a -> a -> a Source

the same as flip (-).

Because - is treated specially in the Haskell grammar, (- e) is not a section, but an application of prefix negation. However, (subtract exp) is equivalent to the disallowed section.

even :: Integral a => a -> Bool Source

odd :: Integral a => a -> Bool Source

gcd :: Integral a => a -> a -> a Source

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 gcd 4 2 = 2, gcd (-4) 6 = 2, gcd 0 4 = 4. gcd 0 0 = 0. (That is, the common divisor that is "greatest" in the divisibility preordering.)

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

lcm :: Integral a => a -> a -> a Source

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

(^) :: (Num a, Integral b) => a -> b -> a infixr 8 Source

raise a number to a non-negative integral power

(^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8 Source

raise a number to an integral power

fromIntegral :: (Integral a, Num b) => a -> b Source

general coercion from integral types

realToFrac :: (Real a, Fractional b) => a -> b Source

general coercion to fractional types

Monoids

class Monoid a where Source

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:

  • mappend mempty x = x
  • mappend x mempty = x
  • mappend x (mappend y z) = mappend (mappend x y) z
  • mconcat = foldr mappend mempty

The method names refer to the monoid of lists under concatenation, but there are many other instances.

Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define newtypes and make those instances of Monoid, e.g. Sum and Product.

Minimal complete definition

mempty, mappend

Methods

mempty :: a Source

Identity of mappend

mappend :: a -> a -> a Source

An associative operation

mconcat :: [a] -> a Source

Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.

Instances

Monoid Ordering 
Monoid () 

Methods

mempty :: () Source

mappend :: () -> () -> () Source

mconcat :: [()] -> () Source

Monoid Any 
Monoid All 
Monoid Lifetime

mappend == elSupremum

Monoid Event 
Monoid [a] 

Methods

mempty :: [a] Source

mappend :: [a] -> [a] -> [a] Source

mconcat :: [[a]] -> [a] Source

Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Methods

mempty :: Maybe a Source

mappend :: Maybe a -> Maybe a -> Maybe a Source

mconcat :: [Maybe a] -> Maybe a Source

Monoid a => Monoid (IO a) 

Methods

mempty :: IO a Source

mappend :: IO a -> IO a -> IO a Source

mconcat :: [IO a] -> IO a Source

Monoid (Last a) 

Methods

mempty :: Last a Source

mappend :: Last a -> Last a -> Last a Source

mconcat :: [Last a] -> Last a Source

Monoid (First a) 

Methods

mempty :: First a Source

mappend :: First a -> First a -> First a Source

mconcat :: [First a] -> First a Source

Num a => Monoid (Product a) 
Num a => Monoid (Sum a) 

Methods

mempty :: Sum a Source

mappend :: Sum a -> Sum a -> Sum a Source

mconcat :: [Sum a] -> Sum a Source

Monoid (Endo a) 

Methods

mempty :: Endo a Source

mappend :: Endo a -> Endo a -> Endo a Source

mconcat :: [Endo a] -> Endo a Source

Monoid a => Monoid (Dual a) 

Methods

mempty :: Dual a Source

mappend :: Dual a -> Dual a -> Dual a Source

mconcat :: [Dual a] -> Dual a Source

Semigroup a => Monoid (Option a) 
Monoid m => Monoid (WrappedMonoid m) 
(Ord a, Bounded a) => Monoid (Max a) 

Methods

mempty :: Max a Source

mappend :: Max a -> Max a -> Max a Source

mconcat :: [Max a] -> Max a Source

(Ord a, Bounded a) => Monoid (Min a) 

Methods

mempty :: Min a Source

mappend :: Min a -> Min a -> Min a Source

mconcat :: [Min a] -> Min a Source

Monoid a => Monoid (Identity a) 
Monoid b => Monoid (a -> b) 

Methods

mempty :: a -> b Source

mappend :: (a -> b) -> (a -> b) -> a -> b Source

mconcat :: [a -> b] -> a -> b Source

(Monoid a, Monoid b) => Monoid (a, b) 

Methods

mempty :: (a, b) Source

mappend :: (a, b) -> (a, b) -> (a, b) Source

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

Monoid (Proxy k s) 

Methods

mempty :: Proxy k s Source

mappend :: Proxy k s -> Proxy k s -> Proxy k s Source

mconcat :: [Proxy k s] -> Proxy k s Source

(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 

Methods

mempty :: (a, b, c) Source

mappend :: (a, b, c) -> (a, b, c) -> (a, b, c) Source

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

Alternative f => Monoid (Alt (TYPE Lifted) f a) 

Methods

mempty :: Alt (TYPE Lifted) f a Source

mappend :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f a Source

mconcat :: [Alt (TYPE Lifted) f a] -> Alt (TYPE Lifted) f a Source

Monoid a => Monoid (Const k a b) 

Methods

mempty :: Const k a b Source

mappend :: Const k a b -> Const k a b -> Const k a b Source

mconcat :: [Const k a b] -> Const k a b Source

(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) 

Methods

mempty :: (a, b, c, d) Source

mappend :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source

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

(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) 

Methods

mempty :: (a, b, c, d, e) Source

mappend :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source

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

Monads and functors

class Functor f where Source

The Functor class is used for types that can be mapped over. Instances of Functor should satisfy the following laws:

fmap id  ==  id
fmap (f . g)  ==  fmap f . fmap g

The instances of Functor for lists, Maybe and IO satisfy these laws.

Minimal complete definition

fmap

Methods

fmap :: (a -> b) -> f a -> f b Source

(<$) :: a -> f b -> f a infixl 4 Source

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

Instances

Functor [] 

Methods

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

(<$) :: a -> [b] -> [a] Source

Functor Maybe 

Methods

fmap :: (a -> b) -> Maybe a -> Maybe b Source

(<$) :: a -> Maybe b -> Maybe a Source

Functor IO 

Methods

fmap :: (a -> b) -> IO a -> IO b Source

(<$) :: a -> IO b -> IO a Source

Functor ReadP 

Methods

fmap :: (a -> b) -> ReadP a -> ReadP b Source

(<$) :: a -> ReadP b -> ReadP a Source

Functor ReadPrec 

Methods

fmap :: (a -> b) -> ReadPrec a -> ReadPrec b Source

(<$) :: a -> ReadPrec b -> ReadPrec a Source

Functor Last 

Methods

fmap :: (a -> b) -> Last a -> Last b Source

(<$) :: a -> Last b -> Last a Source

Functor First 

Methods

fmap :: (a -> b) -> First a -> First b Source

(<$) :: a -> First b -> First a Source

Functor Product 

Methods

fmap :: (a -> b) -> Product a -> Product b Source

(<$) :: a -> Product b -> Product a Source

Functor Sum 

Methods

fmap :: (a -> b) -> Sum a -> Sum b Source

(<$) :: a -> Sum b -> Sum a Source

Functor Dual 

Methods

fmap :: (a -> b) -> Dual a -> Dual b Source

(<$) :: a -> Dual b -> Dual a Source

Functor STM 

Methods

fmap :: (a -> b) -> STM a -> STM b Source

(<$) :: a -> STM b -> STM a Source

Functor Handler 

Methods

fmap :: (a -> b) -> Handler a -> Handler b Source

(<$) :: a -> Handler b -> Handler a Source

Functor ZipList 

Methods

fmap :: (a -> b) -> ZipList a -> ZipList b Source

(<$) :: a -> ZipList b -> ZipList a Source

Functor Complex 

Methods

fmap :: (a -> b) -> Complex a -> Complex b Source

(<$) :: a -> Complex b -> Complex a Source

Functor NonEmpty 

Methods

fmap :: (a -> b) -> NonEmpty a -> NonEmpty b Source

(<$) :: a -> NonEmpty b -> NonEmpty a Source

Functor Option 

Methods

fmap :: (a -> b) -> Option a -> Option b Source

(<$) :: a -> Option b -> Option a Source

Functor Last 

Methods

fmap :: (a -> b) -> Last a -> Last b Source

(<$) :: a -> Last b -> Last a Source

Functor First 

Methods

fmap :: (a -> b) -> First a -> First b Source

(<$) :: a -> First b -> First a Source

Functor Max 

Methods

fmap :: (a -> b) -> Max a -> Max b Source

(<$) :: a -> Max b -> Max a Source

Functor Min 

Methods

fmap :: (a -> b) -> Min a -> Min b Source

(<$) :: a -> Min b -> Min a Source

Functor Identity 

Methods

fmap :: (a -> b) -> Identity a -> Identity b Source

(<$) :: a -> Identity b -> Identity a Source

Functor ArgDescr 

Methods

fmap :: (a -> b) -> ArgDescr a -> ArgDescr b Source

(<$) :: a -> ArgDescr b -> ArgDescr a Source

Functor OptDescr 

Methods

fmap :: (a -> b) -> OptDescr a -> OptDescr b Source

(<$) :: a -> OptDescr b -> OptDescr a Source

Functor ArgOrder 

Methods

fmap :: (a -> b) -> ArgOrder a -> ArgOrder b Source

(<$) :: a -> ArgOrder b -> ArgOrder a Source

Functor ((->) r) 

Methods

fmap :: (a -> b) -> (r -> a) -> r -> b Source

(<$) :: a -> (r -> b) -> r -> a Source

Functor (Either a) 

Methods

fmap :: (a -> b) -> Either a a -> Either a b Source

(<$) :: a -> Either a b -> Either a a Source

Functor ((,) a) 

Methods

fmap :: (a -> b) -> (a, a) -> (a, b) Source

(<$) :: a -> (a, b) -> (a, a) Source

Functor (ST s) 

Methods

fmap :: (a -> b) -> ST s a -> ST s b Source

(<$) :: a -> ST s b -> ST s a Source

Functor (Proxy (TYPE Lifted)) 

Methods

fmap :: (a -> b) -> Proxy (TYPE Lifted) a -> Proxy (TYPE Lifted) b Source

(<$) :: a -> Proxy (TYPE Lifted) b -> Proxy (TYPE Lifted) a Source

Arrow a => Functor (ArrowMonad a) 

Methods

fmap :: (a -> b) -> ArrowMonad a a -> ArrowMonad a b Source

(<$) :: a -> ArrowMonad a b -> ArrowMonad a a Source

Monad m => Functor (WrappedMonad m) 

Methods

fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b Source

(<$) :: a -> WrappedMonad m b -> WrappedMonad m a Source

Functor (ST s) 

Methods

fmap :: (a -> b) -> ST s a -> ST s b Source

(<$) :: a -> ST s b -> ST s a Source

Functor (Arg a) 

Methods

fmap :: (a -> b) -> Arg a a -> Arg a b Source

(<$) :: a -> Arg a b -> Arg a a Source

Functor f => Functor (Alt (TYPE Lifted) f) 

Methods

fmap :: (a -> b) -> Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b Source

(<$) :: a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f a Source

Functor (Const (TYPE Lifted) m) 

Methods

fmap :: (a -> b) -> Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b Source

(<$) :: a -> Const (TYPE Lifted) m b -> Const (TYPE Lifted) m a Source

Arrow a => Functor (WrappedArrow a b) 

Methods

fmap :: (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b Source

(<$) :: a -> WrappedArrow a b b -> WrappedArrow a b a Source

(Functor f, Functor g) => Functor (Product (TYPE Lifted) f g) 

Methods

fmap :: (a -> b) -> Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b Source

(<$) :: a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g a Source

(Functor f, Functor g) => Functor (Sum (TYPE Lifted) f g) 

Methods

fmap :: (a -> b) -> Sum (TYPE Lifted) f g a -> Sum (TYPE Lifted) f g b Source

(<$) :: a -> Sum (TYPE Lifted) f g b -> Sum (TYPE Lifted) f g a Source

(Functor f, Functor g) => Functor (Compose (TYPE Lifted) (TYPE Lifted) f g) 

Methods

fmap :: (a -> b) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> Compose (TYPE Lifted) (TYPE Lifted) f g b Source

(<$) :: a -> Compose (TYPE Lifted) (TYPE Lifted) f g b -> Compose (TYPE Lifted) (TYPE Lifted) f g a Source

(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 Source

An infix synonym for fmap.

Examples

Convert from a Maybe Int to a Maybe String using show:

>>> show <$> Nothing
Nothing
>>> show <$> Just 3
Just "3"

Convert from an Either Int Int to an Either Int String using show:

>>> show <$> Left 17
Left 17
>>> show <$> Right 17
Right "17"

Double each element of a list:

>>> (*2) <$> [1,2,3]
[2,4,6]

Apply even to the second element of a pair:

>>> even <$> (2,2)
(2,True)

class Functor f => Applicative f where Source

A functor with application, providing operations to

  • embed pure expressions (pure), and
  • sequence computations and combine their results (<*>).

A minimal complete definition must include implementations of these functions satisfying the following laws:

identity
pure id <*> v = v
composition
pure (.) <*> u <*> v <*> w = u <*> (v <*> w)
homomorphism
pure f <*> pure x = pure (f x)
interchange
u <*> pure y = pure ($ y) <*> u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

As a consequence of these laws, the Functor instance for f will satisfy

If f is also a Monad, it should satisfy

(which implies that pure and <*> satisfy the applicative functor laws).

Minimal complete definition

pure, (<*>)

Methods

pure :: a -> f a Source

Lift a value.

(<*>) :: f (a -> b) -> f a -> f b infixl 4 Source

Sequential application.

(*>) :: f a -> f b -> f b infixl 4 Source

Sequence actions, discarding the value of the first argument.

(<*) :: f a -> f b -> f a infixl 4 Source

Sequence actions, discarding the value of the second argument.

Instances

Applicative [] 

Methods

pure :: a -> [a] Source

(<*>) :: [a -> b] -> [a] -> [b] Source

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

(<*) :: [a] -> [b] -> [a] Source

Applicative Maybe 

Methods

pure :: a -> Maybe a Source

(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b Source

(*>) :: Maybe a -> Maybe b -> Maybe b Source

(<*) :: Maybe a -> Maybe b -> Maybe a Source

Applicative IO 

Methods

pure :: a -> IO a Source

(<*>) :: IO (a -> b) -> IO a -> IO b Source

(*>) :: IO a -> IO b -> IO b Source

(<*) :: IO a -> IO b -> IO a Source

Applicative ReadP 

Methods

pure :: a -> ReadP a Source

(<*>) :: ReadP (a -> b) -> ReadP a -> ReadP b Source

(*>) :: ReadP a -> ReadP b -> ReadP b Source

(<*) :: ReadP a -> ReadP b -> ReadP a Source

Applicative ReadPrec 

Methods

pure :: a -> ReadPrec a Source

(<*>) :: ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b Source

(*>) :: ReadPrec a -> ReadPrec b -> ReadPrec b Source

(<*) :: ReadPrec a -> ReadPrec b -> ReadPrec a Source

Applicative Last 

Methods

pure :: a -> Last a Source

(<*>) :: Last (a -> b) -> Last a -> Last b Source

(*>) :: Last a -> Last b -> Last b Source

(<*) :: Last a -> Last b -> Last a Source

Applicative First 

Methods

pure :: a -> First a Source

(<*>) :: First (a -> b) -> First a -> First b Source

(*>) :: First a -> First b -> First b Source

(<*) :: First a -> First b -> First a Source

Applicative Product 

Methods

pure :: a -> Product a Source

(<*>) :: Product (a -> b) -> Product a -> Product b Source

(*>) :: Product a -> Product b -> Product b Source

(<*) :: Product a -> Product b -> Product a Source

Applicative Sum 

Methods

pure :: a -> Sum a Source

(<*>) :: Sum (a -> b) -> Sum a -> Sum b Source

(*>) :: Sum a -> Sum b -> Sum b Source

(<*) :: Sum a -> Sum b -> Sum a Source

Applicative Dual 

Methods

pure :: a -> Dual a Source

(<*>) :: Dual (a -> b) -> Dual a -> Dual b Source

(*>) :: Dual a -> Dual b -> Dual b Source

(<*) :: Dual a -> Dual b -> Dual a Source

Applicative STM 

Methods

pure :: a -> STM a Source

(<*>) :: STM (a -> b) -> STM a -> STM b Source

(*>) :: STM a -> STM b -> STM b Source

(<*) :: STM a -> STM b -> STM a Source

Applicative ZipList 

Methods

pure :: a -> ZipList a Source

(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b Source

(*>) :: ZipList a -> ZipList b -> ZipList b Source

(<*) :: ZipList a -> ZipList b -> ZipList a Source

Applicative Complex 

Methods

pure :: a -> Complex a Source

(<*>) :: Complex (a -> b) -> Complex a -> Complex b Source

(*>) :: Complex a -> Complex b -> Complex b Source

(<*) :: Complex a -> Complex b -> Complex a Source

Applicative NonEmpty 

Methods

pure :: a -> NonEmpty a Source

(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b Source

(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source

(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a Source

Applicative Option 

Methods

pure :: a -> Option a Source

(<*>) :: Option (a -> b) -> Option a -> Option b Source

(*>) :: Option a -> Option b -> Option b Source

(<*) :: Option a -> Option b -> Option a Source

Applicative Last 

Methods

pure :: a -> Last a Source

(<*>) :: Last (a -> b) -> Last a -> Last b Source

(*>) :: Last a -> Last b -> Last b Source

(<*) :: Last a -> Last b -> Last a Source

Applicative First 

Methods

pure :: a -> First a Source

(<*>) :: First (a -> b) -> First a -> First b Source

(*>) :: First a -> First b -> First b Source

(<*) :: First a -> First b -> First a Source

Applicative Max 

Methods

pure :: a -> Max a Source

(<*>) :: Max (a -> b) -> Max a -> Max b Source

(*>) :: Max a -> Max b -> Max b Source

(<*) :: Max a -> Max b -> Max a Source

Applicative Min 

Methods

pure :: a -> Min a Source

(<*>) :: Min (a -> b) -> Min a -> Min b Source

(*>) :: Min a -> Min b -> Min b Source

(<*) :: Min a -> Min b -> Min a Source

Applicative Identity 

Methods

pure :: a -> Identity a Source

(<*>) :: Identity (a -> b) -> Identity a -> Identity b Source

(*>) :: Identity a -> Identity b -> Identity b Source

(<*) :: Identity a -> Identity b -> Identity a Source

Applicative ((->) a) 

Methods

pure :: a -> a -> a Source

(<*>) :: (a -> a -> b) -> (a -> a) -> a -> b Source

(*>) :: (a -> a) -> (a -> b) -> a -> b Source

(<*) :: (a -> a) -> (a -> b) -> a -> a Source

Applicative (Either e) 

Methods

pure :: a -> Either e a Source

(<*>) :: Either e (a -> b) -> Either e a -> Either e b Source

(*>) :: Either e a -> Either e b -> Either e b Source

(<*) :: Either e a -> Either e b -> Either e a Source

Monoid a => Applicative ((,) a) 

Methods

pure :: a -> (a, a) Source

(<*>) :: (a, a -> b) -> (a, a) -> (a, b) Source

(*>) :: (a, a) -> (a, b) -> (a, b) Source

(<*) :: (a, a) -> (a, b) -> (a, a) Source

Applicative (ST s) 

Methods

pure :: a -> ST s a Source

(<*>) :: ST s (a -> b) -> ST s a -> ST s b Source

(*>) :: ST s a -> ST s b -> ST s b Source

(<*) :: ST s a -> ST s b -> ST s a Source

Applicative (Proxy (TYPE Lifted)) 
Arrow a => Applicative (ArrowMonad a) 

Methods

pure :: a -> ArrowMonad a a Source

(<*>) :: ArrowMonad a (a -> b) -> ArrowMonad a a -> ArrowMonad a b Source

(*>) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a b Source

(<*) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a a Source

Monad m => Applicative (WrappedMonad m) 
Applicative (ST s) 

Methods

pure :: a -> ST s a Source

(<*>) :: ST s (a -> b) -> ST s a -> ST s b Source

(*>) :: ST s a -> ST s b -> ST s b Source

(<*) :: ST s a -> ST s b -> ST s a Source

Applicative f => Applicative (Alt (TYPE Lifted) f) 

Methods

pure :: a -> Alt (TYPE Lifted) f a Source

(<*>) :: Alt (TYPE Lifted) f (a -> b) -> Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b Source

(*>) :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f b Source

(<*) :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f a Source

Monoid m => Applicative (Const (TYPE Lifted) m) 

Methods

pure :: a -> Const (TYPE Lifted) m a Source

(<*>) :: Const (TYPE Lifted) m (a -> b) -> Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b Source

(*>) :: Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b -> Const (TYPE Lifted) m b Source

(<*) :: Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b -> Const (TYPE Lifted) m a Source

Arrow a => Applicative (WrappedArrow a b) 

Methods

pure :: a -> WrappedArrow a b a Source

(<*>) :: WrappedArrow a b (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b Source

(*>) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b b Source

(<*) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b a Source

(Applicative f, Applicative g) => Applicative (Product (TYPE Lifted) f g) 

Methods

pure :: a -> Product (TYPE Lifted) f g a Source

(<*>) :: Product (TYPE Lifted) f g (a -> b) -> Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b Source

(*>) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g b Source

(<*) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g a Source

(Applicative f, Applicative g) => Applicative (Compose (TYPE Lifted) (TYPE Lifted) f g) 

class Applicative m => Monad m where Source

The Monad class defines the basic operations over a monad, a concept from a branch of mathematics known as category theory. From the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do expressions provide a convenient syntax for writing monadic expressions.

Instances of Monad should satisfy the following laws:

Furthermore, the Monad and Applicative operations should relate as follows:

The above laws imply:

and that pure and (<*>) satisfy the applicative functor laws.

The instances of Monad for lists, Maybe and IO defined in the Prelude satisfy these laws.

Minimal complete definition

(>>=)

Methods

(>>=) :: forall a b. m a -> (a -> m b) -> m b infixl 1 Source

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

(>>) :: forall a b. m a -> m b -> m b infixl 1 Source

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.

return :: a -> m a Source

Inject a value into the monadic type.

fail :: String -> m a Source

Fail with a message. This operation is not part of the mathematical definition of a monad, but is invoked on pattern-match failure in a do expression.

As part of the MonadFail proposal (MFP), this function is moved to its own class MonadFail (see Control.Monad.Fail for more details). The definition here will be removed in a future release.

Instances

Monad [] 

Methods

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

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

return :: a -> [a] Source

fail :: String -> [a] Source

Monad Maybe 

Methods

(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b Source

(>>) :: Maybe a -> Maybe b -> Maybe b Source

return :: a -> Maybe a Source

fail :: String -> Maybe a Source

Monad IO 

Methods

(>>=) :: IO a -> (a -> IO b) -> IO b Source

(>>) :: IO a -> IO b -> IO b Source

return :: a -> IO a Source

fail :: String -> IO a Source

Monad ReadP 

Methods

(>>=) :: ReadP a -> (a -> ReadP b) -> ReadP b Source

(>>) :: ReadP a -> ReadP b -> ReadP b Source

return :: a -> ReadP a Source

fail :: String -> ReadP a Source

Monad ReadPrec 
Monad Last 

Methods

(>>=) :: Last a -> (a -> Last b) -> Last b Source

(>>) :: Last a -> Last b -> Last b Source

return :: a -> Last a Source

fail :: String -> Last a Source

Monad First 

Methods

(>>=) :: First a -> (a -> First b) -> First b Source

(>>) :: First a -> First b -> First b Source

return :: a -> First a Source

fail :: String -> First a Source

Monad Product 

Methods

(>>=) :: Product a -> (a -> Product b) -> Product b Source

(>>) :: Product a -> Product b -> Product b Source

return :: a -> Product a Source

fail :: String -> Product a Source

Monad Sum 

Methods

(>>=) :: Sum a -> (a -> Sum b) -> Sum b Source

(>>) :: Sum a -> Sum b -> Sum b Source

return :: a -> Sum a Source

fail :: String -> Sum a Source

Monad Dual 

Methods

(>>=) :: Dual a -> (a -> Dual b) -> Dual b Source

(>>) :: Dual a -> Dual b -> Dual b Source

return :: a -> Dual a Source

fail :: String -> Dual a Source

Monad STM 

Methods

(>>=) :: STM a -> (a -> STM b) -> STM b Source

(>>) :: STM a -> STM b -> STM b Source

return :: a -> STM a Source

fail :: String -> STM a Source

Monad Complex 

Methods

(>>=) :: Complex a -> (a -> Complex b) -> Complex b Source

(>>) :: Complex a -> Complex b -> Complex b Source

return :: a -> Complex a Source

fail :: String -> Complex a Source

Monad NonEmpty 
Monad Option 

Methods

(>>=) :: Option a -> (a -> Option b) -> Option b Source

(>>) :: Option a -> Option b -> Option b Source

return :: a -> Option a Source

fail :: String -> Option a Source

Monad Last 

Methods

(>>=) :: Last a -> (a -> Last b) -> Last b Source

(>>) :: Last a -> Last b -> Last b Source

return :: a -> Last a Source

fail :: String -> Last a Source

Monad First 

Methods

(>>=) :: First a -> (a -> First b) -> First b Source

(>>) :: First a -> First b -> First b Source

return :: a -> First a Source

fail :: String -> First a Source

Monad Max 

Methods

(>>=) :: Max a -> (a -> Max b) -> Max b Source

(>>) :: Max a -> Max b -> Max b Source

return :: a -> Max a Source

fail :: String -> Max a Source

Monad Min 

Methods

(>>=) :: Min a -> (a -> Min b) -> Min b Source

(>>) :: Min a -> Min b -> Min b Source

return :: a -> Min a Source

fail :: String -> Min a Source

Monad Identity 
Monad ((->) r) 

Methods

(>>=) :: (r -> a) -> (a -> r -> b) -> r -> b Source

(>>) :: (r -> a) -> (r -> b) -> r -> b Source

return :: a -> r -> a Source

fail :: String -> r -> a Source

Monad (Either e) 

Methods

(>>=) :: Either e a -> (a -> Either e b) -> Either e b Source

(>>) :: Either e a -> Either e b -> Either e b Source

return :: a -> Either e a Source

fail :: String -> Either e a Source

Monoid a => Monad ((,) a) 

Methods

(>>=) :: (a, a) -> (a -> (a, b)) -> (a, b) Source

(>>) :: (a, a) -> (a, b) -> (a, b) Source

return :: a -> (a, a) Source

fail :: String -> (a, a) Source

Monad (ST s) 

Methods

(>>=) :: ST s a -> (a -> ST s b) -> ST s b Source

(>>) :: ST s a -> ST s b -> ST s b Source

return :: a -> ST s a Source

fail :: String -> ST s a Source

Monad (Proxy (TYPE Lifted)) 
ArrowApply a => Monad (ArrowMonad a) 

Methods

(>>=) :: ArrowMonad a a -> (a -> ArrowMonad a b) -> ArrowMonad a b Source

(>>) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a b Source

return :: a -> ArrowMonad a a Source

fail :: String -> ArrowMonad a a Source

Monad m => Monad (WrappedMonad m) 
Monad (ST s) 

Methods

(>>=) :: ST s a -> (a -> ST s b) -> ST s b Source

(>>) :: ST s a -> ST s b -> ST s b Source

return :: a -> ST s a Source

fail :: String -> ST s a Source

Monad f => Monad (Alt (TYPE Lifted) f) 

Methods

(>>=) :: Alt (TYPE Lifted) f a -> (a -> Alt (TYPE Lifted) f b) -> Alt (TYPE Lifted) f b Source

(>>) :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f b Source

return :: a -> Alt (TYPE Lifted) f a Source

fail :: String -> Alt (TYPE Lifted) f a Source

(Monad f, Monad g) => Monad (Product (TYPE Lifted) f g) 

Methods

(>>=) :: Product (TYPE Lifted) f g a -> (a -> Product (TYPE Lifted) f g b) -> Product (TYPE Lifted) f g b Source

(>>) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g b Source

return :: a -> Product (TYPE Lifted) f g a Source

fail :: String -> Product (TYPE Lifted) f g a Source

mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m () Source

Map each element of a structure to a monadic action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see mapM.

As of base 4.8.0.0, mapM_ is just traverse_, specialized to Monad.

sequence_ :: (Foldable t, Monad m) => t (m a) -> m () Source

Evaluate each monadic action in the structure from left to right, and ignore the results. For a version that doesn't ignore the results see sequence.

As of base 4.8.0.0, sequence_ is just sequenceA_, specialized to Monad.

(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 Source

Same as >>=, but with the arguments interchanged.

Folds and traversals

class Foldable t where Source

Data structures that can be folded.

For example, given a data type

data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)

a suitable instance would be

instance Foldable Tree where
   foldMap f Empty = mempty
   foldMap f (Leaf x) = f x
   foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r

This is suitable even for abstract types, as the monoid is assumed to satisfy the monoid laws. Alternatively, one could define foldr:

instance Foldable Tree where
   foldr f z Empty = z
   foldr f z (Leaf x) = f x z
   foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l

Foldable instances are expected to satisfy the following laws:

foldr f z t = appEndo (foldMap (Endo . f) t ) z
foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
fold = foldMap id

sum, product, maximum, and minimum should all be essentially equivalent to foldMap forms, such as

sum = getSum . foldMap Sum

but may be less defined.

If the type is also a Functor instance, it should satisfy

foldMap f = fold . fmap f

which implies that

foldMap f . fmap g = foldMap (f . g)

Minimal complete definition

foldMap | foldr

Methods

foldMap :: Monoid m => (a -> m) -> t a -> m Source

Map each element of the structure to a monoid, and combine the results.

foldr :: (a -> b -> b) -> b -> t a -> b Source

Right-associative fold of a structure.

In the case of lists, foldr, when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left:

foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, foldr can produce a terminating expression from an infinite list.

For a general Foldable structure this should be semantically identical to,

foldr f z = foldr f z . toList

foldl :: (b -> a -> b) -> b -> t a -> b Source

Left-associative fold of a structure.

In the case of lists, foldl, when applied to a binary operator, a starting value (typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

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

Note that to produce the outermost application of the operator the entire input list must be traversed. This means that foldl' will diverge if given an infinite list.

Also note that if you want an efficient left-fold, you probably want to use foldl' instead of foldl. The reason for this is that latter does not force the "inner" results (e.g. z f x1 in the above example) before applying them to the operator (e.g. to (f x2)). This results in a thunk chain O(n) elements long, which then must be evaluated from the outside-in.

For a general Foldable structure this should be semantically identical to,

foldl f z = foldl f z . toList

foldr1 :: (a -> a -> a) -> t a -> a Source

A variant of foldr that has no base case, and thus may only be applied to non-empty structures.

foldr1 f = foldr1 f . toList

foldl1 :: (a -> a -> a) -> t a -> a Source

A variant of foldl that has no base case, and thus may only be applied to non-empty structures.

foldl1 f = foldl1 f . toList

null :: t a -> Bool Source

Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.

length :: t a -> Int Source

Returns the size/length of a finite structure as an Int. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.

elem :: Eq a => a -> t a -> Bool infix 4 Source

Does the element occur in the structure?

maximum :: forall a. Ord a => t a -> a Source

The largest element of a non-empty structure.

minimum :: forall a. Ord a => t a -> a Source

The least element of a non-empty structure.

sum :: Num a => t a -> a Source

The sum function computes the sum of the numbers of a structure.

product :: Num a => t a -> a Source

The product function computes the product of the numbers of a structure.

Instances

Foldable [] 

Methods

fold :: Monoid m => [m] -> m Source

foldMap :: Monoid m => (a -> m) -> [a] -> m Source

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

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

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

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

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

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

toList :: [a] -> [a] Source

null :: [a] -> Bool Source

length :: [a] -> Int Source

elem :: Eq a => a -> [a] -> Bool Source

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

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

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

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

Foldable Maybe 

Methods

fold :: Monoid m => Maybe m -> m Source

foldMap :: Monoid m => (a -> m) -> Maybe a -> m Source

foldr :: (a -> b -> b) -> b -> Maybe a -> b Source

foldr' :: (a -> b -> b) -> b -> Maybe a -> b Source

foldl :: (b -> a -> b) -> b -> Maybe a -> b Source

foldl' :: (b -> a -> b) -> b -> Maybe a -> b Source

foldr1 :: (a -> a -> a) -> Maybe a -> a Source

foldl1 :: (a -> a -> a) -> Maybe a -> a Source

toList :: Maybe a -> [a] Source

null :: Maybe a -> Bool Source

length :: Maybe a -> Int Source

elem :: Eq a => a -> Maybe a -> Bool Source

maximum :: Ord a => Maybe a -> a Source

minimum :: Ord a => Maybe a -> a Source

sum :: Num a => Maybe a -> a Source

product :: Num a => Maybe a -> a Source

Foldable Last 

Methods

fold :: Monoid m => Last m -> m Source

foldMap :: Monoid m => (a -> m) -> Last a -> m Source

foldr :: (a -> b -> b) -> b -> Last a -> b Source

foldr' :: (a -> b -> b) -> b -> Last a -> b Source

foldl :: (b -> a -> b) -> b -> Last a -> b Source

foldl' :: (b -> a -> b) -> b -> Last a -> b Source

foldr1 :: (a -> a -> a) -> Last a -> a Source

foldl1 :: (a -> a -> a) -> Last a -> a Source

toList :: Last a -> [a] Source

null :: Last a -> Bool Source

length :: Last a -> Int Source

elem :: Eq a => a -> Last a -> Bool Source

maximum :: Ord a => Last a -> a Source

minimum :: Ord a => Last a -> a Source

sum :: Num a => Last a -> a Source

product :: Num a => Last a -> a Source

Foldable First 

Methods

fold :: Monoid m => First m -> m Source

foldMap :: Monoid m => (a -> m) -> First a -> m Source

foldr :: (a -> b -> b) -> b -> First a -> b Source

foldr' :: (a -> b -> b) -> b -> First a -> b Source

foldl :: (b -> a -> b) -> b -> First a -> b Source

foldl' :: (b -> a -> b) -> b -> First a -> b Source

foldr1 :: (a -> a -> a) -> First a -> a Source

foldl1 :: (a -> a -> a) -> First a -> a Source

toList :: First a -> [a] Source

null :: First a -> Bool Source

length :: First a -> Int Source

elem :: Eq a => a -> First a -> Bool Source

maximum :: Ord a => First a -> a Source

minimum :: Ord a => First a -> a Source

sum :: Num a => First a -> a Source

product :: Num a => First a -> a Source

Foldable Product 

Methods

fold :: Monoid m => Product m -> m Source

foldMap :: Monoid m => (a -> m) -> Product a -> m Source

foldr :: (a -> b -> b) -> b -> Product a -> b Source

foldr' :: (a -> b -> b) -> b -> Product a -> b Source

foldl :: (b -> a -> b) -> b -> Product a -> b Source

foldl' :: (b -> a -> b) -> b -> Product a -> b Source

foldr1 :: (a -> a -> a) -> Product a -> a Source

foldl1 :: (a -> a -> a) -> Product a -> a Source

toList :: Product a -> [a] Source

null :: Product a -> Bool Source

length :: Product a -> Int Source

elem :: Eq a => a -> Product a -> Bool Source

maximum :: Ord a => Product a -> a Source

minimum :: Ord a => Product a -> a Source

sum :: Num a => Product a -> a Source

product :: Num a => Product a -> a Source

Foldable Sum 

Methods

fold :: Monoid m => Sum m -> m Source

foldMap :: Monoid m => (a -> m) -> Sum a -> m Source

foldr :: (a -> b -> b) -> b -> Sum a -> b Source

foldr' :: (a -> b -> b) -> b -> Sum a -> b Source

foldl :: (b -> a -> b) -> b -> Sum a -> b Source

foldl' :: (b -> a -> b) -> b -> Sum a -> b Source

foldr1 :: (a -> a -> a) -> Sum a -> a Source

foldl1 :: (a -> a -> a) -> Sum a -> a Source

toList :: Sum a -> [a] Source

null :: Sum a -> Bool Source

length :: Sum a -> Int Source

elem :: Eq a => a -> Sum a -> Bool Source

maximum :: Ord a => Sum a -> a Source

minimum :: Ord a => Sum a -> a Source

sum :: Num a => Sum a -> a Source

product :: Num a => Sum a -> a Source

Foldable Dual 

Methods

fold :: Monoid m => Dual m -> m Source

foldMap :: Monoid m => (a -> m) -> Dual a -> m Source

foldr :: (a -> b -> b) -> b -> Dual a -> b Source

foldr' :: (a -> b -> b) -> b -> Dual a -> b Source

foldl :: (b -> a -> b) -> b -> Dual a -> b Source

foldl' :: (b -> a -> b) -> b -> Dual a -> b Source

foldr1 :: (a -> a -> a) -> Dual a -> a Source

foldl1 :: (a -> a -> a) -> Dual a -> a Source

toList :: Dual a -> [a] Source

null :: Dual a -> Bool Source

length :: Dual a -> Int Source

elem :: Eq a => a -> Dual a -> Bool Source

maximum :: Ord a => Dual a -> a Source

minimum :: Ord a => Dual a -> a Source

sum :: Num a => Dual a -> a Source

product :: Num a => Dual a -> a Source

Foldable ZipList 

Methods

fold :: Monoid m => ZipList m -> m Source

foldMap :: Monoid m => (a -> m) -> ZipList a -> m Source

foldr :: (a -> b -> b) -> b -> ZipList a -> b Source

foldr' :: (a -> b -> b) -> b -> ZipList a -> b Source

foldl :: (b -> a -> b) -> b -> ZipList a -> b Source

foldl' :: (b -> a -> b) -> b -> ZipList a -> b Source

foldr1 :: (a -> a -> a) -> ZipList a -> a Source

foldl1 :: (a -> a -> a) -> ZipList a -> a Source

toList :: ZipList a -> [a] Source

null :: ZipList a -> Bool Source

length :: ZipList a -> Int Source

elem :: Eq a => a -> ZipList a -> Bool Source

maximum :: Ord a => ZipList a -> a Source

minimum :: Ord a => ZipList a -> a Source

sum :: Num a => ZipList a -> a Source

product :: Num a => ZipList a -> a Source

Foldable Complex 

Methods

fold :: Monoid m => Complex m -> m Source

foldMap :: Monoid m => (a -> m) -> Complex a -> m Source

foldr :: (a -> b -> b) -> b -> Complex a -> b Source

foldr' :: (a -> b -> b) -> b -> Complex a -> b Source

foldl :: (b -> a -> b) -> b -> Complex a -> b Source

foldl' :: (b -> a -> b) -> b -> Complex a -> b Source

foldr1 :: (a -> a -> a) -> Complex a -> a Source

foldl1 :: (a -> a -> a) -> Complex a -> a Source

toList :: Complex a -> [a] Source

null :: Complex a -> Bool Source

length :: Complex a -> Int Source

elem :: Eq a => a -> Complex a -> Bool Source

maximum :: Ord a => Complex a -> a Source

minimum :: Ord a => Complex a -> a Source

sum :: Num a => Complex a -> a Source

product :: Num a => Complex a -> a Source

Foldable NonEmpty 

Methods

fold :: Monoid m => NonEmpty m -> m Source

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m Source

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b Source

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b Source

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b Source

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b Source

foldr1 :: (a -> a -> a) -> NonEmpty a -> a Source

foldl1 :: (a -> a -> a) -> NonEmpty a -> a Source

toList :: NonEmpty a -> [a] Source

null :: NonEmpty a -> Bool Source

length :: NonEmpty a -> Int Source

elem :: Eq a => a -> NonEmpty a -> Bool Source

maximum :: Ord a => NonEmpty a -> a Source

minimum :: Ord a => NonEmpty a -> a Source

sum :: Num a => NonEmpty a -> a Source

product :: Num a => NonEmpty a -> a Source

Foldable Option 

Methods

fold :: Monoid m => Option m -> m Source

foldMap :: Monoid m => (a -> m) -> Option a -> m Source

foldr :: (a -> b -> b) -> b -> Option a -> b Source

foldr' :: (a -> b -> b) -> b -> Option a -> b Source

foldl :: (b -> a -> b) -> b -> Option a -> b Source

foldl' :: (b -> a -> b) -> b -> Option a -> b Source

foldr1 :: (a -> a -> a) -> Option a -> a Source

foldl1 :: (a -> a -> a) -> Option a -> a Source

toList :: Option a -> [a] Source

null :: Option a -> Bool Source

length :: Option a -> Int Source

elem :: Eq a => a -> Option a -> Bool Source

maximum :: Ord a => Option a -> a Source

minimum :: Ord a => Option a -> a Source

sum :: Num a => Option a -> a Source

product :: Num a => Option a -> a Source

Foldable Last 

Methods

fold :: Monoid m => Last m -> m Source

foldMap :: Monoid m => (a -> m) -> Last a -> m Source

foldr :: (a -> b -> b) -> b -> Last a -> b Source

foldr' :: (a -> b -> b) -> b -> Last a -> b Source

foldl :: (b -> a -> b) -> b -> Last a -> b Source

foldl' :: (b -> a -> b) -> b -> Last a -> b Source

foldr1 :: (a -> a -> a) -> Last a -> a Source

foldl1 :: (a -> a -> a) -> Last a -> a Source

toList :: Last a -> [a] Source

null :: Last a -> Bool Source

length :: Last a -> Int Source

elem :: Eq a => a -> Last a -> Bool Source

maximum :: Ord a => Last a -> a Source

minimum :: Ord a => Last a -> a Source

sum :: Num a => Last a -> a Source

product :: Num a => Last a -> a Source

Foldable First 

Methods

fold :: Monoid m => First m -> m Source

foldMap :: Monoid m => (a -> m) -> First a -> m Source

foldr :: (a -> b -> b) -> b -> First a -> b Source

foldr' :: (a -> b -> b) -> b -> First a -> b Source

foldl :: (b -> a -> b) -> b -> First a -> b Source

foldl' :: (b -> a -> b) -> b -> First a -> b Source

foldr1 :: (a -> a -> a) -> First a -> a Source

foldl1 :: (a -> a -> a) -> First a -> a Source

toList :: First a -> [a] Source

null :: First a -> Bool Source

length :: First a -> Int Source

elem :: Eq a => a -> First a -> Bool Source

maximum :: Ord a => First a -> a Source

minimum :: Ord a => First a -> a Source

sum :: Num a => First a -> a Source

product :: Num a => First a -> a Source

Foldable Max 

Methods

fold :: Monoid m => Max m -> m Source

foldMap :: Monoid m => (a -> m) -> Max a -> m Source

foldr :: (a -> b -> b) -> b -> Max a -> b Source

foldr' :: (a -> b -> b) -> b -> Max a -> b Source

foldl :: (b -> a -> b) -> b -> Max a -> b Source

foldl' :: (b -> a -> b) -> b -> Max a -> b Source

foldr1 :: (a -> a -> a) -> Max a -> a Source

foldl1 :: (a -> a -> a) -> Max a -> a Source

toList :: Max a -> [a] Source

null :: Max a -> Bool Source

length :: Max a -> Int Source

elem :: Eq a => a -> Max a -> Bool Source

maximum :: Ord a => Max a -> a Source

minimum :: Ord a => Max a -> a Source

sum :: Num a => Max a -> a Source

product :: Num a => Max a -> a Source

Foldable Min 

Methods

fold :: Monoid m => Min m -> m Source

foldMap :: Monoid m => (a -> m) -> Min a -> m Source

foldr :: (a -> b -> b) -> b -> Min a -> b Source

foldr' :: (a -> b -> b) -> b -> Min a -> b Source

foldl :: (b -> a -> b) -> b -> Min a -> b Source

foldl' :: (b -> a -> b) -> b -> Min a -> b Source

foldr1 :: (a -> a -> a) -> Min a -> a Source

foldl1 :: (a -> a -> a) -> Min a -> a Source

toList :: Min a -> [a] Source

null :: Min a -> Bool Source

length :: Min a -> Int Source

elem :: Eq a => a -> Min a -> Bool Source

maximum :: Ord a => Min a -> a Source

minimum :: Ord a => Min a -> a Source

sum :: Num a => Min a -> a Source

product :: Num a => Min a -> a Source

Foldable Identity 

Methods

fold :: Monoid m => Identity m -> m Source

foldMap :: Monoid m => (a -> m) -> Identity a -> m Source

foldr :: (a -> b -> b) -> b -> Identity a -> b Source

foldr' :: (a -> b -> b) -> b -> Identity a -> b Source

foldl :: (b -> a -> b) -> b -> Identity a -> b Source

foldl' :: (b -> a -> b) -> b -> Identity a -> b Source

foldr1 :: (a -> a -> a) -> Identity a -> a Source

foldl1 :: (a -> a -> a) -> Identity a -> a Source

toList :: Identity a -> [a] Source

null :: Identity a -> Bool Source

length :: Identity a -> Int Source

elem :: Eq a => a -> Identity a -> Bool Source

maximum :: Ord a => Identity a -> a Source

minimum :: Ord a => Identity a -> a Source

sum :: Num a => Identity a -> a Source

product :: Num a => Identity a -> a Source

Foldable (Either a) 

Methods

fold :: Monoid m => Either a m -> m Source

foldMap :: Monoid m => (a -> m) -> Either a a -> m Source

foldr :: (a -> b -> b) -> b -> Either a a -> b Source

foldr' :: (a -> b -> b) -> b -> Either a a -> b Source

foldl :: (b -> a -> b) -> b -> Either a a -> b Source

foldl' :: (b -> a -> b) -> b -> Either a a -> b Source

foldr1 :: (a -> a -> a) -> Either a a -> a Source

foldl1 :: (a -> a -> a) -> Either a a -> a Source

toList :: Either a a -> [a] Source

null :: Either a a -> Bool Source

length :: Either a a -> Int Source

elem :: Eq a => a -> Either a a -> Bool Source

maximum :: Ord a => Either a a -> a Source

minimum :: Ord a => Either a a -> a Source

sum :: Num a => Either a a -> a Source

product :: Num a => Either a a -> a Source

Foldable ((,) a) 

Methods

fold :: Monoid m => (a, m) -> m Source

foldMap :: Monoid m => (a -> m) -> (a, a) -> m Source

foldr :: (a -> b -> b) -> b -> (a, a) -> b Source

foldr' :: (a -> b -> b) -> b -> (a, a) -> b Source

foldl :: (b -> a -> b) -> b -> (a, a) -> b Source

foldl' :: (b -> a -> b) -> b -> (a, a) -> b Source

foldr1 :: (a -> a -> a) -> (a, a) -> a Source

foldl1 :: (a -> a -> a) -> (a, a) -> a Source

toList :: (a, a) -> [a] Source

null :: (a, a) -> Bool Source

length :: (a, a) -> Int Source

elem :: Eq a => a -> (a, a) -> Bool Source

maximum :: Ord a => (a, a) -> a Source

minimum :: Ord a => (a, a) -> a Source

sum :: Num a => (a, a) -> a Source

product :: Num a => (a, a) -> a Source

Foldable (Proxy (TYPE Lifted)) 

Methods

fold :: Monoid m => Proxy (TYPE Lifted) m -> m Source

foldMap :: Monoid m => (a -> m) -> Proxy (TYPE Lifted) a -> m Source

foldr :: (a -> b -> b) -> b -> Proxy (TYPE Lifted) a -> b Source

foldr' :: (a -> b -> b) -> b -> Proxy (TYPE Lifted) a -> b Source

foldl :: (b -> a -> b) -> b -> Proxy (TYPE Lifted) a -> b Source

foldl' :: (b -> a -> b) -> b -> Proxy (TYPE Lifted) a -> b Source

foldr1 :: (a -> a -> a) -> Proxy (TYPE Lifted) a -> a Source

foldl1 :: (a -> a -> a) -> Proxy (TYPE Lifted) a -> a Source

toList :: Proxy (TYPE Lifted) a -> [a] Source

null :: Proxy (TYPE Lifted) a -> Bool Source

length :: Proxy (TYPE Lifted) a -> Int Source

elem :: Eq a => a -> Proxy (TYPE Lifted) a -> Bool Source

maximum :: Ord a => Proxy (TYPE Lifted) a -> a Source

minimum :: Ord a => Proxy (TYPE Lifted) a -> a Source

sum :: Num a => Proxy (TYPE Lifted) a -> a Source

product :: Num a => Proxy (TYPE Lifted) a -> a Source

Foldable (Arg a) 

Methods

fold :: Monoid m => Arg a m -> m Source

foldMap :: Monoid m => (a -> m) -> Arg a a -> m Source

foldr :: (a -> b -> b) -> b -> Arg a a -> b Source

foldr' :: (a -> b -> b) -> b -> Arg a a -> b Source

foldl :: (b -> a -> b) -> b -> Arg a a -> b Source

foldl' :: (b -> a -> b) -> b -> Arg a a -> b Source

foldr1 :: (a -> a -> a) -> Arg a a -> a Source

foldl1 :: (a -> a -> a) -> Arg a a -> a Source

toList :: Arg a a -> [a] Source

null :: Arg a a -> Bool Source

length :: Arg a a -> Int Source

elem :: Eq a => a -> Arg a a -> Bool Source

maximum :: Ord a => Arg a a -> a Source

minimum :: Ord a => Arg a a -> a Source

sum :: Num a => Arg a a -> a Source

product :: Num a => Arg a a -> a Source

Foldable (Const (TYPE Lifted) m) 

Methods

fold :: Monoid m => Const (TYPE Lifted) m m -> m Source

foldMap :: Monoid m => (a -> m) -> Const (TYPE Lifted) m a -> m Source

foldr :: (a -> b -> b) -> b -> Const (TYPE Lifted) m a -> b Source

foldr' :: (a -> b -> b) -> b -> Const (TYPE Lifted) m a -> b Source

foldl :: (b -> a -> b) -> b -> Const (TYPE Lifted) m a -> b Source

foldl' :: (b -> a -> b) -> b -> Const (TYPE Lifted) m a -> b Source

foldr1 :: (a -> a -> a) -> Const (TYPE Lifted) m a -> a Source

foldl1 :: (a -> a -> a) -> Const (TYPE Lifted) m a -> a Source

toList :: Const (TYPE Lifted) m a -> [a] Source

null :: Const (TYPE Lifted) m a -> Bool Source

length :: Const (TYPE Lifted) m a -> Int Source

elem :: Eq a => a -> Const (TYPE Lifted) m a -> Bool Source

maximum :: Ord a => Const (TYPE Lifted) m a -> a Source

minimum :: Ord a => Const (TYPE Lifted) m a -> a Source

sum :: Num a => Const (TYPE Lifted) m a -> a Source

product :: Num a => Const (TYPE Lifted) m a -> a Source

(Foldable f, Foldable g) => Foldable (Product (TYPE Lifted) f g) 

Methods

fold :: Monoid m => Product (TYPE Lifted) f g m -> m Source

foldMap :: Monoid m => (a -> m) -> Product (TYPE Lifted) f g a -> m Source

foldr :: (a -> b -> b) -> b -> Product (TYPE Lifted) f g a -> b Source

foldr' :: (a -> b -> b) -> b -> Product (TYPE Lifted) f g a -> b Source

foldl :: (b -> a -> b) -> b -> Product (TYPE Lifted) f g a -> b Source

foldl' :: (b -> a -> b) -> b -> Product (TYPE Lifted) f g a -> b Source

foldr1 :: (a -> a -> a) -> Product (TYPE Lifted) f g a -> a Source

foldl1 :: (a -> a -> a) -> Product (TYPE Lifted) f g a -> a Source

toList :: Product (TYPE Lifted) f g a -> [a] Source

null :: Product (TYPE Lifted) f g a -> Bool Source

length :: Product (TYPE Lifted) f g a -> Int Source

elem :: Eq a => a -> Product (TYPE Lifted) f g a -> Bool Source

maximum :: Ord a => Product (TYPE Lifted) f g a -> a Source

minimum :: Ord a => Product (TYPE Lifted) f g a -> a Source

sum :: Num a => Product (TYPE Lifted) f g a -> a Source

product :: Num a => Product (TYPE Lifted) f g a -> a Source

(Foldable f, Foldable g) => Foldable (Sum (TYPE Lifted) f g) 

Methods

fold :: Monoid m => Sum (TYPE Lifted) f g m -> m Source

foldMap :: Monoid m => (a -> m) -> Sum (TYPE Lifted) f g a -> m Source

foldr :: (a -> b -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldr' :: (a -> b -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldl :: (b -> a -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldl' :: (b -> a -> b) -> b -> Sum (TYPE Lifted) f g a -> b Source

foldr1 :: (a -> a -> a) -> Sum (TYPE Lifted) f g a -> a Source

foldl1 :: (a -> a -> a) -> Sum (TYPE Lifted) f g a -> a Source

toList :: Sum (TYPE Lifted) f g a -> [a] Source

null :: Sum (TYPE Lifted) f g a -> Bool Source

length :: Sum (TYPE Lifted) f g a -> Int Source

elem :: Eq a => a -> Sum (TYPE Lifted) f g a -> Bool Source

maximum :: Ord a => Sum (TYPE Lifted) f g a -> a Source

minimum :: Ord a => Sum (TYPE Lifted) f g a -> a Source

sum :: Num a => Sum (TYPE Lifted) f g a -> a Source

product :: Num a => Sum (TYPE Lifted) f g a -> a Source

(Foldable f, Foldable g) => Foldable (Compose (TYPE Lifted) (TYPE Lifted) f g) 

Methods

fold :: Monoid m => Compose (TYPE Lifted) (TYPE Lifted) f g m -> m Source

foldMap :: Monoid m => (a -> m) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> m Source

foldr :: (a -> b -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b Source

foldr' :: (a -> b -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b Source

foldl :: (b -> a -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b Source

foldl' :: (b -> a -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b Source

foldr1 :: (a -> a -> a) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> a Source

foldl1 :: (a -> a -> a) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> a Source

toList :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> [a] Source

null :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> Bool Source

length :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> Int Source

elem :: Eq a => a -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> Bool Source

maximum :: Ord a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a Source

minimum :: Ord a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a Source

sum :: Num a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a Source

product :: Num a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a Source

class (Functor t, Foldable t) => Traversable t where Source

Functors representing data structures that can be traversed from left to right.

A definition of traverse must satisfy the following laws:

naturality
t . traverse f = traverse (t . f) for every applicative transformation t
identity
traverse Identity = Identity
composition
traverse (Compose . fmap g . f) = Compose . fmap (traverse g) . traverse f

A definition of sequenceA must satisfy the following laws:

naturality
t . sequenceA = sequenceA . fmap t for every applicative transformation t
identity
sequenceA . fmap Identity = Identity
composition
sequenceA . fmap Compose = Compose . fmap sequenceA . sequenceA

where an applicative transformation is a function

t :: (Applicative f, Applicative g) => f a -> g a

preserving the Applicative operations, i.e.

and the identity functor Identity and composition of functors Compose are defined as

  newtype Identity a = Identity a

  instance Functor Identity where
    fmap f (Identity x) = Identity (f x)

  instance Applicative Identity where
    pure x = Identity x
    Identity f <*> Identity x = Identity (f x)

  newtype Compose f g a = Compose (f (g a))

  instance (Functor f, Functor g) => Functor (Compose f g) where
    fmap f (Compose x) = Compose (fmap (fmap f) x)

  instance (Applicative f, Applicative g) => Applicative (Compose f g) where
    pure x = Compose (pure (pure x))
    Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)

(The naturality law is implied by parametricity.)

Instances are similar to Functor, e.g. given a data type

data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)

a suitable instance would be

instance Traversable Tree where
   traverse f Empty = pure Empty
   traverse f (Leaf x) = Leaf <$> f x
   traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r

This is suitable even for abstract types, as the laws for <*> imply a form of associativity.

The superclass instances should satisfy the following:

Minimal complete definition

traverse | sequenceA

Methods

traverse :: Applicative f => (a -> f b) -> t a -> f (t b) Source

Map each element of a structure to an action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see traverse_.

sequenceA :: Applicative f => t (f a) -> f (t a) Source

Evaluate each action in the structure from left to right, and and collect the results. For a version that ignores the results see sequenceA_.

mapM :: Monad m => (a -> m b) -> t a -> m (t b) Source

Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see mapM_.

sequence :: Monad m => t (m a) -> m (t a) Source

Evaluate each monadic action in the structure from left to right, and collect the results. For a version that ignores the results see sequence_.

Instances

Traversable [] 

Methods

traverse :: Applicative f => (a -> f b) -> [a] -> f [b] Source

sequenceA :: Applicative f => [f a] -> f [a] Source

mapM :: Monad m => (a -> m b) -> [a] -> m [b] Source

sequence :: Monad m => [m a] -> m [a] Source

Traversable Maybe 

Methods

traverse :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) Source

sequenceA :: Applicative f => Maybe (f a) -> f (Maybe a) Source

mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) Source

sequence :: Monad m => Maybe (m a) -> m (Maybe a) Source

Traversable Last 

Methods

traverse :: Applicative f => (a -> f b) -> Last a -> f (Last b) Source

sequenceA :: Applicative f => Last (f a) -> f (Last a) Source

mapM :: Monad m => (a -> m b) -> Last a -> m (Last b) Source

sequence :: Monad m => Last (m a) -> m (Last a) Source

Traversable First 

Methods

traverse :: Applicative f => (a -> f b) -> First a -> f (First b) Source

sequenceA :: Applicative f => First (f a) -> f (First a) Source

mapM :: Monad m => (a -> m b) -> First a -> m (First b) Source

sequence :: Monad m => First (m a) -> m (First a) Source

Traversable Product 

Methods

traverse :: Applicative f => (a -> f b) -> Product a -> f (Product b) Source

sequenceA :: Applicative f => Product (f a) -> f (Product a) Source

mapM :: Monad m => (a -> m b) -> Product a -> m (Product b) Source

sequence :: Monad m => Product (m a) -> m (Product a) Source

Traversable Sum 

Methods

traverse :: Applicative f => (a -> f b) -> Sum a -> f (Sum b) Source

sequenceA :: Applicative f => Sum (f a) -> f (Sum a) Source

mapM :: Monad m => (a -> m b) -> Sum a -> m (Sum b) Source

sequence :: Monad m => Sum (m a) -> m (Sum a) Source

Traversable Dual 

Methods

traverse :: Applicative f => (a -> f b) -> Dual a -> f (Dual b) Source

sequenceA :: Applicative f => Dual (f a) -> f (Dual a) Source

mapM :: Monad m => (a -> m b) -> Dual a -> m (Dual b) Source

sequence :: Monad m => Dual (m a) -> m (Dual a) Source

Traversable ZipList 

Methods

traverse :: Applicative f => (a -> f b) -> ZipList a -> f (ZipList b) Source

sequenceA :: Applicative f => ZipList (f a) -> f (ZipList a) Source

mapM :: Monad m => (a -> m b) -> ZipList a -> m (ZipList b) Source

sequence :: Monad m => ZipList (m a) -> m (ZipList a) Source

Traversable Complex 

Methods

traverse :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) Source

sequenceA :: Applicative f => Complex (f a) -> f (Complex a) Source

mapM :: Monad m => (a -> m b) -> Complex a -> m (Complex b) Source

sequence :: Monad m => Complex (m a) -> m (Complex a) Source

Traversable NonEmpty 

Methods

traverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) Source

sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) Source

mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) Source

sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) Source

Traversable Option 

Methods

traverse :: Applicative f => (a -> f b) -> Option a -> f (Option b) Source

sequenceA :: Applicative f => Option (f a) -> f (Option a) Source

mapM :: Monad m => (a -> m b) -> Option a -> m (Option b) Source

sequence :: Monad m => Option (m a) -> m (Option a) Source

Traversable Last 

Methods

traverse :: Applicative f => (a -> f b) -> Last a -> f (Last b) Source

sequenceA :: Applicative f => Last (f a) -> f (Last a) Source

mapM :: Monad m => (a -> m b) -> Last a -> m (Last b) Source

sequence :: Monad m => Last (m a) -> m (Last a) Source

Traversable First 

Methods

traverse :: Applicative f => (a -> f b) -> First a -> f (First b) Source

sequenceA :: Applicative f => First (f a) -> f (First a) Source

mapM :: Monad m => (a -> m b) -> First a -> m (First b) Source

sequence :: Monad m => First (m a) -> m (First a) Source

Traversable Max 

Methods

traverse :: Applicative f => (a -> f b) -> Max a -> f (Max b) Source

sequenceA :: Applicative f => Max (f a) -> f (Max a) Source

mapM :: Monad m => (a -> m b) -> Max a -> m (Max b) Source

sequence :: Monad m => Max (m a) -> m (Max a) Source

Traversable Min 

Methods

traverse :: Applicative f => (a -> f b) -> Min a -> f (Min b) Source

sequenceA :: Applicative f => Min (f a) -> f (Min a) Source

mapM :: Monad m => (a -> m b) -> Min a -> m (Min b) Source

sequence :: Monad m => Min (m a) -> m (Min a) Source

Traversable Identity 

Methods

traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) Source

sequenceA :: Applicative f => Identity (f a) -> f (Identity a) Source

mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) Source

sequence :: Monad m => Identity (m a) -> m (Identity a) Source

Traversable (Either a) 

Methods

traverse :: Applicative f => (a -> f b) -> Either a a -> f (Either a b) Source

sequenceA :: Applicative f => Either a (f a) -> f (Either a a) Source

mapM :: Monad m => (a -> m b) -> Either a a -> m (Either a b) Source

sequence :: Monad m => Either a (m a) -> m (Either a a) Source

Traversable ((,) a) 

Methods

traverse :: Applicative f => (a -> f b) -> (a, a) -> f (a, b) Source

sequenceA :: Applicative f => (a, f a) -> f (a, a) Source

mapM :: Monad m => (a -> m b) -> (a, a) -> m (a, b) Source

sequence :: Monad m => (a, m a) -> m (a, a) Source

Traversable (Proxy (TYPE Lifted)) 

Methods

traverse :: Applicative f => (a -> f b) -> Proxy (TYPE Lifted) a -> f (Proxy (TYPE Lifted) b) Source

sequenceA :: Applicative f => Proxy (TYPE Lifted) (f a) -> f (Proxy (TYPE Lifted) a) Source

mapM :: Monad m => (a -> m b) -> Proxy (TYPE Lifted) a -> m (Proxy (TYPE Lifted) b) Source

sequence :: Monad m => Proxy (TYPE Lifted) (m a) -> m (Proxy (TYPE Lifted) a) Source

Traversable (Arg a) 

Methods

traverse :: Applicative f => (a -> f b) -> Arg a a -> f (Arg a b) Source

sequenceA :: Applicative f => Arg a (f a) -> f (Arg a a) Source

mapM :: Monad m => (a -> m b) -> Arg a a -> m (Arg a b) Source

sequence :: Monad m => Arg a (m a) -> m (Arg a a) Source

Traversable (Const (TYPE Lifted) m) 

Methods

traverse :: Applicative f => (a -> f b) -> Const (TYPE Lifted) m a -> f (Const (TYPE Lifted) m b) Source

sequenceA :: Applicative f => Const (TYPE Lifted) m (f a) -> f (Const (TYPE Lifted) m a) Source

mapM :: Monad m => (a -> m b) -> Const (TYPE Lifted) m a -> m (Const (TYPE Lifted) m b) Source

sequence :: Monad m => Const (TYPE Lifted) m (m a) -> m (Const (TYPE Lifted) m a) Source

(Traversable f, Traversable g) => Traversable (Product (TYPE Lifted) f g) 

Methods

traverse :: Applicative f => (a -> f b) -> Product (TYPE Lifted) f g a -> f (Product (TYPE Lifted) f g b) Source

sequenceA :: Applicative f => Product (TYPE Lifted) f g (f a) -> f (Product (TYPE Lifted) f g a) Source

mapM :: Monad m => (a -> m b) -> Product (TYPE Lifted) f g a -> m (Product (TYPE Lifted) f g b) Source

sequence :: Monad m => Product (TYPE Lifted) f g (m a) -> m (Product (TYPE Lifted) f g a) Source

(Traversable f, Traversable g) => Traversable (Sum (TYPE Lifted) f g) 

Methods

traverse :: Applicative f => (a -> f b) -> Sum (TYPE Lifted) f g a -> f (Sum (TYPE Lifted) f g b) Source

sequenceA :: Applicative f => Sum (TYPE Lifted) f g (f a) -> f (Sum (TYPE Lifted) f g a) Source

mapM :: Monad m => (a -> m b) -> Sum (TYPE Lifted) f g a -> m (Sum (TYPE Lifted) f g b) Source

sequence :: Monad m => Sum (TYPE Lifted) f g (m a) -> m (Sum (TYPE Lifted) f g a) Source

(Traversable f, Traversable g) => Traversable (Compose (TYPE Lifted) (TYPE Lifted) f g) 

Methods

traverse :: Applicative f => (a -> f b) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> f (Compose (TYPE Lifted) (TYPE Lifted) f g b) Source

sequenceA :: Applicative f => Compose (TYPE Lifted) (TYPE Lifted) f g (f a) -> f (Compose (TYPE Lifted) (TYPE Lifted) f g a) Source

mapM :: Monad m => (a -> m b) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> m (Compose (TYPE Lifted) (TYPE Lifted) f g b) Source

sequence :: Monad m => Compose (TYPE Lifted) (TYPE Lifted) f g (m a) -> m (Compose (TYPE Lifted) (TYPE Lifted) f g a) Source

Miscellaneous functions

id :: a -> a Source

Identity function.

const :: a -> b -> a Source

const x is a unary function which evaluates to x for all inputs.

For instance,

>>> map (const 42) [0..3]
[42,42,42,42]

(.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 Source

Function composition.

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

flip f takes its (first) two arguments in the reverse order of f.

($) :: (a -> b) -> a -> b infixr 0 Source

Application operator. This operator is redundant, since ordinary application (f x) means the same as (f $ x). However, $ has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example:

    f $ g $ h x  =  f (g (h x))

It is also useful in higher-order situations, such as map ($ 0) xs, or zipWith ($) fs xs.

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

until p f yields the result of applying f until p holds.

asTypeOf :: a -> a -> a Source

asTypeOf is a type-restricted version of const. It is usually used as an infix operator, and its typing forces its first argument (which is usually overloaded) to have the same type as the second.

error :: forall v. forall a. HasCallStack => [Char] -> a Source

error stops execution and displays an error message.

errorWithoutStackTrace :: forall v. forall a. [Char] -> a Source

A variant of error that does not produce a stack trace.

Since: 4.9.0.0

undefined :: forall v. forall a. HasCallStack => a Source

A special case of error. It is expected that compilers will recognize this and insert error messages which are more appropriate to the context in which undefined appears.

seq :: a -> b -> b Source

The value of seq a b is bottom if a is bottom, and otherwise equal to b. seq is usually introduced to improve performance by avoiding unneeded laziness.

A note on evaluation order: the expression seq a b does not guarantee that a will be evaluated before b. The only guarantee given by seq is that the both a and b will be evaluated before seq returns a value. In particular, this means that b may be evaluated before a. If you need to guarantee a specific order of evaluation, you must use the function pseq from the "parallel" package.

($!) :: (a -> b) -> a -> b infixr 0 Source

Strict (call-by-value) application operator. It takes a function and an argument, evaluates the argument to weak head normal form (WHNF), then calls the function with that value.

List operations

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

map f xs is the list obtained by applying f to each element of xs, i.e.,

map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
map f [x1, x2, ...] == [f x1, f x2, ...]

(++) :: [a] -> [a] -> [a] infixr 5 Source

Append two lists, i.e.,

[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]

If the first list is not finite, the result is the first list.

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

filter, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e.,

filter p xs = [ x | x <- xs, p x]

head :: [a] -> a Source

Extract the first element of a list, which must be non-empty.

last :: [a] -> a Source

Extract the last element of a list, which must be finite and non-empty.

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

Extract the elements after the head of a list, which must be non-empty.

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

Return all the elements of a list except the last one. The list must be non-empty.

null :: Foldable t => t a -> Bool Source

Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.

length :: Foldable t => t a -> Int Source

Returns the size/length of a finite structure as an Int. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.

(!!) :: [a] -> Int -> a infixl 9 Source

List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex, which takes an index of any integral type.

reverse :: [a] -> [a] Source

reverse xs returns the elements of xs in reverse order. xs must be finite.

Special folds

and :: Foldable t => t Bool -> Bool Source

and returns the conjunction of a container of Bools. For the result to be True, the container must be finite; False, however, results from a False value finitely far from the left end.

or :: Foldable t => t Bool -> Bool Source

or returns the disjunction of a container of Bools. For the result to be False, the container must be finite; True, however, results from a True value finitely far from the left end.

any :: Foldable t => (a -> Bool) -> t a -> Bool Source

Determines whether any element of the structure satisfies the predicate.

all :: Foldable t => (a -> Bool) -> t a -> Bool Source

Determines whether all elements of the structure satisfy the predicate.

concat :: Foldable t => t [a] -> [a] Source

The concatenation of all the elements of a container of lists.

concatMap :: Foldable t => (a -> [b]) -> t a -> [b] Source

Map a function over all the elements of a container and concatenate the resulting lists.

Building lists

Scans

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

scanl is similar to foldl, but returns a list of successive reduced values from the left:

scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]

Note that

last (scanl f z xs) == foldl f z xs.

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

scanl1 is a variant of scanl that has no starting value argument:

scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]

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

scanr is the right-to-left dual of scanl. Note that

head (scanr f z xs) == foldr f z xs.

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

scanr1 is a variant of scanr that has no starting value argument.

Infinite lists

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

iterate f x returns an infinite list of repeated applications of f to x:

iterate f x == [x, f x, f (f x), ...]

repeat :: a -> [a] Source

repeat x is an infinite list, with x the value of every element.

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

replicate n x is a list of length n with x the value of every element. It is an instance of the more general genericReplicate, in which n may be of any integral type.

cycle :: [a] -> [a] Source

cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists.

Sublists

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

take n, applied to a list xs, returns the prefix of xs of length n, or xs itself if n > length xs:

take 5 "Hello World!" == "Hello"
take 3 [1,2,3,4,5] == [1,2,3]
take 3 [1,2] == [1,2]
take 3 [] == []
take (-1) [1,2] == []
take 0 [1,2] == []

It is an instance of the more general genericTake, in which n may be of any integral type.

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

drop n xs returns the suffix of xs after the first n elements, or [] if n > length xs:

drop 6 "Hello World!" == "World!"
drop 3 [1,2,3,4,5] == [4,5]
drop 3 [1,2] == []
drop 3 [] == []
drop (-1) [1,2] == [1,2]
drop 0 [1,2] == [1,2]

It is an instance of the more general genericDrop, in which n may be of any integral type.

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

splitAt n xs returns a tuple where first element is xs prefix of length n and second element is the remainder of the list:

splitAt 6 "Hello World!" == ("Hello ","World!")
splitAt 3 [1,2,3,4,5] == ([1,2,3],[4,5])
splitAt 1 [1,2,3] == ([1],[2,3])
splitAt 3 [1,2,3] == ([1,2,3],[])
splitAt 4 [1,2,3] == ([1,2,3],[])
splitAt 0 [1,2,3] == ([],[1,2,3])
splitAt (-1) [1,2,3] == ([],[1,2,3])

It is equivalent to (take n xs, drop n xs) when n is not _|_ (splitAt _|_ xs = _|_). splitAt is an instance of the more general genericSplitAt, in which n may be of any integral type.

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

takeWhile, applied to a predicate p and a list xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p:

takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2]
takeWhile (< 9) [1,2,3] == [1,2,3]
takeWhile (< 0) [1,2,3] == []

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

dropWhile p xs returns the suffix remaining after takeWhile p xs:

dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]
dropWhile (< 9) [1,2,3] == []
dropWhile (< 0) [1,2,3] == [1,2,3]

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

span, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that satisfy p and second element is the remainder of the list:

span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
span (< 9) [1,2,3] == ([1,2,3],[])
span (< 0) [1,2,3] == ([],[1,2,3])

span p xs is equivalent to (takeWhile p xs, dropWhile p xs)

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

break, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that do not satisfy p and second element is the remainder of the list:

break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
break (< 9) [1,2,3] == ([],[1,2,3])
break (> 9) [1,2,3] == ([1,2,3],[])

break p is equivalent to span (not . p).

Searching lists

notElem :: (Foldable t, Eq a) => a -> t a -> Bool infix 4 Source

notElem is the negation of elem.

lookup :: Eq a => a -> [(a, b)] -> Maybe b Source

lookup key assocs looks up a key in an association list.

Zipping and unzipping lists

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

zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded.

zip is right-lazy:

zip [] _|_ = []

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

zip3 takes three lists and returns a list of triples, analogous to zip.

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

zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. For example, zipWith (+) is applied to two lists to produce the list of corresponding sums.

zipWith is right-lazy:

zipWith f [] _|_ = []

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

The zipWith3 function takes a function which combines three elements, as well as three lists and returns a list of their point-wise combination, analogous to zipWith.

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

unzip transforms a list of pairs into a list of first components and a list of second components.

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

The unzip3 function takes a list of triples and returns three lists, analogous to unzip.

Functions on strings

lines :: String -> [String] Source

lines breaks a string up into a list of strings at newline characters. The resulting strings do not contain newlines.

Note that after splitting the string at newline characters, the last part of the string is considered a line even if it doesn't end with a newline. For example,

lines "" == []
lines "\n" == [""]
lines "one" == ["one"]
lines "one\n" == ["one"]
lines "one\n\n" == ["one",""]
lines "one\ntwo" == ["one","two"]
lines "one\ntwo\n" == ["one","two"]

Thus lines s contains at least as many elements as newlines in s.

words :: String -> [String] Source

words breaks a string up into a list of words, which were delimited by white space.

unlines :: [String] -> String Source

unlines is an inverse operation to lines. It joins lines, after appending a terminating newline to each.

unwords :: [String] -> String Source

unwords is an inverse operation to words. It joins words with separating spaces.

Converting to and from String

Converting to String

type ShowS = String -> String Source

The shows functions return a function that prepends the output String to an existing String. This allows constant-time concatenation of results using function composition.

class Show a where Source

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 show is 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 showsPrec will produce infix applications of the constructor.
  • the representation will be enclosed in parentheses if the precedence of the top-level constructor in x is less than d (associativity is ignored). Thus, if d is 0 then the result is never surrounded in parentheses; if d is 11 it is always surrounded in parentheses, unless it is an atomic expression.
  • If the constructor is defined using record syntax, then show will 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 = 5

Note that right-associativity of :^: is ignored. For example,

  • show (Leaf 1 :^: Leaf 2 :^: Leaf 3) produces the string "Leaf 1 :^: (Leaf 2 :^: Leaf 3)".

Minimal complete definition

showsPrec | show

Methods

showsPrec :: Int -> a -> ShowS Source

Convert a value to a readable String.

showsPrec should satisfy the law

showsPrec d x r ++ s  ==  showsPrec d x (r ++ s)

Derived instances of Read and Show satisfy the following:

That is, readsPrec parses the string produced by showsPrec, and delivers the value that showsPrec started with.

show :: a -> String Source

A specialised variant of showsPrec, using precedence context zero, and returning an ordinary String.

showList :: [a] -> ShowS Source

The method showList is provided to allow the programmer to give a specialised way of showing lists of values. For example, this is used by the predefined Show instance of the Char type, where values of type String should be shown in double quotes, rather than between square brackets.

Instances

Show Bool 
Show Char 
Show Int 
Show Int8 
Show Int16 
Show Int32 
Show Int64 
Show Integer 
Show Ordering 
Show Word 
Show Word8 
Show Word16 
Show Word32 
Show Word64 
Show TypeRep 
Show () 

Methods

showsPrec :: Int -> () -> ShowS Source

show :: () -> String Source

showList :: [()] -> ShowS Source

Show TyCon 
Show Module 
Show TrName 
Show SomeException 
Show GeneralCategory 
Show Number 
Show Lexeme 
Show SomeSymbol 
Show SomeNat 
Show DecidedStrictness 
Show SourceStrictness 
Show SourceUnpackedness 
Show Associativity 
Show Fixity 
Show Any 
Show All 
Show IOMode 
Show Fingerprint 
Show ArithException 
Show ErrorCall 
Show Dynamic 
Show IOException 
Show MaskingState 
Show CUIntMax 
Show CIntMax 
Show CUIntPtr 
Show CIntPtr 
Show CSUSeconds 
Show CUSeconds 
Show CTime 
Show CClock 
Show CSigAtomic 
Show CWchar 
Show CSize 
Show CPtrdiff 
Show CDouble 
Show CFloat 
Show CULLong 
Show CLLong 
Show CULong 
Show CLong 
Show CUInt 
Show CInt 
Show CUShort 
Show CShort 
Show CUChar 
Show CSChar 
Show CChar 
Show IntPtr 
Show WordPtr 
Show CodingProgress 
Show TextEncoding 
Show SeekMode 
Show NewlineMode 
Show Newline 
Show BufferMode 
Show Handle 
Show IOErrorType 
Show ExitCode 
Show ArrayException 
Show AsyncException 
Show SomeAsyncException 
Show AssertionFailed 
Show AllocationLimitExceeded 
Show Deadlock 
Show BlockedIndefinitelyOnSTM 
Show BlockedIndefinitelyOnMVar 
Show Fd 
Show CRLim 
Show CTcflag 
Show CSpeed 
Show CCc 
Show CUid 
Show CNlink 
Show CGid 
Show CSsize 
Show CPid 
Show COff 
Show CMode 
Show CIno 
Show CDev 
Show Lifetime 
Show Event 
Show CodingFailureMode 
Show ThreadStatus 
Show BlockReason 
Show ThreadId 
Show NestedAtomically 
Show NonTermination 
Show TypeError 
Show NoMethodError 
Show RecUpdError 
Show RecConError 
Show RecSelError 
Show PatternMatchFail 
Show FdKey 
Show HandlePosn 
Show GCStats 
Show Version 
Show Fixity 
Show ConstrRep 
Show DataRep 
Show Constr 
Show DataType 
Show Natural 
Show RTSFlags 
Show TickyFlags 
Show TraceFlags 
Show DoTrace 
Show ProfFlags 
Show DoHeapProfile 
Show CCFlags 
Show DoCostCentres 
Show DebugFlags 
Show MiscFlags 
Show ConcFlags 
Show GCFlags 
Show GiveGCStats 
Show StaticPtrInfo 
Show Void 
Show a => Show [a] 

Methods

showsPrec :: Int -> [a] -> ShowS Source

show :: [a] -> String Source

showList :: [[a]] -> ShowS Source

Show a => Show (Maybe a) 
Show a => Show (Ratio a) 
Show (Ptr a) 

Methods

showsPrec :: Int -> Ptr a -> ShowS Source

show :: Ptr a -> String Source

showList :: [Ptr a] -> ShowS Source

Show (FunPtr a) 
Show (U1 p) 

Methods

showsPrec :: Int -> U1 p -> ShowS Source

show :: U1 p -> String Source

showList :: [U1 p] -> ShowS Source

Show p => Show (Par1 p) 
Show a => Show (Down a) 
Show a => Show (Last a) 
Show a => Show (First a) 
Show a => Show (Product a) 
Show a => Show (Sum a) 

Methods

showsPrec :: Int -> Sum a -> ShowS Source

show :: Sum a -> String Source

showList :: [Sum a] -> ShowS Source

Show a => Show (Dual a) 
Show (ForeignPtr a) 
Show a => Show (ZipList a) 
Show a => Show (Complex a) 
HasResolution a => Show (Fixed a) 
Show a => Show (NonEmpty a) 
Show a => Show (Option a) 
Show m => Show (WrappedMonoid m) 
Show a => Show (Last a) 
Show a => Show (First a) 
Show a => Show (Max a) 

Methods

showsPrec :: Int -> Max a -> ShowS Source

show :: Max a -> String Source

showList :: [Max a] -> ShowS Source

Show a => Show (Min a) 

Methods

showsPrec :: Int -> Min a -> ShowS Source

show :: Min a -> String Source

showList :: [Min a] -> ShowS Source

Show a => Show (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

(Show a, Show b) => Show (Either a b) 

Methods

showsPrec :: Int -> Either a b -> ShowS Source

show :: Either a b -> String Source

showList :: [Either a b] -> ShowS Source

Show (f p) => Show (Rec1 f p) 

Methods

showsPrec :: Int -> Rec1 f p -> ShowS Source

show :: Rec1 f p -> String Source

showList :: [Rec1 f p] -> ShowS Source

Show (URec Char p) 
Show (URec Double p) 
Show (URec Float p) 
Show (URec Int p) 
Show (URec Word p) 
(Show a, Show b) => Show (a, b) 

Methods

showsPrec :: Int -> (a, b) -> ShowS Source

show :: (a, b) -> String Source

showList :: [(a, b)] -> ShowS Source

Show (ST s a) 

Methods

showsPrec :: Int -> ST s a -> ShowS Source

show :: ST s a -> String Source

showList :: [ST s a] -> ShowS Source

Show (Proxy k s) 

Methods

showsPrec :: Int -> Proxy k s -> ShowS Source

show :: Proxy k s -> String Source

showList :: [Proxy k s] -> ShowS Source

(Show a, Show b) => Show (Arg a b) 

Methods

showsPrec :: Int -> Arg a b -> ShowS Source

show :: Arg a b -> String Source

showList :: [Arg a b] -> ShowS Source

Show c => Show (K1 i c p) 

Methods

showsPrec :: Int -> K1 i c p -> ShowS Source

show :: K1 i c p -> String Source

showList :: [K1 i c p] -> ShowS Source

(Show (f p), Show (g p)) => Show ((:+:) f g p) 

Methods

showsPrec :: Int -> (f :+: g) p -> ShowS Source

show :: (f :+: g) p -> String Source

showList :: [(f :+: g) p] -> ShowS Source

(Show (f p), Show (g p)) => Show ((:*:) f g p) 

Methods

showsPrec :: Int -> (f :*: g) p -> ShowS Source

show :: (f :*: g) p -> String Source

showList :: [(f :*: g) p] -> ShowS Source

Show (f (g p)) => Show ((:.:) f g p) 

Methods

showsPrec :: Int -> (f :.: g) p -> ShowS Source

show :: (f :.: g) p -> String Source

showList :: [(f :.: g) p] -> ShowS Source

(Show a, Show b, Show c) => Show (a, b, c) 

Methods

showsPrec :: Int -> (a, b, c) -> ShowS Source

show :: (a, b, c) -> String Source

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

Show ((:~:) k a b) 

Methods

showsPrec :: Int -> (k :~: a) b -> ShowS Source

show :: (k :~: a) b -> String Source

showList :: [(k :~: a) b] -> ShowS Source

Show (Coercion k a b) 

Methods

showsPrec :: Int -> Coercion k a b -> ShowS Source

show :: Coercion k a b -> String Source

showList :: [Coercion k a b] -> ShowS Source

Show (f a) => Show (Alt k f a) 

Methods

showsPrec :: Int -> Alt k f a -> ShowS Source

show :: Alt k f a -> String Source

showList :: [Alt k f a] -> ShowS Source

Show a => Show (Const k a b)

This instance would be equivalent to the derived instances of the Const newtype if the runConst field were removed

Methods

showsPrec :: Int -> Const k a b -> ShowS Source

show :: Const k a b -> String Source

showList :: [Const k a b] -> ShowS Source

Show (f p) => Show (M1 i c f p) 

Methods

showsPrec :: Int -> M1 i c f p -> ShowS Source

show :: M1 i c f p -> String Source

showList :: [M1 i c f p] -> ShowS Source

(Show a, Show b, Show c, Show d) => Show (a, b, c, d) 

Methods

showsPrec :: Int -> (a, b, c, d) -> ShowS Source

show :: (a, b, c, d) -> String Source

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

(Show1 f, Show1 g, Show a) => Show (Product (TYPE Lifted) f g a) 
(Show1 f, Show1 g, Show a) => Show (Sum (TYPE Lifted) f g a) 

Methods

showsPrec :: Int -> Sum (TYPE Lifted) f g a -> ShowS Source

show :: Sum (TYPE Lifted) f g a -> String Source

showList :: [Sum (TYPE Lifted) f g a] -> ShowS Source

(Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) 

Methods

showsPrec :: Int -> (a, b, c, d, e) -> ShowS Source

show :: (a, b, c, d, e) -> String Source

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

(Show1 f, Show1 g, Show a) => Show (Compose (TYPE Lifted) (TYPE Lifted) f g a) 
(Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) 

Methods

showsPrec :: Int -> (a, b, c, d, e, f) -> ShowS Source

show :: (a, b, c, d, e, f) -> String Source

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

(Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) 

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g) -> ShowS Source

show :: (a, b, c, d, e, f, g) -> String Source

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

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h) -> ShowS Source

show :: (a, b, c, d, e, f, g, h) -> String Source

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

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i)] -> ShowS Source

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i, j) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i, j) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i, j)] -> ShowS Source

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i, j, k) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> ShowS Source

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i, j, k, l) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> ShowS Source

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> ShowS Source

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> ShowS Source

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

Methods

showsPrec :: Int -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> ShowS Source

show :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> String Source

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> ShowS Source

shows :: Show a => a -> ShowS Source

equivalent to showsPrec with a precedence of 0.

showChar :: Char -> ShowS Source

utility function converting a Char to a show function that simply prepends the character unchanged.

showString :: String -> ShowS Source

utility function converting a String to a show function that simply prepends the string unchanged.

showParen :: Bool -> ShowS -> ShowS Source

utility function that surrounds the inner show function with parentheses when the Bool parameter is True.

Converting from String

type ReadS a = String -> [(a, String)] Source

A parser for a type a, represented as a function that takes a String and returns a list of possible parses as (a,String) pairs.

Note that this kind of backtracking parser is very inefficient; reading a large structure may be quite slow (cf ReadP).

class Read a where Source

Parsing of Strings, producing values.

Derived instances of Read make the following assumptions, which derived instances of Show obey:

  • If the constructor is defined to be an infix operator, then the derived Read instance will parse only infix applications of the constructor (not the prefix form).
  • Associativity is not used to reduce the occurrence of parentheses, although precedence may be.
  • If the constructor is defined using record syntax, the derived Read will parse only the record-syntax form, and furthermore, the fields must be given in the same order as the original declaration.
  • The derived Read instance allows arbitrary Haskell whitespace between tokens of the input string. Extra parentheses are also allowed.

For example, given the declarations

infixr 5 :^:
data Tree a =  Leaf a  |  Tree a :^: Tree a

the derived instance of Read in Haskell 2010 is equivalent to

instance (Read a) => Read (Tree a) where

        readsPrec d r =  readParen (d > app_prec)
                         (\r -> [(Leaf m,t) |
                                 ("Leaf",s) <- lex r,
                                 (m,t) <- readsPrec (app_prec+1) s]) r

                      ++ readParen (d > up_prec)
                         (\r -> [(u:^:v,w) |
                                 (u,s) <- readsPrec (up_prec+1) r,
                                 (":^:",t) <- lex s,
                                 (v,w) <- readsPrec (up_prec+1) t]) r

          where app_prec = 10
                up_prec = 5

Note that right-associativity of :^: is unused.

The derived instance in GHC is equivalent to

instance (Read a) => Read (Tree a) where

        readPrec = parens $ (prec app_prec $ do
                                 Ident "Leaf" <- lexP
                                 m <- step readPrec
                                 return (Leaf m))

                     +++ (prec up_prec $ do
                                 u <- step readPrec
                                 Symbol ":^:" <- lexP
                                 v <- step readPrec
                                 return (u :^: v))

          where app_prec = 10
                up_prec = 5

        readListPrec = readListPrecDefault

Minimal complete definition

readsPrec | readPrec

Methods

readsPrec :: Int -> ReadS a Source

attempts to parse a value from the front of the string, returning a list of (parsed value, remaining string) pairs. If there is no successful parse, the returned list is empty.

Derived instances of Read and Show satisfy the following:

That is, readsPrec parses the string produced by showsPrec, and delivers the value that showsPrec started with.

readList :: ReadS [a] Source

The method readList is provided to allow the programmer to give a specialised way of parsing lists of values. For example, this is used by the predefined Read instance of the Char type, where values of type String should be are expected to use double quotes, rather than square brackets.

Instances

Read Bool 
Read Char 
Read Double 
Read Float 
Read Int 
Read Int8 
Read Int16 
Read Int32 
Read Int64 
Read Integer 
Read Ordering 
Read Word 
Read Word8 
Read Word16 
Read Word32 
Read Word64 
Read () 
Read GeneralCategory 
Read Lexeme 
Read SomeSymbol 
Read SomeNat 
Read DecidedStrictness 
Read SourceStrictness 
Read SourceUnpackedness 
Read Associativity 
Read Fixity 
Read Any 
Read All 
Read IOMode 
Read CUIntMax 
Read CIntMax 
Read CUIntPtr 
Read CIntPtr 
Read CSUSeconds 
Read CUSeconds 
Read CTime 
Read CClock 
Read CSigAtomic 
Read CWchar 
Read CSize 
Read CPtrdiff 
Read CDouble 
Read CFloat 
Read CULLong 
Read CLLong 
Read CULong 
Read CLong 
Read CUInt 
Read CInt 
Read CUShort 
Read CShort 
Read CUChar 
Read CSChar 
Read CChar 
Read IntPtr 
Read WordPtr 
Read SeekMode 
Read NewlineMode 
Read Newline 
Read BufferMode 
Read ExitCode 
Read Fd 
Read CRLim 
Read CTcflag 
Read CSpeed 
Read CCc 
Read CUid 
Read CNlink 
Read CGid 
Read CSsize 
Read CPid 
Read COff 
Read CMode 
Read CIno 
Read CDev 
Read GCStats 
Read Version 
Read Natural 
Read Void

Reading a Void value is always a parse error, considering Void as a data type with no constructors.

Read a => Read [a] 
Read a => Read (Maybe a) 
(Integral a, Read a) => Read (Ratio a) 
Read (U1 p) 
Read p => Read (Par1 p) 
Read a => Read (Down a) 
Read a => Read (Last a) 
Read a => Read (First a) 
Read a => Read (Product a) 
Read a => Read (Sum a) 
Read a => Read (Dual a) 
Read a => Read (ZipList a) 
Read a => Read (Complex a) 
HasResolution a => Read (Fixed a) 
Read a => Read (NonEmpty a) 
Read a => Read (Option a) 
Read m => Read (WrappedMonoid m) 
Read a => Read (Last a) 
Read a => Read (First a) 
Read a => Read (Max a) 
Read a => Read (Min a) 
Read a => Read (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

(Read a, Read b) => Read (Either a b) 
Read (f p) => Read (Rec1 f p) 
(Read a, Read b) => Read (a, b) 

Methods

readsPrec :: Int -> ReadS (a, b) Source

readList :: ReadS [(a, b)] Source

readPrec :: ReadPrec (a, b) Source

readListPrec :: ReadPrec [(a, b)] Source

Read (Proxy k s) 
(Read a, Read b) => Read (Arg a b) 
Read c => Read (K1 i c p) 

Methods

readsPrec :: Int -> ReadS (K1 i c p) Source

readList :: ReadS [K1 i c p] Source

readPrec :: ReadPrec (K1 i c p) Source

readListPrec :: ReadPrec [K1 i c p] Source

(Read (f p), Read (g p)) => Read ((:+:) f g p) 

Methods

readsPrec :: Int -> ReadS ((f :+: g) p) Source

readList :: ReadS [(f :+: g) p] Source

readPrec :: ReadPrec ((f :+: g) p) Source

readListPrec :: ReadPrec [(f :+: g) p] Source

(Read (f p), Read (g p)) => Read ((:*:) f g p) 

Methods

readsPrec :: Int -> ReadS ((f :*: g) p) Source

readList :: ReadS [(f :*: g) p] Source

readPrec :: ReadPrec ((f :*: g) p) Source

readListPrec :: ReadPrec [(f :*: g) p] Source

Read (f (g p)) => Read ((:.:) f g p) 

Methods

readsPrec :: Int -> ReadS ((f :.: g) p) Source

readList :: ReadS [(f :.: g) p] Source

readPrec :: ReadPrec ((f :.: g) p) Source

readListPrec :: ReadPrec [(f :.: g) p] Source

(Read a, Read b, Read c) => Read (a, b, c) 

Methods

readsPrec :: Int -> ReadS (a, b, c) Source

readList :: ReadS [(a, b, c)] Source

readPrec :: ReadPrec (a, b, c) Source

readListPrec :: ReadPrec [(a, b, c)] Source

(~) k a b => Read ((:~:) k a b) 

Methods

readsPrec :: Int -> ReadS ((k :~: a) b) Source

readList :: ReadS [(k :~: a) b] Source

readPrec :: ReadPrec ((k :~: a) b) Source

readListPrec :: ReadPrec [(k :~: a) b] Source

Coercible k a b => Read (Coercion k a b) 
Read (f a) => Read (Alt k f a) 
Read a => Read (Const k a b)

This instance would be equivalent to the derived instances of the Const newtype if the runConst field were removed

Read (f p) => Read (M1 i c f p) 

Methods

readsPrec :: Int -> ReadS (M1 i c f p) Source

readList :: ReadS [M1 i c f p] Source

readPrec :: ReadPrec (M1 i c f p) Source

readListPrec :: ReadPrec [M1 i c f p] Source

(Read a, Read b, Read c, Read d) => Read (a, b, c, d) 

Methods

readsPrec :: Int -> ReadS (a, b, c, d) Source

readList :: ReadS [(a, b, c, d)] Source

readPrec :: ReadPrec (a, b, c, d) Source

readListPrec :: ReadPrec [(a, b, c, d)] Source

(Read1 f, Read1 g, Read a) => Read (Product (TYPE Lifted) f g a) 
(Read1 f, Read1 g, Read a) => Read (Sum (TYPE Lifted) f g a) 
(Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e) 

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e) Source

readList :: ReadS [(a, b, c, d, e)] Source

readPrec :: ReadPrec (a, b, c, d, e) Source

readListPrec :: ReadPrec [(a, b, c, d, e)] Source

(Read1 f, Read1 g, Read a) => Read (Compose (TYPE Lifted) (TYPE Lifted) f g a) 
(Read a, Read b, Read c, Read d, Read e, Read f) => Read (a, b, c, d, e, f) 

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f) Source

readList :: ReadS [(a, b, c, d, e, f)] Source

readPrec :: ReadPrec (a, b, c, d, e, f) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f)] Source

(Read a, Read b, Read c, Read d, Read e, Read f, Read g) => Read (a, b, c, d, e, f, g) 

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g) Source

readList :: ReadS [(a, b, c, d, e, f, g)] Source

readPrec :: ReadPrec (a, b, c, d, e, f, g) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f, g)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h) Source

readList :: ReadS [(a, b, c, d, e, f, g, h)] Source

readPrec :: ReadPrec (a, b, c, d, e, f, g, h) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i)] Source

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j)] Source

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k)] Source

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l)] Source

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l) Source

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l, m) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m)] Source

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

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] Source

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

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] Source

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] Source

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

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] Source

reads :: Read a => ReadS a Source

equivalent to readsPrec with a precedence of 0.

readParen :: Bool -> ReadS a -> ReadS a Source

readParen True p parses what p parses, but surrounded with parentheses.

readParen False p parses what p parses, but optionally surrounded with parentheses.

read :: Read a => String -> a Source

The read function reads input from a string, which must be completely consumed by the input process.

lex :: ReadS String Source

The lex function reads a single lexeme from the input, discarding initial white space, and returning the characters that constitute the lexeme. If the input string contains only white space, lex returns a single successful `lexeme' consisting of the empty string. (Thus lex "" = [("","")].) If there is no legal lexeme at the beginning of the input string, lex fails (i.e. returns []).

This lexer is not completely faithful to the Haskell lexical syntax in the following respects:

  • Qualified names are not handled properly
  • Octal and hexadecimal numerics are not recognized as a single token
  • Comments are not treated properly

Basic Input and output

data IO a :: TYPE Lifted -> TYPE Lifted Source

A value of type IO a is a computation which, when performed, does some I/O before returning a value of type a.

There is really only one way to "perform" an I/O action: bind it to Main.main in your program. When your program is run, the I/O will be performed. It isn't possible to perform I/O from an arbitrary function, unless that function is itself in the IO monad and called at some point, directly or indirectly, from Main.main.

IO is a monad, so IO actions can be combined using either the do-notation or the >> and >>= operations from the Monad class.

Instances

Monad IO 

Methods

(>>=) :: IO a -> (a -> IO b) -> IO b Source

(>>) :: IO a -> IO b -> IO b Source

return :: a -> IO a Source

fail :: String -> IO a Source

Functor IO 

Methods

fmap :: (a -> b) -> IO a -> IO b Source

(<$) :: a -> IO b -> IO a Source

MonadFix IO 

Methods

mfix :: (a -> IO a) -> IO a Source

MonadFail IO 

Methods

fail :: String -> IO a Source

Applicative IO 

Methods

pure :: a -> IO a Source

(<*>) :: IO (a -> b) -> IO a -> IO b Source

(*>) :: IO a -> IO b -> IO b Source

(<*) :: IO a -> IO b -> IO a Source

MonadPlus IO 

Methods

mzero :: IO a Source

mplus :: IO a -> IO a -> IO a Source

Alternative IO 

Methods

empty :: IO a Source

(<|>) :: IO a -> IO a -> IO a Source

some :: IO a -> IO [a] Source

many :: IO a -> IO [a] Source

MonadIO IO 

Methods

liftIO :: IO a -> IO a Source

Monoid a => Monoid (IO a) 

Methods

mempty :: IO a Source

mappend :: IO a -> IO a -> IO a Source

mconcat :: [IO a] -> IO a Source

(~) (TYPE Lifted) a () => HPrintfType (IO a) 

Methods

hspr :: Handle -> String -> [UPrintf] -> IO a

(~) (TYPE Lifted) a () => PrintfType (IO a) 

Methods

spr :: String -> [UPrintf] -> IO a

Simple I/O operations

Output functions

putChar :: Char -> IO () Source

Write a character to the standard output device (same as hPutChar stdout).

putStr :: String -> IO () Source

Write a string to the standard output device (same as hPutStr stdout).

putStrLn :: String -> IO () Source

The same as putStr, but adds a newline character.

print :: Show a => a -> IO () Source

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

Input functions

getChar :: IO Char Source

Read a character from the standard input device (same as hGetChar stdin).

getLine :: IO String Source

Read a line from the standard input device (same as hGetLine stdin).

getContents :: IO String Source

The getContents operation returns all user input as a single string, which is read lazily as it is needed (same as hGetContents stdin).

interact :: (String -> String) -> IO () Source

The interact function takes a function of type String->String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.

Files

type FilePath = String Source

File and directory names are values of type String, whose precise meaning is operating system dependent. Files can be opened, yielding a handle which can then be used to operate on the contents of that file.

readFile :: FilePath -> IO String Source

The readFile function reads a file and returns the contents of the file as a string. The file is read lazily, on demand, as with getContents.

writeFile :: FilePath -> String -> IO () Source

The computation writeFile file str function writes the string str, to the file file.

appendFile :: FilePath -> String -> IO () Source

The computation appendFile file str function appends the string str, to the file file.

Note that writeFile and appendFile write a literal string to a file. To write a value of any printable type, as with print, use the show function to convert the value to a string first.

main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])

readIO :: Read a => String -> IO a Source

The readIO function is similar to read except that it signals parse failure to the IO monad instead of terminating the program.

readLn :: Read a => IO a Source

The readLn function combines getLine and readIO.

Exception handling in the I/O monad

type IOError = IOException Source

The Haskell 2010 type for exceptions in the IO monad. Any I/O operation may raise an IOError instead of returning a result. For a more general type of exception, including also those that arise in pure code, see Exception.

In Haskell 2010, this is an opaque type.

ioError :: IOError -> IO a Source

Raise an IOError in the IO monad.

userError :: String -> IOError Source

Construct an IOError value with a string describing the error. The fail method of the IO instance of the Monad class raises a userError, thus:

instance Monad IO where
  ...
  fail s = ioError (userError s)