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

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

toConstr :: Bool -> Constr

dataTypeOf :: Bool -> DataType

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

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

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

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

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

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

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

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

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

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

Ord Bool 
Read Bool 
Show Bool 

Methods

showsPrec :: Int -> Bool -> ShowS

show :: Bool -> String

showList :: [Bool] -> ShowS

Ix Bool 

Methods

range :: (Bool, Bool) -> [Bool]

index :: (Bool, Bool) -> Bool -> Int

unsafeIndex :: (Bool, Bool) -> Bool -> Int

inRange :: (Bool, Bool) -> Bool -> Bool

rangeSize :: (Bool, Bool) -> Int

unsafeRangeSize :: (Bool, Bool) -> Int

Generic Bool 

Associated Types

type Rep Bool :: * -> *

Methods

from :: Bool -> Rep Bool x

to :: Rep Bool x -> Bool

FiniteBits Bool 
Bits Bool 
Storable Bool 

Methods

sizeOf :: Bool -> Int

alignment :: Bool -> Int

peekElemOff :: Ptr Bool -> Int -> IO Bool

pokeElemOff :: Ptr Bool -> Int -> Bool -> IO ()

peekByteOff :: Ptr b -> Int -> IO Bool

pokeByteOff :: Ptr b -> Int -> Bool -> IO ()

peek :: Ptr Bool -> IO Bool

poke :: Ptr Bool -> Bool -> IO ()

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

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

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

data Maybe a

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

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

return :: a -> Maybe a

fail :: String -> Maybe a

Functor Maybe 

Methods

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

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

MonadFix Maybe 

Methods

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

MonadFail Maybe 

Methods

fail :: String -> Maybe a

Applicative Maybe 

Methods

pure :: a -> Maybe a

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

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

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

Foldable Maybe 

Methods

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

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

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

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

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

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

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

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

toList :: Maybe a -> [a]

null :: Maybe a -> Bool

length :: Maybe a -> Int

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

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

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

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

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

Traversable Maybe 

Methods

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

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

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

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

Generic1 Maybe 

Associated Types

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

Methods

from1 :: Maybe a -> Rep1 Maybe a

to1 :: Rep1 Maybe a -> Maybe a

MonadPlus Maybe 

Methods

mzero :: Maybe a

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

Alternative Maybe 

Methods

empty :: Maybe a

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

some :: Maybe a -> Maybe [a]

many :: Maybe a -> Maybe [a]

MonadZip Maybe 

Methods

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

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

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

Show1 Maybe 

Methods

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

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

Read1 Maybe 

Methods

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

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

Ord1 Maybe 

Methods

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

Eq1 Maybe 

Methods

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

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)

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

toConstr :: Maybe a -> Constr

dataTypeOf :: Maybe a -> DataType

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

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

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

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

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

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

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

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

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

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

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) 

Methods

showsPrec :: Int -> Maybe a -> ShowS

show :: Maybe a -> String

showList :: [Maybe a] -> ShowS

Generic (Maybe a) 

Associated Types

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

Methods

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

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

Semigroup a => Semigroup (Maybe a) 

Methods

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

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

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

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

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

mconcat :: [Maybe a] -> Maybe a

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

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

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

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

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

Show2 Either 

Methods

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

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

Read2 Either 

Methods

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

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

Ord2 Either 

Methods

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

Eq2 Either 

Methods

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

Monad (Either e) 

Methods

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

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

return :: a -> Either e a

fail :: String -> Either e a

Functor (Either a) 

Methods

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

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

MonadFix (Either e) 

Methods

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

Applicative (Either e) 

Methods

pure :: a -> Either e a

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

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

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

Foldable (Either a) 

Methods

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

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

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

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

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

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

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

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

toList :: Either a a -> [a]

null :: Either a a -> Bool

length :: Either a a -> Int

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

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

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

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

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

Traversable (Either a) 

Methods

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

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

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

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

Generic1 (Either a) 

Associated Types

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

Methods

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

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

Show a => Show1 (Either a) 

Methods

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

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

Read a => Read1 (Either a) 

Methods

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

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

Ord a => Ord1 (Either a) 

Methods

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

Eq a => Eq1 (Either a) 

Methods

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

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

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

toConstr :: Either a b -> Constr

dataTypeOf :: Either a b -> DataType

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

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

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

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

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

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

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

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

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

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

(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

show :: Either a b -> String

showList :: [Either a b] -> ShowS

Generic (Either a b) 

Associated Types

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

Methods

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

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

Semigroup (Either a b) 

Methods

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

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

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

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

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

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

toConstr :: Ordering -> Constr

dataTypeOf :: Ordering -> DataType

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

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

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

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

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

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

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

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

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

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

Ord Ordering 
Read Ordering 
Show Ordering 
Ix Ordering 
Generic Ordering 

Associated Types

type Rep Ordering :: * -> *

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

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

toConstr :: Char -> Constr

dataTypeOf :: Char -> DataType

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

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

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

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

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

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

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

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

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

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

Ord Char 
Read Char 
Show Char 

Methods

showsPrec :: Int -> Char -> ShowS

show :: Char -> String

showList :: [Char] -> ShowS

Ix Char 

Methods

range :: (Char, Char) -> [Char]

index :: (Char, Char) -> Char -> Int

unsafeIndex :: (Char, Char) -> Char -> Int

inRange :: (Char, Char) -> Char -> Bool

rangeSize :: (Char, Char) -> Int

unsafeRangeSize :: (Char, Char) -> Int

Storable Char 

Methods

sizeOf :: Char -> Int

alignment :: Char -> Int

peekElemOff :: Ptr Char -> Int -> IO Char

pokeElemOff :: Ptr Char -> Int -> Char -> IO ()

peekByteOff :: Ptr b -> Int -> IO Char

pokeByteOff :: Ptr b -> Int -> Char -> IO ()

peek :: Ptr Char -> IO Char

poke :: Ptr Char -> Char -> IO ()

IsChar Char 

Methods

toChar :: Char -> Char

fromChar :: Char -> 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) 

Methods

compare :: URec Char _p -> URec Char _p -> Ordering Source

(<) :: URec Char _p -> URec Char _p -> Bool Source

(<=) :: URec Char _p -> URec Char _p -> Bool Source

(>) :: URec Char _p -> URec Char _p -> Bool Source

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

max :: URec Char _p -> URec Char _p -> URec Char _p Source

min :: URec Char _p -> URec Char _p -> URec Char _p Source

Show (URec Char _p) 

Methods

showsPrec :: Int -> URec Char _p -> ShowS

show :: URec Char _p -> String

showList :: [URec Char _p] -> ShowS

Generic (URec Char _p) 

Associated Types

type Rep (URec Char _p) :: * -> *

Methods

from :: URec Char _p -> Rep (URec Char _p) x

to :: Rep (URec Char _p) x -> URec Char _p

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]

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

Tuples

fst :: (a, b) -> a

Extract the first component of a pair.

snd :: (a, b) -> b

Extract the second component of a pair.

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

curry converts an uncurried function to a curried function.

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

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 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 ArithException 
Eq ErrorCall 
Eq IOException 
Eq MaskingState 
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) 

Methods

(==) :: URec Double _p -> URec Double _p -> Bool Source

(/=) :: URec Double _p -> URec Double _p -> Bool Source

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 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 ArithException 
Ord ErrorCall 
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) 

Methods

compare :: URec Char _p -> URec Char _p -> Ordering Source

(<) :: URec Char _p -> URec Char _p -> Bool Source

(<=) :: URec Char _p -> URec Char _p -> Bool Source

(>) :: URec Char _p -> URec Char _p -> Bool Source

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

max :: URec Char _p -> URec Char _p -> URec Char _p Source

min :: URec Char _p -> URec Char _p -> URec Char _p Source

Ord (URec Double _p) 
Ord (URec Float _p) 

Methods

compare :: URec Float _p -> URec Float _p -> Ordering Source

(<) :: URec Float _p -> URec Float _p -> Bool Source

(<=) :: URec Float _p -> URec Float _p -> Bool Source

(>) :: URec Float _p -> URec Float _p -> Bool Source

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

max :: URec Float _p -> URec Float _p -> URec Float _p Source

min :: URec Float _p -> URec Float _p -> URec Float _p 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

Ord (URec Word _p) 

Methods

compare :: URec Word _p -> URec Word _p -> Ordering Source

(<) :: URec Word _p -> URec Word _p -> Bool Source

(<=) :: URec Word _p -> URec Word _p -> Bool Source

(>) :: URec Word _p -> URec Word _p -> Bool Source

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

max :: URec Word _p -> URec Word _p -> URec Word _p Source

min :: URec Word _p -> URec Word _p -> URec Word _p Source

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

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

the successor of a value. For numeric types, succ adds 1.

pred :: a -> a

the predecessor of a value. For numeric types, pred subtracts 1.

toEnum :: Int -> a

Convert from an Int.

fromEnum :: a -> Int

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]

Used in Haskell's translation of [n..].

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

Used in Haskell's translation of [n,n'..].

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

Used in Haskell's translation of [n..m].

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

Used in Haskell's translation of [n,n'..m].

Instances

Enum Bool 
Enum Char 
Enum Int 

Methods

succ :: Int -> Int

pred :: Int -> Int

toEnum :: Int -> Int

fromEnum :: Int -> Int

enumFrom :: Int -> [Int]

enumFromThen :: Int -> Int -> [Int]

enumFromTo :: Int -> Int -> [Int]

enumFromThenTo :: Int -> Int -> Int -> [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 :: () -> ()

pred :: () -> ()

toEnum :: Int -> ()

fromEnum :: () -> Int

enumFrom :: () -> [()]

enumFromThen :: () -> () -> [()]

enumFromTo :: () -> () -> [()]

enumFromThenTo :: () -> () -> () -> [()]

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 

Methods

succ :: Fd -> Fd

pred :: Fd -> Fd

toEnum :: Int -> Fd

fromEnum :: Fd -> Int

enumFrom :: Fd -> [Fd]

enumFromThen :: Fd -> Fd -> [Fd]

enumFromTo :: Fd -> Fd -> [Fd]

enumFromThenTo :: Fd -> Fd -> Fd -> [Fd]

Enum CRLim 
Enum CTcflag 
Enum CSpeed 
Enum CCc 

Methods

succ :: CCc -> CCc

pred :: CCc -> CCc

toEnum :: Int -> CCc

fromEnum :: CCc -> Int

enumFrom :: CCc -> [CCc]

enumFromThen :: CCc -> CCc -> [CCc]

enumFromTo :: CCc -> CCc -> [CCc]

enumFromThenTo :: CCc -> CCc -> CCc -> [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) 

Methods

succ :: Ratio a -> Ratio a

pred :: Ratio a -> Ratio a

toEnum :: Int -> Ratio a

fromEnum :: Ratio a -> Int

enumFrom :: Ratio a -> [Ratio a]

enumFromThen :: Ratio a -> Ratio a -> [Ratio a]

enumFromTo :: Ratio a -> Ratio a -> [Ratio a]

enumFromThenTo :: Ratio a -> Ratio a -> Ratio a -> [Ratio a]

Enum (Fixed a) 

Methods

succ :: Fixed a -> Fixed a

pred :: Fixed a -> Fixed a

toEnum :: Int -> Fixed a

fromEnum :: Fixed a -> Int

enumFrom :: Fixed a -> [Fixed a]

enumFromThen :: Fixed a -> Fixed a -> [Fixed a]

enumFromTo :: Fixed a -> Fixed a -> [Fixed a]

enumFromThenTo :: Fixed a -> Fixed a -> Fixed a -> [Fixed a]

Enum a => Enum (WrappedMonoid a) 
Enum a => Enum (Last a) 

Methods

succ :: Last a -> Last a

pred :: Last a -> Last a

toEnum :: Int -> Last a

fromEnum :: Last a -> Int

enumFrom :: Last a -> [Last a]

enumFromThen :: Last a -> Last a -> [Last a]

enumFromTo :: Last a -> Last a -> [Last a]

enumFromThenTo :: Last a -> Last a -> Last a -> [Last a]

Enum a => Enum (First a) 

Methods

succ :: First a -> First a

pred :: First a -> First a

toEnum :: Int -> First a

fromEnum :: First a -> Int

enumFrom :: First a -> [First a]

enumFromThen :: First a -> First a -> [First a]

enumFromTo :: First a -> First a -> [First a]

enumFromThenTo :: First a -> First a -> First a -> [First a]

Enum a => Enum (Max a) 

Methods

succ :: Max a -> Max a

pred :: Max a -> Max a

toEnum :: Int -> Max a

fromEnum :: Max a -> Int

enumFrom :: Max a -> [Max a]

enumFromThen :: Max a -> Max a -> [Max a]

enumFromTo :: Max a -> Max a -> [Max a]

enumFromThenTo :: Max a -> Max a -> Max a -> [Max a]

Enum a => Enum (Min a) 

Methods

succ :: Min a -> Min a

pred :: Min a -> Min a

toEnum :: Int -> Min a

fromEnum :: Min a -> Int

enumFrom :: Min a -> [Min a]

enumFromThen :: Min a -> Min a -> [Min a]

enumFromTo :: Min a -> Min a -> [Min a]

enumFromThenTo :: Min a -> Min a -> Min a -> [Min a]

Enum a => Enum (Identity a) 
Enum (Proxy k s) 

Methods

succ :: Proxy k s -> Proxy k s

pred :: Proxy k s -> Proxy k s

toEnum :: Int -> Proxy k s

fromEnum :: Proxy k s -> Int

enumFrom :: Proxy k s -> [Proxy k s]

enumFromThen :: Proxy k s -> Proxy k s -> [Proxy k s]

enumFromTo :: Proxy k s -> Proxy k s -> [Proxy k s]

enumFromThenTo :: Proxy k s -> Proxy k s -> Proxy k s -> [Proxy k s]

(~) k a b => Enum ((:~:) k a b) 

Methods

succ :: (k :~: a) b -> (k :~: a) b

pred :: (k :~: a) b -> (k :~: a) b

toEnum :: Int -> (k :~: a) b

fromEnum :: (k :~: a) b -> Int

enumFrom :: (k :~: a) b -> [(k :~: a) b]

enumFromThen :: (k :~: a) b -> (k :~: a) b -> [(k :~: a) b]

enumFromTo :: (k :~: a) b -> (k :~: a) b -> [(k :~: a) b]

enumFromThenTo :: (k :~: a) b -> (k :~: a) b -> (k :~: a) b -> [(k :~: a) b]

Coercible k a b => Enum (Coercion k a b) 

Methods

succ :: Coercion k a b -> Coercion k a b

pred :: Coercion k a b -> Coercion k a b

toEnum :: Int -> Coercion k a b

fromEnum :: Coercion k a b -> Int

enumFrom :: Coercion k a b -> [Coercion k a b]

enumFromThen :: Coercion k a b -> Coercion k a b -> [Coercion k a b]

enumFromTo :: Coercion k a b -> Coercion k a b -> [Coercion k a b]

enumFromThenTo :: Coercion k a b -> Coercion k a b -> Coercion k a b -> [Coercion k a b]

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

Methods

succ :: Alt k f a -> Alt k f a

pred :: Alt k f a -> Alt k f a

toEnum :: Int -> Alt k f a

fromEnum :: Alt k f a -> Int

enumFrom :: Alt k f a -> [Alt k f a]

enumFromThen :: Alt k f a -> Alt k f a -> [Alt k f a]

enumFromTo :: Alt k f a -> Alt k f a -> [Alt k f a]

enumFromThenTo :: Alt k f a -> Alt k f a -> Alt k f a -> [Alt k f a]

Enum a => Enum (Const k a b) 

Methods

succ :: Const k a b -> Const k a b

pred :: Const k a b -> Const k a b

toEnum :: Int -> Const k a b

fromEnum :: Const k a b -> Int

enumFrom :: Const k a b -> [Const k a b]

enumFromThen :: Const k a b -> Const k a b -> [Const k a b]

enumFromTo :: Const k a b -> Const k a b -> [Const k a b]

enumFromThenTo :: Const k a b -> Const k a b -> Const k a b -> [Const k a b]

class Bounded a where

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

Instances

Bounded Bool 
Bounded Char 
Bounded Int 

Methods

minBound :: Int

maxBound :: Int

Bounded Int8 
Bounded Int16 
Bounded Int32 
Bounded Int64 
Bounded Ordering 
Bounded Word 
Bounded Word8 
Bounded Word16 
Bounded Word32 
Bounded Word64 
Bounded () 

Methods

minBound :: ()

maxBound :: ()

Bounded GeneralCategory 
Bounded Any 

Methods

minBound :: Any

maxBound :: Any

Bounded All 

Methods

minBound :: All

maxBound :: 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 

Methods

minBound :: Fd

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

Methods

minBound :: Sum a

maxBound :: Sum a

Bounded a => Bounded (Dual a) 

Methods

minBound :: Dual a

maxBound :: Dual a

Bounded a => Bounded (WrappedMonoid a) 
Bounded a => Bounded (Last a) 

Methods

minBound :: Last a

maxBound :: Last a

Bounded a => Bounded (First a) 

Methods

minBound :: First a

maxBound :: First a

Bounded a => Bounded (Max a) 

Methods

minBound :: Max a

maxBound :: Max a

Bounded a => Bounded (Min a) 

Methods

minBound :: Min a

maxBound :: Min a

Bounded a => Bounded (Identity a) 
(Bounded a, Bounded b) => Bounded (a, b) 

Methods

minBound :: (a, b)

maxBound :: (a, b)

Bounded (Proxy k s) 

Methods

minBound :: Proxy k s

maxBound :: Proxy k s

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

Methods

minBound :: (a, b, c)

maxBound :: (a, b, c)

(~) k a b => Bounded ((:~:) k a b) 

Methods

minBound :: (k :~: a) b

maxBound :: (k :~: a) b

Coercible k a b => Bounded (Coercion k a b) 

Methods

minBound :: Coercion k a b

maxBound :: Coercion k a b

Bounded a => Bounded (Const k a b) 

Methods

minBound :: Const k a b

maxBound :: Const k a b

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

Methods

minBound :: (a, b, c, d)

maxBound :: (a, b, c, d)

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

Methods

minBound :: (a, b, c, d, e)

maxBound :: (a, b, c, d, e)

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

maxBound :: (a, b, c, d, e, f)

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

maxBound :: (a, b, c, d, e, f, g)

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

maxBound :: (a, b, c, d, e, f, g, h)

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

maxBound :: (a, b, c, d, e, f, g, h, i)

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

maxBound :: (a, b, c, d, e, f, g, h, i, j)

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

maxBound :: (a, b, c, d, e, f, g, h, i, j, k)

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

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l)

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

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m)

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

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n)

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

maxBound :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

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 

Methods

minBound :: Int

maxBound :: Int

Enum Int 

Methods

succ :: Int -> Int

pred :: Int -> Int

toEnum :: Int -> Int

fromEnum :: Int -> Int

enumFrom :: Int -> [Int]

enumFromThen :: Int -> Int -> [Int]

enumFromTo :: Int -> Int -> [Int]

enumFromThenTo :: Int -> Int -> Int -> [Int]

Eq Int 

Methods

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

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

Integral Int 

Methods

quot :: Int -> Int -> Int

rem :: Int -> Int -> Int

div :: Int -> Int -> Int

mod :: Int -> Int -> Int

quotRem :: Int -> Int -> (Int, Int)

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

toInteger :: Int -> Integer

Data Int 

Methods

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

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

toConstr :: Int -> Constr

dataTypeOf :: Int -> DataType

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

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

gmapT :: (forall b. Data b => b -> b) -> Int -> Int

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

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

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

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

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

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

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

Num Int 

Methods

(+) :: Int -> Int -> Int

(-) :: Int -> Int -> Int

(*) :: Int -> Int -> Int

negate :: Int -> Int

abs :: Int -> Int

signum :: Int -> Int

fromInteger :: Integer -> 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 

Methods

toRational :: Int -> Rational

Show Int 

Methods

showsPrec :: Int -> Int -> ShowS

show :: Int -> String

showList :: [Int] -> ShowS

Ix Int 

Methods

range :: (Int, Int) -> [Int]

index :: (Int, Int) -> Int -> Int

unsafeIndex :: (Int, Int) -> Int -> Int

inRange :: (Int, Int) -> Int -> Bool

rangeSize :: (Int, Int) -> Int

unsafeRangeSize :: (Int, Int) -> Int

FiniteBits Int 
Bits Int 

Methods

(.&.) :: Int -> Int -> Int

(.|.) :: Int -> Int -> Int

xor :: Int -> Int -> Int

complement :: Int -> Int

shift :: Int -> Int -> Int

rotate :: Int -> Int -> Int

zeroBits :: Int

bit :: Int -> Int

setBit :: Int -> Int -> Int

clearBit :: Int -> Int -> Int

complementBit :: Int -> Int -> Int

testBit :: Int -> Int -> Bool

bitSizeMaybe :: Int -> Maybe Int

bitSize :: Int -> Int

isSigned :: Int -> Bool

shiftL :: Int -> Int -> Int

unsafeShiftL :: Int -> Int -> Int

shiftR :: Int -> Int -> Int

unsafeShiftR :: Int -> Int -> Int

rotateL :: Int -> Int -> Int

rotateR :: Int -> Int -> Int

popCount :: Int -> Int

Storable Int 

Methods

sizeOf :: Int -> Int

alignment :: Int -> Int

peekElemOff :: Ptr Int -> Int -> IO Int

pokeElemOff :: Ptr Int -> Int -> Int -> IO ()

peekByteOff :: Ptr b -> Int -> IO Int

pokeByteOff :: Ptr b -> Int -> Int -> IO ()

peek :: Ptr Int -> IO Int

poke :: Ptr Int -> Int -> IO ()

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) 

Methods

showsPrec :: Int -> URec Int _p -> ShowS

show :: URec Int _p -> String

showList :: [URec Int _p] -> ShowS

Generic (URec Int _p) 

Associated Types

type Rep (URec Int _p) :: * -> *

Methods

from :: URec Int _p -> Rep (URec Int _p) x

to :: Rep (URec Int _p) x -> URec Int _p

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

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

toConstr :: Integer -> Constr

dataTypeOf :: Integer -> DataType

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

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

gmapT :: (forall b. Data b => b -> b) -> Integer -> Integer

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

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

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

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

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

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

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

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

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

toConstr :: Float -> Constr

dataTypeOf :: Float -> DataType

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

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

gmapT :: (forall b. Data b => b -> b) -> Float -> Float

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

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

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

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

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

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

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

Ord Float 
Read Float 
RealFloat Float 
Storable Float 

Methods

sizeOf :: Float -> Int

alignment :: Float -> Int

peekElemOff :: Ptr Float -> Int -> IO Float

pokeElemOff :: Ptr Float -> Int -> Float -> IO ()

peekByteOff :: Ptr b -> Int -> IO Float

pokeByteOff :: Ptr b -> Int -> Float -> IO ()

peek :: Ptr Float -> IO Float

poke :: Ptr Float -> Float -> IO ()

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) 

Methods

compare :: URec Float _p -> URec Float _p -> Ordering Source

(<) :: URec Float _p -> URec Float _p -> Bool Source

(<=) :: URec Float _p -> URec Float _p -> Bool Source

(>) :: URec Float _p -> URec Float _p -> Bool Source

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

max :: URec Float _p -> URec Float _p -> URec Float _p Source

min :: URec Float _p -> URec Float _p -> URec Float _p Source

Show (URec Float _p) 

Methods

showsPrec :: Int -> URec Float _p -> ShowS

show :: URec Float _p -> String

showList :: [URec Float _p] -> ShowS

Generic (URec Float _p) 

Associated Types

type Rep (URec Float _p) :: * -> *

Methods

from :: URec Float _p -> Rep (URec Float _p) x

to :: Rep (URec Float _p) x -> URec Float _p

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

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

toConstr :: Double -> Constr

dataTypeOf :: Double -> DataType

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

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

gmapT :: (forall b. Data b => b -> b) -> Double -> Double

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

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

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

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

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

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

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

Ord Double 
Read Double 
RealFloat Double 
Storable Double 
PrintfArg Double 
Eq (URec Double _p) 

Methods

(==) :: URec Double _p -> URec Double _p -> Bool Source

(/=) :: URec Double _p -> URec Double _p -> Bool Source

Ord (URec Double _p) 
Show (URec Double _p) 

Methods

showsPrec :: Int -> URec Double _p -> ShowS

show :: URec Double _p -> String

showList :: [URec Double _p] -> ShowS

Generic (URec Double _p) 

Associated Types

type Rep (URec Double _p) :: * -> *

Methods

from :: URec Double _p -> Rep (URec Double _p) x

to :: Rep (URec Double _p) x -> URec Double _p

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

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 

Methods

quot :: Word -> Word -> Word

rem :: Word -> Word -> Word

div :: Word -> Word -> Word

mod :: Word -> Word -> Word

quotRem :: Word -> Word -> (Word, Word)

divMod :: Word -> Word -> (Word, Word)

toInteger :: Word -> Integer

Data Word 

Methods

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

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

toConstr :: Word -> Constr

dataTypeOf :: Word -> DataType

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

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

gmapT :: (forall b. Data b => b -> b) -> Word -> Word

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

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

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

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

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

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

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

Num Word 

Methods

(+) :: Word -> Word -> Word

(-) :: Word -> Word -> Word

(*) :: Word -> Word -> Word

negate :: Word -> Word

abs :: Word -> Word

signum :: Word -> Word

fromInteger :: Integer -> Word

Ord Word 
Read Word 
Real Word 

Methods

toRational :: Word -> Rational

Show Word 

Methods

showsPrec :: Int -> Word -> ShowS

show :: Word -> String

showList :: [Word] -> ShowS

Ix Word 

Methods

range :: (Word, Word) -> [Word]

index :: (Word, Word) -> Word -> Int

unsafeIndex :: (Word, Word) -> Word -> Int

inRange :: (Word, Word) -> Word -> Bool

rangeSize :: (Word, Word) -> Int

unsafeRangeSize :: (Word, Word) -> Int

FiniteBits Word 
Bits Word 
Storable Word 

Methods

sizeOf :: Word -> Int

alignment :: Word -> Int

peekElemOff :: Ptr Word -> Int -> IO Word

pokeElemOff :: Ptr Word -> Int -> Word -> IO ()

peekByteOff :: Ptr b -> Int -> IO Word

pokeByteOff :: Ptr b -> Int -> Word -> IO ()

peek :: Ptr Word -> IO Word

poke :: Ptr Word -> Word -> IO ()

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) 

Methods

compare :: URec Word _p -> URec Word _p -> Ordering Source

(<) :: URec Word _p -> URec Word _p -> Bool Source

(<=) :: URec Word _p -> URec Word _p -> Bool Source

(>) :: URec Word _p -> URec Word _p -> Bool Source

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

max :: URec Word _p -> URec Word _p -> URec Word _p Source

min :: URec Word _p -> URec Word _p -> URec Word _p Source

Show (URec Word _p) 

Methods

showsPrec :: Int -> URec Word _p -> ShowS

show :: URec Word _p -> String

showList :: [URec Word _p] -> ShowS

Generic (URec Word _p) 

Associated Types

type Rep (URec Word _p) :: * -> *

Methods

from :: URec Word _p -> Rep (URec Word _p) x

to :: Rep (URec Word _p) x -> URec Word _p

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

Basic numeric class.

Minimal complete definition

(+), (*), abs, signum, fromInteger, (negate | (-))

Methods

(+), (-), (*) :: a -> a -> a infixl 7 *infixl 6 +, -

negate :: a -> a

Unary negation.

abs :: a -> a

Absolute value.

signum :: a -> a

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

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 

Methods

(+) :: Int -> Int -> Int

(-) :: Int -> Int -> Int

(*) :: Int -> Int -> Int

negate :: Int -> Int

abs :: Int -> Int

signum :: Int -> Int

fromInteger :: Integer -> Int

Num Int8 

Methods

(+) :: Int8 -> Int8 -> Int8

(-) :: Int8 -> Int8 -> Int8

(*) :: Int8 -> Int8 -> Int8

negate :: Int8 -> Int8

abs :: Int8 -> Int8

signum :: Int8 -> Int8

fromInteger :: Integer -> Int8

Num Int16 
Num Int32 
Num Int64 
Num Integer 
Num Word 

Methods

(+) :: Word -> Word -> Word

(-) :: Word -> Word -> Word

(*) :: Word -> Word -> Word

negate :: Word -> Word

abs :: Word -> Word

signum :: Word -> Word

fromInteger :: Integer -> 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 

Methods

(+) :: CInt -> CInt -> CInt

(-) :: CInt -> CInt -> CInt

(*) :: CInt -> CInt -> CInt

negate :: CInt -> CInt

abs :: CInt -> CInt

signum :: CInt -> CInt

fromInteger :: Integer -> CInt

Num CUShort 
Num CShort 
Num CUChar 
Num CSChar 
Num CChar 
Num IntPtr 
Num WordPtr 
Num Fd 

Methods

(+) :: Fd -> Fd -> Fd

(-) :: Fd -> Fd -> Fd

(*) :: Fd -> Fd -> Fd

negate :: Fd -> Fd

abs :: Fd -> Fd

signum :: Fd -> Fd

fromInteger :: Integer -> Fd

Num CRLim 
Num CTcflag 
Num CSpeed 
Num CCc 

Methods

(+) :: CCc -> CCc -> CCc

(-) :: CCc -> CCc -> CCc

(*) :: CCc -> CCc -> CCc

negate :: CCc -> CCc

abs :: CCc -> CCc

signum :: CCc -> CCc

fromInteger :: Integer -> CCc

Num CUid 

Methods

(+) :: CUid -> CUid -> CUid

(-) :: CUid -> CUid -> CUid

(*) :: CUid -> CUid -> CUid

negate :: CUid -> CUid

abs :: CUid -> CUid

signum :: CUid -> CUid

fromInteger :: Integer -> CUid

Num CNlink 
Num CGid 

Methods

(+) :: CGid -> CGid -> CGid

(-) :: CGid -> CGid -> CGid

(*) :: CGid -> CGid -> CGid

negate :: CGid -> CGid

abs :: CGid -> CGid

signum :: CGid -> CGid

fromInteger :: Integer -> CGid

Num CSsize 
Num CPid 

Methods

(+) :: CPid -> CPid -> CPid

(-) :: CPid -> CPid -> CPid

(*) :: CPid -> CPid -> CPid

negate :: CPid -> CPid

abs :: CPid -> CPid

signum :: CPid -> CPid

fromInteger :: Integer -> CPid

Num COff 

Methods

(+) :: COff -> COff -> COff

(-) :: COff -> COff -> COff

(*) :: COff -> COff -> COff

negate :: COff -> COff

abs :: COff -> COff

signum :: COff -> COff

fromInteger :: Integer -> COff

Num CMode 
Num CIno 

Methods

(+) :: CIno -> CIno -> CIno

(-) :: CIno -> CIno -> CIno

(*) :: CIno -> CIno -> CIno

negate :: CIno -> CIno

abs :: CIno -> CIno

signum :: CIno -> CIno

fromInteger :: Integer -> CIno

Num CDev 

Methods

(+) :: CDev -> CDev -> CDev

(-) :: CDev -> CDev -> CDev

(*) :: CDev -> CDev -> CDev

negate :: CDev -> CDev

abs :: CDev -> CDev

signum :: CDev -> CDev

fromInteger :: Integer -> CDev

Num Natural 
Integral a => Num (Ratio a) 

Methods

(+) :: Ratio a -> Ratio a -> Ratio a

(-) :: Ratio a -> Ratio a -> Ratio a

(*) :: Ratio a -> Ratio a -> Ratio a

negate :: Ratio a -> Ratio a

abs :: Ratio a -> Ratio a

signum :: Ratio a -> Ratio a

fromInteger :: Integer -> Ratio a

Num a => Num (Product a) 

Methods

(+) :: Product a -> Product a -> Product a

(-) :: Product a -> Product a -> Product a

(*) :: Product a -> Product a -> Product a

negate :: Product a -> Product a

abs :: Product a -> Product a

signum :: Product a -> Product a

fromInteger :: Integer -> Product a

Num a => Num (Sum a) 

Methods

(+) :: Sum a -> Sum a -> Sum a

(-) :: Sum a -> Sum a -> Sum a

(*) :: Sum a -> Sum a -> Sum a

negate :: Sum a -> Sum a

abs :: Sum a -> Sum a

signum :: Sum a -> Sum a

fromInteger :: Integer -> Sum a

RealFloat a => Num (Complex a) 

Methods

(+) :: Complex a -> Complex a -> Complex a

(-) :: Complex a -> Complex a -> Complex a

(*) :: Complex a -> Complex a -> Complex a

negate :: Complex a -> Complex a

abs :: Complex a -> Complex a

signum :: Complex a -> Complex a

fromInteger :: Integer -> Complex a

HasResolution a => Num (Fixed a) 

Methods

(+) :: Fixed a -> Fixed a -> Fixed a

(-) :: Fixed a -> Fixed a -> Fixed a

(*) :: Fixed a -> Fixed a -> Fixed a

negate :: Fixed a -> Fixed a

abs :: Fixed a -> Fixed a

signum :: Fixed a -> Fixed a

fromInteger :: Integer -> Fixed a

Num a => Num (Max a) 

Methods

(+) :: Max a -> Max a -> Max a

(-) :: Max a -> Max a -> Max a

(*) :: Max a -> Max a -> Max a

negate :: Max a -> Max a

abs :: Max a -> Max a

signum :: Max a -> Max a

fromInteger :: Integer -> Max a

Num a => Num (Min a) 

Methods

(+) :: Min a -> Min a -> Min a

(-) :: Min a -> Min a -> Min a

(*) :: Min a -> Min a -> Min a

negate :: Min a -> Min a

abs :: Min a -> Min a

signum :: Min a -> Min a

fromInteger :: Integer -> Min a

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

Methods

(+) :: Alt k f a -> Alt k f a -> Alt k f a

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

(*) :: Alt k f a -> Alt k f a -> Alt k f a

negate :: Alt k f a -> Alt k f a

abs :: Alt k f a -> Alt k f a

signum :: Alt k f a -> Alt k f a

fromInteger :: Integer -> Alt k f a

class (Num a, Ord a) => Real a where

Minimal complete definition

toRational

Methods

toRational :: a -> Rational

the rational equivalent of its real argument with full precision

Instances

Real Int 

Methods

toRational :: Int -> Rational

Real Int8 

Methods

toRational :: Int8 -> Rational

Real Int16 
Real Int32 
Real Int64 
Real Integer 
Real Word 

Methods

toRational :: Word -> Rational

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 

Methods

toRational :: CInt -> Rational

Real CUShort 
Real CShort 
Real CUChar 
Real CSChar 
Real CChar 
Real IntPtr 
Real WordPtr 
Real Fd 

Methods

toRational :: Fd -> Rational

Real CRLim 
Real CTcflag 
Real CSpeed 
Real CCc 

Methods

toRational :: CCc -> Rational

Real CUid 

Methods

toRational :: CUid -> Rational

Real CNlink 
Real CGid 

Methods

toRational :: CGid -> Rational

Real CSsize 
Real CPid 

Methods

toRational :: CPid -> Rational

Real COff 

Methods

toRational :: COff -> Rational

Real CMode 
Real CIno 

Methods

toRational :: CIno -> Rational

Real CDev 

Methods

toRational :: CDev -> Rational

Real Natural 
Integral a => Real (Ratio a) 

Methods

toRational :: Ratio a -> Rational

HasResolution a => Real (Fixed a) 

Methods

toRational :: Fixed a -> Rational

class (Real a, Enum a) => Integral a where

Integral numbers, supporting integer division.

Minimal complete definition

quotRem, toInteger

Methods

quot :: a -> a -> a infixl 7

integer division truncated toward zero

rem :: a -> a -> a infixl 7

integer remainder, satisfying

(x `quot` y)*y + (x `rem` y) == x

div :: a -> a -> a infixl 7

integer division truncated toward negative infinity

mod :: a -> a -> a infixl 7

integer modulus, satisfying

(x `div` y)*y + (x `mod` y) == x

quotRem :: a -> a -> (a, a)

simultaneous quot and rem

divMod :: a -> a -> (a, a)

simultaneous div and mod

toInteger :: a -> Integer

conversion to Integer

Instances

Integral Int 

Methods

quot :: Int -> Int -> Int

rem :: Int -> Int -> Int

div :: Int -> Int -> Int

mod :: Int -> Int -> Int

quotRem :: Int -> Int -> (Int, Int)

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

toInteger :: Int -> Integer

Integral Int8 

Methods

quot :: Int8 -> Int8 -> Int8

rem :: Int8 -> Int8 -> Int8

div :: Int8 -> Int8 -> Int8

mod :: Int8 -> Int8 -> Int8

quotRem :: Int8 -> Int8 -> (Int8, Int8)

divMod :: Int8 -> Int8 -> (Int8, Int8)

toInteger :: Int8 -> Integer

Integral Int16 
Integral Int32 
Integral Int64 
Integral Integer 
Integral Word 

Methods

quot :: Word -> Word -> Word

rem :: Word -> Word -> Word

div :: Word -> Word -> Word

mod :: Word -> Word -> Word

quotRem :: Word -> Word -> (Word, Word)

divMod :: Word -> Word -> (Word, Word)

toInteger :: Word -> Integer

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 

Methods

quot :: CInt -> CInt -> CInt

rem :: CInt -> CInt -> CInt

div :: CInt -> CInt -> CInt

mod :: CInt -> CInt -> CInt

quotRem :: CInt -> CInt -> (CInt, CInt)

divMod :: CInt -> CInt -> (CInt, CInt)

toInteger :: CInt -> Integer

Integral CUShort 
Integral CShort 
Integral CUChar 
Integral CSChar 
Integral CChar 
Integral IntPtr 
Integral WordPtr 
Integral Fd 

Methods

quot :: Fd -> Fd -> Fd

rem :: Fd -> Fd -> Fd

div :: Fd -> Fd -> Fd

mod :: Fd -> Fd -> Fd

quotRem :: Fd -> Fd -> (Fd, Fd)

divMod :: Fd -> Fd -> (Fd, Fd)

toInteger :: Fd -> Integer

Integral CRLim 
Integral CTcflag 
Integral CUid 

Methods

quot :: CUid -> CUid -> CUid

rem :: CUid -> CUid -> CUid

div :: CUid -> CUid -> CUid

mod :: CUid -> CUid -> CUid

quotRem :: CUid -> CUid -> (CUid, CUid)

divMod :: CUid -> CUid -> (CUid, CUid)

toInteger :: CUid -> Integer

Integral CNlink 
Integral CGid 

Methods

quot :: CGid -> CGid -> CGid

rem :: CGid -> CGid -> CGid

div :: CGid -> CGid -> CGid

mod :: CGid -> CGid -> CGid

quotRem :: CGid -> CGid -> (CGid, CGid)

divMod :: CGid -> CGid -> (CGid, CGid)

toInteger :: CGid -> Integer

Integral CSsize 
Integral CPid 

Methods

quot :: CPid -> CPid -> CPid

rem :: CPid -> CPid -> CPid

div :: CPid -> CPid -> CPid

mod :: CPid -> CPid -> CPid

quotRem :: CPid -> CPid -> (CPid, CPid)

divMod :: CPid -> CPid -> (CPid, CPid)

toInteger :: CPid -> Integer

Integral COff 

Methods

quot :: COff -> COff -> COff

rem :: COff -> COff -> COff

div :: COff -> COff -> COff

mod :: COff -> COff -> COff

quotRem :: COff -> COff -> (COff, COff)

divMod :: COff -> COff -> (COff, COff)

toInteger :: COff -> Integer

Integral CMode 
Integral CIno 

Methods

quot :: CIno -> CIno -> CIno

rem :: CIno -> CIno -> CIno

div :: CIno -> CIno -> CIno

mod :: CIno -> CIno -> CIno

quotRem :: CIno -> CIno -> (CIno, CIno)

divMod :: CIno -> CIno -> (CIno, CIno)

toInteger :: CIno -> Integer

Integral CDev 

Methods

quot :: CDev -> CDev -> CDev

rem :: CDev -> CDev -> CDev

div :: CDev -> CDev -> CDev

mod :: CDev -> CDev -> CDev

quotRem :: CDev -> CDev -> (CDev, CDev)

divMod :: CDev -> CDev -> (CDev, CDev)

toInteger :: CDev -> Integer

Integral Natural 

class Num a => Fractional a where

Fractional numbers, supporting real division.

Minimal complete definition

fromRational, (recip | (/))

Methods

(/) :: a -> a -> a infixl 7

fractional division

recip :: a -> a

reciprocal fraction

fromRational :: Rational -> a

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

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

exp, log, sqrt :: a -> a

(**), logBase :: a -> a -> a infixr 8

sin, cos, tan :: a -> a

asin, acos, atan :: a -> a

sinh, cosh, tanh :: a -> a

asinh, acosh, atanh :: a -> a

Instances

Floating Double 
Floating Float 
Floating CDouble 
Floating CFloat 
RealFloat a => Floating (Complex a) 

Methods

pi :: Complex a

exp :: Complex a -> Complex a

log :: Complex a -> Complex a

sqrt :: Complex a -> Complex a

(**) :: Complex a -> Complex a -> Complex a

logBase :: Complex a -> Complex a -> Complex a

sin :: Complex a -> Complex a

cos :: Complex a -> Complex a

tan :: Complex a -> Complex a

asin :: Complex a -> Complex a

acos :: Complex a -> Complex a

atan :: Complex a -> Complex a

sinh :: Complex a -> Complex a

cosh :: Complex a -> Complex a

tanh :: Complex a -> Complex a

asinh :: Complex a -> Complex a

acosh :: Complex a -> Complex a

atanh :: Complex a -> Complex a

log1p :: Complex a -> Complex a

expm1 :: Complex a -> Complex a

log1pexp :: Complex a -> Complex a

log1mexp :: Complex a -> Complex a

class (Real a, Fractional a) => RealFrac a where

Extracting components of fractions.

Minimal complete definition

properFraction

Methods

properFraction :: Integral b => a -> (b, a)

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

truncate x returns the integer nearest x between zero and x

round :: Integral b => a -> b

round x returns the nearest integer to x; the even integer if x is equidistant between two integers

ceiling :: Integral b => a -> b

ceiling x returns the least integer not less than x

floor :: Integral b => a -> b

floor x returns the greatest integer not greater than x

Instances

RealFrac CDouble 

Methods

properFraction :: Integral b => CDouble -> (b, CDouble)

truncate :: Integral b => CDouble -> b

round :: Integral b => CDouble -> b

ceiling :: Integral b => CDouble -> b

floor :: Integral b => CDouble -> b

RealFrac CFloat 

Methods

properFraction :: Integral b => CFloat -> (b, CFloat)

truncate :: Integral b => CFloat -> b

round :: Integral b => CFloat -> b

ceiling :: Integral b => CFloat -> b

floor :: Integral b => CFloat -> b

Integral a => RealFrac (Ratio a) 

Methods

properFraction :: Integral b => Ratio a -> (b, Ratio a)

truncate :: Integral b => Ratio a -> b

round :: Integral b => Ratio a -> b

ceiling :: Integral b => Ratio a -> b

floor :: Integral b => Ratio a -> b

HasResolution a => RealFrac (Fixed a) 

Methods

properFraction :: Integral b => Fixed a -> (b, Fixed a)

truncate :: Integral b => Fixed a -> b

round :: Integral b => Fixed a -> b

ceiling :: Integral b => Fixed a -> b

floor :: Integral b => Fixed a -> b

class (RealFrac a, Floating a) => RealFloat a where

Efficient, machine-independent access to the components of a floating-point number.

Methods

floatRadix :: a -> Integer

a constant function, returning the radix of the representation (often 2)

floatDigits :: a -> Int

a constant function, returning the number of digits of floatRadix in the significand

floatRange :: a -> (Int, Int)

a constant function, returning the lowest and highest values the exponent may assume

decodeFloat :: a -> (Integer, Int)

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

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

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

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

multiplies a floating-point number by an integer power of the radix

isNaN :: a -> Bool

True if the argument is an IEEE "not-a-number" (NaN) value

isInfinite :: a -> Bool

True if the argument is an IEEE infinity or negative infinity

isDenormalized :: a -> Bool

True if the argument is too small to be represented in normalized format

isNegativeZero :: a -> Bool

True if the argument is an IEEE negative zero

isIEEE :: a -> Bool

True if the argument is an IEEE floating point number

atan2 :: a -> a -> a

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

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

odd :: Integral a => a -> Bool

gcd :: Integral a => a -> a -> a

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

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

(^) :: (Num a, Integral b) => a -> b -> a infixr 8

raise a number to a non-negative integral power

(^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8

raise a number to an integral power

fromIntegral :: (Integral a, Num b) => a -> b

general coercion from integral types

realToFrac :: (Real a, Fractional b) => a -> b

general coercion to fractional types

Monoids

class Monoid a where

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

Identity of mappend

mappend :: a -> a -> a

An associative operation

mconcat :: [a] -> a

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

mappend :: () -> () -> ()

mconcat :: [()] -> ()

Monoid Any 

Methods

mempty :: Any

mappend :: Any -> Any -> Any

mconcat :: [Any] -> Any

Monoid All 

Methods

mempty :: All

mappend :: All -> All -> All

mconcat :: [All] -> All

Monoid Lifetime

mappend == elSupremum

Monoid Event 
Monoid [a] 

Methods

mempty :: [a]

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

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

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

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

mconcat :: [Maybe a] -> Maybe a

Monoid a => Monoid (IO a) 

Methods

mempty :: IO a

mappend :: IO a -> IO a -> IO a

mconcat :: [IO a] -> IO a

Monoid (Last a) 

Methods

mempty :: Last a

mappend :: Last a -> Last a -> Last a

mconcat :: [Last a] -> Last a

Monoid (First a) 

Methods

mempty :: First a

mappend :: First a -> First a -> First a

mconcat :: [First a] -> First a

Num a => Monoid (Product a) 

Methods

mempty :: Product a

mappend :: Product a -> Product a -> Product a

mconcat :: [Product a] -> Product a

Num a => Monoid (Sum a) 

Methods

mempty :: Sum a

mappend :: Sum a -> Sum a -> Sum a

mconcat :: [Sum a] -> Sum a

Monoid (Endo a) 

Methods

mempty :: Endo a

mappend :: Endo a -> Endo a -> Endo a

mconcat :: [Endo a] -> Endo a

Monoid a => Monoid (Dual a) 

Methods

mempty :: Dual a

mappend :: Dual a -> Dual a -> Dual a

mconcat :: [Dual a] -> Dual a

Semigroup a => Monoid (Option a) 

Methods

mempty :: Option a

mappend :: Option a -> Option a -> Option a

mconcat :: [Option a] -> Option a

Monoid m => Monoid (WrappedMonoid m) 
(Ord a, Bounded a) => Monoid (Max a) 

Methods

mempty :: Max a

mappend :: Max a -> Max a -> Max a

mconcat :: [Max a] -> Max a

(Ord a, Bounded a) => Monoid (Min a) 

Methods

mempty :: Min a

mappend :: Min a -> Min a -> Min a

mconcat :: [Min a] -> Min a

Monoid a => Monoid (Identity a) 
Monoid b => Monoid (a -> b) 

Methods

mempty :: a -> b

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

mconcat :: [a -> b] -> a -> b

(Monoid a, Monoid b) => Monoid (a, b) 

Methods

mempty :: (a, b)

mappend :: (a, b) -> (a, b) -> (a, b)

mconcat :: [(a, b)] -> (a, b)

Monoid (Proxy k s) 

Methods

mempty :: Proxy k s

mappend :: Proxy k s -> Proxy k s -> Proxy k s

mconcat :: [Proxy k s] -> Proxy k s

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

Methods

mempty :: (a, b, c)

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

mconcat :: [(a, b, c)] -> (a, b, c)

Alternative f => Monoid (Alt (TYPE Lifted) f a) 

Methods

mempty :: Alt (TYPE Lifted) f a

mappend :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f a

mconcat :: [Alt (TYPE Lifted) f a] -> Alt (TYPE Lifted) f a

Monoid a => Monoid (Const k a b) 

Methods

mempty :: Const k a b

mappend :: Const k a b -> Const k a b -> Const k a b

mconcat :: [Const k a b] -> Const k a b

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

Methods

mempty :: (a, b, c, d)

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

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

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

Methods

mempty :: (a, b, c, d, e)

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

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

Monads and functors

class Functor f where

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

(<$) :: a -> f b -> f a infixl 4

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]

(<$) :: a -> [b] -> [a]

Functor Maybe 

Methods

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

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

Functor IO 

Methods

fmap :: (a -> b) -> IO a -> IO b

(<$) :: a -> IO b -> IO a

Functor ReadP 

Methods

fmap :: (a -> b) -> ReadP a -> ReadP b

(<$) :: a -> ReadP b -> ReadP a

Functor ReadPrec 

Methods

fmap :: (a -> b) -> ReadPrec a -> ReadPrec b

(<$) :: a -> ReadPrec b -> ReadPrec a

Functor Last 

Methods

fmap :: (a -> b) -> Last a -> Last b

(<$) :: a -> Last b -> Last a

Functor First 

Methods

fmap :: (a -> b) -> First a -> First b

(<$) :: a -> First b -> First a

Functor Product 

Methods

fmap :: (a -> b) -> Product a -> Product b

(<$) :: a -> Product b -> Product a

Functor Sum 

Methods

fmap :: (a -> b) -> Sum a -> Sum b

(<$) :: a -> Sum b -> Sum a

Functor Dual 

Methods

fmap :: (a -> b) -> Dual a -> Dual b

(<$) :: a -> Dual b -> Dual a

Functor STM 

Methods

fmap :: (a -> b) -> STM a -> STM b

(<$) :: a -> STM b -> STM a

Functor Handler 

Methods

fmap :: (a -> b) -> Handler a -> Handler b

(<$) :: a -> Handler b -> Handler a

Functor ZipList 

Methods

fmap :: (a -> b) -> ZipList a -> ZipList b

(<$) :: a -> ZipList b -> ZipList a

Functor Complex 

Methods

fmap :: (a -> b) -> Complex a -> Complex b

(<$) :: a -> Complex b -> Complex a

Functor NonEmpty 

Methods

fmap :: (a -> b) -> NonEmpty a -> NonEmpty b

(<$) :: a -> NonEmpty b -> NonEmpty a

Functor Option 

Methods

fmap :: (a -> b) -> Option a -> Option b

(<$) :: a -> Option b -> Option a

Functor Last 

Methods

fmap :: (a -> b) -> Last a -> Last b

(<$) :: a -> Last b -> Last a

Functor First 

Methods

fmap :: (a -> b) -> First a -> First b

(<$) :: a -> First b -> First a

Functor Max 

Methods

fmap :: (a -> b) -> Max a -> Max b

(<$) :: a -> Max b -> Max a

Functor Min 

Methods

fmap :: (a -> b) -> Min a -> Min b

(<$) :: a -> Min b -> Min a

Functor Identity 

Methods

fmap :: (a -> b) -> Identity a -> Identity b

(<$) :: a -> Identity b -> Identity a

Functor ArgDescr 

Methods

fmap :: (a -> b) -> ArgDescr a -> ArgDescr b

(<$) :: a -> ArgDescr b -> ArgDescr a

Functor OptDescr 

Methods

fmap :: (a -> b) -> OptDescr a -> OptDescr b

(<$) :: a -> OptDescr b -> OptDescr a

Functor ArgOrder 

Methods

fmap :: (a -> b) -> ArgOrder a -> ArgOrder b

(<$) :: a -> ArgOrder b -> ArgOrder a

Functor ((->) r) 

Methods

fmap :: (a -> b) -> (r -> a) -> r -> b

(<$) :: a -> (r -> b) -> r -> a

Functor (Either a) 

Methods

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

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

Functor ((,) a) 

Methods

fmap :: (a -> b) -> (a, a) -> (a, b)

(<$) :: a -> (a, b) -> (a, a)

Functor (ST s) 

Methods

fmap :: (a -> b) -> ST s a -> ST s b

(<$) :: a -> ST s b -> ST s a

Functor (Proxy (TYPE Lifted)) 

Methods

fmap :: (a -> b) -> Proxy (TYPE Lifted) a -> Proxy (TYPE Lifted) b

(<$) :: a -> Proxy (TYPE Lifted) b -> Proxy (TYPE Lifted) a

Arrow a => Functor (ArrowMonad a) 

Methods

fmap :: (a -> b) -> ArrowMonad a a -> ArrowMonad a b

(<$) :: a -> ArrowMonad a b -> ArrowMonad a a

Monad m => Functor (WrappedMonad m) 

Methods

fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b

(<$) :: a -> WrappedMonad m b -> WrappedMonad m a

Functor (ST s) 

Methods

fmap :: (a -> b) -> ST s a -> ST s b

(<$) :: a -> ST s b -> ST s a

Functor (Arg a) 

Methods

fmap :: (a -> b) -> Arg a a -> Arg a b

(<$) :: a -> Arg a b -> Arg a a

Functor f => Functor (Alt (TYPE Lifted) f) 

Methods

fmap :: (a -> b) -> Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b

(<$) :: a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f a

Functor (Const (TYPE Lifted) m) 

Methods

fmap :: (a -> b) -> Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b

(<$) :: a -> Const (TYPE Lifted) m b -> Const (TYPE Lifted) m a

Arrow a => Functor (WrappedArrow a b) 

Methods

fmap :: (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b

(<$) :: a -> WrappedArrow a b b -> WrappedArrow a b a

(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

(<$) :: a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g a

(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

(<$) :: a -> Sum (TYPE Lifted) f g b -> Sum (TYPE Lifted) f g a

(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

(<$) :: a -> Compose (TYPE Lifted) (TYPE Lifted) f g b -> Compose (TYPE Lifted) (TYPE Lifted) f g a

(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4

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

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

Lift a value.

(<*>) :: f (a -> b) -> f a -> f b infixl 4

Sequential application.

(*>) :: f a -> f b -> f b infixl 4

Sequence actions, discarding the value of the first argument.

(<*) :: f a -> f b -> f a infixl 4

Sequence actions, discarding the value of the second argument.

Instances

Applicative [] 

Methods

pure :: a -> [a]

(<*>) :: [a -> b] -> [a] -> [b]

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

(<*) :: [a] -> [b] -> [a]

Applicative Maybe 

Methods

pure :: a -> Maybe a

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

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

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

Applicative IO 

Methods

pure :: a -> IO a

(<*>) :: IO (a -> b) -> IO a -> IO b

(*>) :: IO a -> IO b -> IO b

(<*) :: IO a -> IO b -> IO a

Applicative ReadP 

Methods

pure :: a -> ReadP a

(<*>) :: ReadP (a -> b) -> ReadP a -> ReadP b

(*>) :: ReadP a -> ReadP b -> ReadP b

(<*) :: ReadP a -> ReadP b -> ReadP a

Applicative ReadPrec 

Methods

pure :: a -> ReadPrec a

(<*>) :: ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b

(*>) :: ReadPrec a -> ReadPrec b -> ReadPrec b

(<*) :: ReadPrec a -> ReadPrec b -> ReadPrec a

Applicative Last 

Methods

pure :: a -> Last a

(<*>) :: Last (a -> b) -> Last a -> Last b

(*>) :: Last a -> Last b -> Last b

(<*) :: Last a -> Last b -> Last a

Applicative First 

Methods

pure :: a -> First a

(<*>) :: First (a -> b) -> First a -> First b

(*>) :: First a -> First b -> First b

(<*) :: First a -> First b -> First a

Applicative Product 

Methods

pure :: a -> Product a

(<*>) :: Product (a -> b) -> Product a -> Product b

(*>) :: Product a -> Product b -> Product b

(<*) :: Product a -> Product b -> Product a

Applicative Sum 

Methods

pure :: a -> Sum a

(<*>) :: Sum (a -> b) -> Sum a -> Sum b

(*>) :: Sum a -> Sum b -> Sum b

(<*) :: Sum a -> Sum b -> Sum a

Applicative Dual 

Methods

pure :: a -> Dual a

(<*>) :: Dual (a -> b) -> Dual a -> Dual b

(*>) :: Dual a -> Dual b -> Dual b

(<*) :: Dual a -> Dual b -> Dual a

Applicative STM 

Methods

pure :: a -> STM a

(<*>) :: STM (a -> b) -> STM a -> STM b

(*>) :: STM a -> STM b -> STM b

(<*) :: STM a -> STM b -> STM a

Applicative ZipList 

Methods

pure :: a -> ZipList a

(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b

(*>) :: ZipList a -> ZipList b -> ZipList b

(<*) :: ZipList a -> ZipList b -> ZipList a

Applicative Complex 

Methods

pure :: a -> Complex a

(<*>) :: Complex (a -> b) -> Complex a -> Complex b

(*>) :: Complex a -> Complex b -> Complex b

(<*) :: Complex a -> Complex b -> Complex a

Applicative NonEmpty 

Methods

pure :: a -> NonEmpty a

(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b

(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b

(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a

Applicative Option 

Methods

pure :: a -> Option a

(<*>) :: Option (a -> b) -> Option a -> Option b

(*>) :: Option a -> Option b -> Option b

(<*) :: Option a -> Option b -> Option a

Applicative Last 

Methods

pure :: a -> Last a

(<*>) :: Last (a -> b) -> Last a -> Last b

(*>) :: Last a -> Last b -> Last b

(<*) :: Last a -> Last b -> Last a

Applicative First 

Methods

pure :: a -> First a

(<*>) :: First (a -> b) -> First a -> First b

(*>) :: First a -> First b -> First b

(<*) :: First a -> First b -> First a

Applicative Max 

Methods

pure :: a -> Max a

(<*>) :: Max (a -> b) -> Max a -> Max b

(*>) :: Max a -> Max b -> Max b

(<*) :: Max a -> Max b -> Max a

Applicative Min 

Methods

pure :: a -> Min a

(<*>) :: Min (a -> b) -> Min a -> Min b

(*>) :: Min a -> Min b -> Min b

(<*) :: Min a -> Min b -> Min a

Applicative Identity 

Methods

pure :: a -> Identity a

(<*>) :: Identity (a -> b) -> Identity a -> Identity b

(*>) :: Identity a -> Identity b -> Identity b

(<*) :: Identity a -> Identity b -> Identity a

Applicative ((->) a) 

Methods

pure :: a -> a -> a

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

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

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

Applicative (Either e) 

Methods

pure :: a -> Either e a

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

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

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

Monoid a => Applicative ((,) a) 

Methods

pure :: a -> (a, a)

(<*>) :: (a, a -> b) -> (a, a) -> (a, b)

(*>) :: (a, a) -> (a, b) -> (a, b)

(<*) :: (a, a) -> (a, b) -> (a, a)

Applicative (ST s) 

Methods

pure :: a -> ST s a

(<*>) :: ST s (a -> b) -> ST s a -> ST s b

(*>) :: ST s a -> ST s b -> ST s b

(<*) :: ST s a -> ST s b -> ST s a

Applicative (Proxy (TYPE Lifted)) 

Methods

pure :: a -> Proxy (TYPE Lifted) a

(<*>) :: Proxy (TYPE Lifted) (a -> b) -> Proxy (TYPE Lifted) a -> Proxy (TYPE Lifted) b

(*>) :: Proxy (TYPE Lifted) a -> Proxy (TYPE Lifted) b -> Proxy (TYPE Lifted) b

(<*) :: Proxy (TYPE Lifted) a -> Proxy (TYPE Lifted) b -> Proxy (TYPE Lifted) a

Arrow a => Applicative (ArrowMonad a) 

Methods

pure :: a -> ArrowMonad a a

(<*>) :: ArrowMonad a (a -> b) -> ArrowMonad a a -> ArrowMonad a b

(*>) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a b

(<*) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a a

Monad m => Applicative (WrappedMonad m) 

Methods

pure :: a -> WrappedMonad m a

(<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b

(*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b

(<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a

Applicative (ST s) 

Methods

pure :: a -> ST s a

(<*>) :: ST s (a -> b) -> ST s a -> ST s b

(*>) :: ST s a -> ST s b -> ST s b

(<*) :: ST s a -> ST s b -> ST s a

Applicative f => Applicative (Alt (TYPE Lifted) f) 

Methods

pure :: a -> Alt (TYPE Lifted) f a

(<*>) :: Alt (TYPE Lifted) f (a -> b) -> Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b

(*>) :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f b

(<*) :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f a

Monoid m => Applicative (Const (TYPE Lifted) m) 

Methods

pure :: a -> Const (TYPE Lifted) m a

(<*>) :: Const (TYPE Lifted) m (a -> b) -> Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b

(*>) :: Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b -> Const (TYPE Lifted) m b

(<*) :: Const (TYPE Lifted) m a -> Const (TYPE Lifted) m b -> Const (TYPE Lifted) m a

Arrow a => Applicative (WrappedArrow a b) 

Methods

pure :: a -> WrappedArrow a b a

(<*>) :: WrappedArrow a b (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b

(*>) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b b

(<*) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b a

(Applicative f, Applicative g) => Applicative (Product (TYPE Lifted) f g) 

Methods

pure :: a -> Product (TYPE Lifted) f g a

(<*>) :: Product (TYPE Lifted) f g (a -> b) -> Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b

(*>) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g b

(<*) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g a

(Applicative f, Applicative g) => Applicative (Compose (TYPE Lifted) (TYPE Lifted) f g) 

Methods

pure :: a -> Compose (TYPE Lifted) (TYPE Lifted) f g a

(<*>) :: Compose (TYPE Lifted) (TYPE Lifted) f g (a -> b) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> Compose (TYPE Lifted) (TYPE Lifted) f g b

(*>) :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> Compose (TYPE Lifted) (TYPE Lifted) f g b -> Compose (TYPE Lifted) (TYPE Lifted) f g b

(<*) :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> Compose (TYPE Lifted) (TYPE Lifted) f g b -> Compose (TYPE Lifted) (TYPE Lifted) f g a

class Applicative m => Monad m where

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

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

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

Inject a value into the monadic type.

fail :: String -> m a

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]

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

return :: a -> [a]

fail :: String -> [a]

Monad Maybe 

Methods

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

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

return :: a -> Maybe a

fail :: String -> Maybe a

Monad IO 

Methods

(>>=) :: IO a -> (a -> IO b) -> IO b

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

return :: a -> IO a

fail :: String -> IO a

Monad ReadP 

Methods

(>>=) :: ReadP a -> (a -> ReadP b) -> ReadP b

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

return :: a -> ReadP a

fail :: String -> ReadP a

Monad ReadPrec 

Methods

(>>=) :: ReadPrec a -> (a -> ReadPrec b) -> ReadPrec b

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

return :: a -> ReadPrec a

fail :: String -> ReadPrec a

Monad Last 

Methods

(>>=) :: Last a -> (a -> Last b) -> Last b

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

return :: a -> Last a

fail :: String -> Last a

Monad First 

Methods

(>>=) :: First a -> (a -> First b) -> First b

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

return :: a -> First a

fail :: String -> First a

Monad Product 

Methods

(>>=) :: Product a -> (a -> Product b) -> Product b

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

return :: a -> Product a

fail :: String -> Product a

Monad Sum 

Methods

(>>=) :: Sum a -> (a -> Sum b) -> Sum b

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

return :: a -> Sum a

fail :: String -> Sum a

Monad Dual 

Methods

(>>=) :: Dual a -> (a -> Dual b) -> Dual b

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

return :: a -> Dual a

fail :: String -> Dual a

Monad STM 

Methods

(>>=) :: STM a -> (a -> STM b) -> STM b

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

return :: a -> STM a

fail :: String -> STM a

Monad Complex 

Methods

(>>=) :: Complex a -> (a -> Complex b) -> Complex b

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

return :: a -> Complex a

fail :: String -> Complex a

Monad NonEmpty 

Methods

(>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b

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

return :: a -> NonEmpty a

fail :: String -> NonEmpty a

Monad Option 

Methods

(>>=) :: Option a -> (a -> Option b) -> Option b

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

return :: a -> Option a

fail :: String -> Option a

Monad Last 

Methods

(>>=) :: Last a -> (a -> Last b) -> Last b

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

return :: a -> Last a

fail :: String -> Last a

Monad First 

Methods

(>>=) :: First a -> (a -> First b) -> First b

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

return :: a -> First a

fail :: String -> First a

Monad Max 

Methods

(>>=) :: Max a -> (a -> Max b) -> Max b

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

return :: a -> Max a

fail :: String -> Max a

Monad Min 

Methods

(>>=) :: Min a -> (a -> Min b) -> Min b

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

return :: a -> Min a

fail :: String -> Min a

Monad Identity 

Methods

(>>=) :: Identity a -> (a -> Identity b) -> Identity b

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

return :: a -> Identity a

fail :: String -> Identity a

Monad ((->) r) 

Methods

(>>=) :: (r -> a) -> (a -> r -> b) -> r -> b

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

return :: a -> r -> a

fail :: String -> r -> a

Monad (Either e) 

Methods

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

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

return :: a -> Either e a

fail :: String -> Either e a

Monoid a => Monad ((,) a) 

Methods

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

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

return :: a -> (a, a)

fail :: String -> (a, a)

Monad (ST s) 

Methods

(>>=) :: ST s a -> (a -> ST s b) -> ST s b

(>>) :: ST s a -> ST s b -> ST s b

return :: a -> ST s a

fail :: String -> ST s a

Monad (Proxy (TYPE Lifted)) 

Methods

(>>=) :: Proxy (TYPE Lifted) a -> (a -> Proxy (TYPE Lifted) b) -> Proxy (TYPE Lifted) b

(>>) :: Proxy (TYPE Lifted) a -> Proxy (TYPE Lifted) b -> Proxy (TYPE Lifted) b

return :: a -> Proxy (TYPE Lifted) a

fail :: String -> Proxy (TYPE Lifted) a

ArrowApply a => Monad (ArrowMonad a) 

Methods

(>>=) :: ArrowMonad a a -> (a -> ArrowMonad a b) -> ArrowMonad a b

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

return :: a -> ArrowMonad a a

fail :: String -> ArrowMonad a a

Monad m => Monad (WrappedMonad m) 

Methods

(>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b

(>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b

return :: a -> WrappedMonad m a

fail :: String -> WrappedMonad m a

Monad (ST s) 

Methods

(>>=) :: ST s a -> (a -> ST s b) -> ST s b

(>>) :: ST s a -> ST s b -> ST s b

return :: a -> ST s a

fail :: String -> ST s a

Monad f => Monad (Alt (TYPE Lifted) f) 

Methods

(>>=) :: Alt (TYPE Lifted) f a -> (a -> Alt (TYPE Lifted) f b) -> Alt (TYPE Lifted) f b

(>>) :: Alt (TYPE Lifted) f a -> Alt (TYPE Lifted) f b -> Alt (TYPE Lifted) f b

return :: a -> Alt (TYPE Lifted) f a

fail :: String -> Alt (TYPE Lifted) f a

(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

(>>) :: Product (TYPE Lifted) f g a -> Product (TYPE Lifted) f g b -> Product (TYPE Lifted) f g b

return :: a -> Product (TYPE Lifted) f g a

fail :: String -> Product (TYPE Lifted) f g a

mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

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

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

Same as >>=, but with the arguments interchanged.

Folds and traversals

class Foldable t where

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

Map each element of the structure to a monoid, and combine the results.

foldr :: (a -> b -> b) -> b -> t a -> b

Right-associative fold of a structure.

foldr f z = foldr f z . toList

foldl :: (b -> a -> b) -> b -> t a -> b

Left-associative fold of a structure.

foldl f z = foldl f z . toList

foldr1 :: (a -> a -> a) -> t a -> a

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

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

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

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

Does the element occur in the structure?

maximum :: forall a. Ord a => t a -> a

The largest element of a non-empty structure.

minimum :: forall a. Ord a => t a -> a

The least element of a non-empty structure.

sum :: Num a => t a -> a

The sum function computes the sum of the numbers of a structure.

product :: Num a => t a -> a

The product function computes the product of the numbers of a structure.

Instances

Foldable [] 

Methods

fold :: Monoid m => [m] -> m

foldMap :: Monoid m => (a -> m) -> [a] -> m

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

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

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

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

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

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

toList :: [a] -> [a]

null :: [a] -> Bool

length :: [a] -> Int

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

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

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

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

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

Foldable Maybe 

Methods

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

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

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

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

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

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

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

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

toList :: Maybe a -> [a]

null :: Maybe a -> Bool

length :: Maybe a -> Int

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

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

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

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

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

Foldable Last 

Methods

fold :: Monoid m => Last m -> m

foldMap :: Monoid m => (a -> m) -> Last a -> m

foldr :: (a -> b -> b) -> b -> Last a -> b

foldr' :: (a -> b -> b) -> b -> Last a -> b

foldl :: (b -> a -> b) -> b -> Last a -> b

foldl' :: (b -> a -> b) -> b -> Last a -> b

foldr1 :: (a -> a -> a) -> Last a -> a

foldl1 :: (a -> a -> a) -> Last a -> a

toList :: Last a -> [a]

null :: Last a -> Bool

length :: Last a -> Int

elem :: Eq a => a -> Last a -> Bool

maximum :: Ord a => Last a -> a

minimum :: Ord a => Last a -> a

sum :: Num a => Last a -> a

product :: Num a => Last a -> a

Foldable First 

Methods

fold :: Monoid m => First m -> m

foldMap :: Monoid m => (a -> m) -> First a -> m

foldr :: (a -> b -> b) -> b -> First a -> b

foldr' :: (a -> b -> b) -> b -> First a -> b

foldl :: (b -> a -> b) -> b -> First a -> b

foldl' :: (b -> a -> b) -> b -> First a -> b

foldr1 :: (a -> a -> a) -> First a -> a

foldl1 :: (a -> a -> a) -> First a -> a

toList :: First a -> [a]

null :: First a -> Bool

length :: First a -> Int

elem :: Eq a => a -> First a -> Bool

maximum :: Ord a => First a -> a

minimum :: Ord a => First a -> a

sum :: Num a => First a -> a

product :: Num a => First a -> a

Foldable Product 

Methods

fold :: Monoid m => Product m -> m

foldMap :: Monoid m => (a -> m) -> Product a -> m

foldr :: (a -> b -> b) -> b -> Product a -> b

foldr' :: (a -> b -> b) -> b -> Product a -> b

foldl :: (b -> a -> b) -> b -> Product a -> b

foldl' :: (b -> a -> b) -> b -> Product a -> b

foldr1 :: (a -> a -> a) -> Product a -> a

foldl1 :: (a -> a -> a) -> Product a -> a

toList :: Product a -> [a]

null :: Product a -> Bool

length :: Product a -> Int

elem :: Eq a => a -> Product a -> Bool

maximum :: Ord a => Product a -> a

minimum :: Ord a => Product a -> a

sum :: Num a => Product a -> a

product :: Num a => Product a -> a

Foldable Sum 

Methods

fold :: Monoid m => Sum m -> m

foldMap :: Monoid m => (a -> m) -> Sum a -> m

foldr :: (a -> b -> b) -> b -> Sum a -> b

foldr' :: (a -> b -> b) -> b -> Sum a -> b

foldl :: (b -> a -> b) -> b -> Sum a -> b

foldl' :: (b -> a -> b) -> b -> Sum a -> b

foldr1 :: (a -> a -> a) -> Sum a -> a

foldl1 :: (a -> a -> a) -> Sum a -> a

toList :: Sum a -> [a]

null :: Sum a -> Bool

length :: Sum a -> Int

elem :: Eq a => a -> Sum a -> Bool

maximum :: Ord a => Sum a -> a

minimum :: Ord a => Sum a -> a

sum :: Num a => Sum a -> a

product :: Num a => Sum a -> a

Foldable Dual 

Methods

fold :: Monoid m => Dual m -> m

foldMap :: Monoid m => (a -> m) -> Dual a -> m

foldr :: (a -> b -> b) -> b -> Dual a -> b

foldr' :: (a -> b -> b) -> b -> Dual a -> b

foldl :: (b -> a -> b) -> b -> Dual a -> b

foldl' :: (b -> a -> b) -> b -> Dual a -> b

foldr1 :: (a -> a -> a) -> Dual a -> a

foldl1 :: (a -> a -> a) -> Dual a -> a

toList :: Dual a -> [a]

null :: Dual a -> Bool

length :: Dual a -> Int

elem :: Eq a => a -> Dual a -> Bool

maximum :: Ord a => Dual a -> a

minimum :: Ord a => Dual a -> a

sum :: Num a => Dual a -> a

product :: Num a => Dual a -> a

Foldable ZipList 

Methods

fold :: Monoid m => ZipList m -> m

foldMap :: Monoid m => (a -> m) -> ZipList a -> m

foldr :: (a -> b -> b) -> b -> ZipList a -> b

foldr' :: (a -> b -> b) -> b -> ZipList a -> b

foldl :: (b -> a -> b) -> b -> ZipList a -> b

foldl' :: (b -> a -> b) -> b -> ZipList a -> b

foldr1 :: (a -> a -> a) -> ZipList a -> a

foldl1 :: (a -> a -> a) -> ZipList a -> a

toList :: ZipList a -> [a]

null :: ZipList a -> Bool

length :: ZipList a -> Int

elem :: Eq a => a -> ZipList a -> Bool

maximum :: Ord a => ZipList a -> a

minimum :: Ord a => ZipList a -> a

sum :: Num a => ZipList a -> a

product :: Num a => ZipList a -> a

Foldable Complex 

Methods

fold :: Monoid m => Complex m -> m

foldMap :: Monoid m => (a -> m) -> Complex a -> m

foldr :: (a -> b -> b) -> b -> Complex a -> b

foldr' :: (a -> b -> b) -> b -> Complex a -> b

foldl :: (b -> a -> b) -> b -> Complex a -> b

foldl' :: (b -> a -> b) -> b -> Complex a -> b

foldr1 :: (a -> a -> a) -> Complex a -> a

foldl1 :: (a -> a -> a) -> Complex a -> a

toList :: Complex a -> [a]

null :: Complex a -> Bool

length :: Complex a -> Int

elem :: Eq a => a -> Complex a -> Bool

maximum :: Ord a => Complex a -> a

minimum :: Ord a => Complex a -> a

sum :: Num a => Complex a -> a

product :: Num a => Complex a -> a

Foldable NonEmpty 

Methods

fold :: Monoid m => NonEmpty m -> m

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b

foldr1 :: (a -> a -> a) -> NonEmpty a -> a

foldl1 :: (a -> a -> a) -> NonEmpty a -> a

toList :: NonEmpty a -> [a]

null :: NonEmpty a -> Bool

length :: NonEmpty a -> Int

elem :: Eq a => a -> NonEmpty a -> Bool

maximum :: Ord a => NonEmpty a -> a

minimum :: Ord a => NonEmpty a -> a

sum :: Num a => NonEmpty a -> a

product :: Num a => NonEmpty a -> a

Foldable Option 

Methods

fold :: Monoid m => Option m -> m

foldMap :: Monoid m => (a -> m) -> Option a -> m

foldr :: (a -> b -> b) -> b -> Option a -> b

foldr' :: (a -> b -> b) -> b -> Option a -> b

foldl :: (b -> a -> b) -> b -> Option a -> b

foldl' :: (b -> a -> b) -> b -> Option a -> b

foldr1 :: (a -> a -> a) -> Option a -> a

foldl1 :: (a -> a -> a) -> Option a -> a

toList :: Option a -> [a]

null :: Option a -> Bool

length :: Option a -> Int

elem :: Eq a => a -> Option a -> Bool

maximum :: Ord a => Option a -> a

minimum :: Ord a => Option a -> a

sum :: Num a => Option a -> a

product :: Num a => Option a -> a

Foldable Last 

Methods

fold :: Monoid m => Last m -> m

foldMap :: Monoid m => (a -> m) -> Last a -> m

foldr :: (a -> b -> b) -> b -> Last a -> b

foldr' :: (a -> b -> b) -> b -> Last a -> b

foldl :: (b -> a -> b) -> b -> Last a -> b

foldl' :: (b -> a -> b) -> b -> Last a -> b

foldr1 :: (a -> a -> a) -> Last a -> a

foldl1 :: (a -> a -> a) -> Last a -> a

toList :: Last a -> [a]

null :: Last a -> Bool

length :: Last a -> Int

elem :: Eq a => a -> Last a -> Bool

maximum :: Ord a => Last a -> a

minimum :: Ord a => Last a -> a

sum :: Num a => Last a -> a

product :: Num a => Last a -> a

Foldable First 

Methods

fold :: Monoid m => First m -> m

foldMap :: Monoid m => (a -> m) -> First a -> m

foldr :: (a -> b -> b) -> b -> First a -> b

foldr' :: (a -> b -> b) -> b -> First a -> b

foldl :: (b -> a -> b) -> b -> First a -> b

foldl' :: (b -> a -> b) -> b -> First a -> b

foldr1 :: (a -> a -> a) -> First a -> a

foldl1 :: (a -> a -> a) -> First a -> a

toList :: First a -> [a]

null :: First a -> Bool

length :: First a -> Int

elem :: Eq a => a -> First a -> Bool

maximum :: Ord a => First a -> a

minimum :: Ord a => First a -> a

sum :: Num a => First a -> a

product :: Num a => First a -> a

Foldable Max 

Methods

fold :: Monoid m => Max m -> m

foldMap :: Monoid m => (a -> m) -> Max a -> m

foldr :: (a -> b -> b) -> b -> Max a -> b

foldr' :: (a -> b -> b) -> b -> Max a -> b

foldl :: (b -> a -> b) -> b -> Max a -> b

foldl' :: (b -> a -> b) -> b -> Max a -> b

foldr1 :: (a -> a -> a) -> Max a -> a

foldl1 :: (a -> a -> a) -> Max a -> a

toList :: Max a -> [a]

null :: Max a -> Bool

length :: Max a -> Int

elem :: Eq a => a -> Max a -> Bool

maximum :: Ord a => Max a -> a

minimum :: Ord a => Max a -> a

sum :: Num a => Max a -> a

product :: Num a => Max a -> a

Foldable Min 

Methods

fold :: Monoid m => Min m -> m

foldMap :: Monoid m => (a -> m) -> Min a -> m

foldr :: (a -> b -> b) -> b -> Min a -> b

foldr' :: (a -> b -> b) -> b -> Min a -> b

foldl :: (b -> a -> b) -> b -> Min a -> b

foldl' :: (b -> a -> b) -> b -> Min a -> b

foldr1 :: (a -> a -> a) -> Min a -> a

foldl1 :: (a -> a -> a) -> Min a -> a

toList :: Min a -> [a]

null :: Min a -> Bool

length :: Min a -> Int

elem :: Eq a => a -> Min a -> Bool

maximum :: Ord a => Min a -> a

minimum :: Ord a => Min a -> a

sum :: Num a => Min a -> a

product :: Num a => Min a -> a

Foldable Identity 

Methods

fold :: Monoid m => Identity m -> m

foldMap :: Monoid m => (a -> m) -> Identity a -> m

foldr :: (a -> b -> b) -> b -> Identity a -> b

foldr' :: (a -> b -> b) -> b -> Identity a -> b

foldl :: (b -> a -> b) -> b -> Identity a -> b

foldl' :: (b -> a -> b) -> b -> Identity a -> b

foldr1 :: (a -> a -> a) -> Identity a -> a

foldl1 :: (a -> a -> a) -> Identity a -> a

toList :: Identity a -> [a]

null :: Identity a -> Bool

length :: Identity a -> Int

elem :: Eq a => a -> Identity a -> Bool

maximum :: Ord a => Identity a -> a

minimum :: Ord a => Identity a -> a

sum :: Num a => Identity a -> a

product :: Num a => Identity a -> a

Foldable (Either a) 

Methods

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

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

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

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

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

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

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

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

toList :: Either a a -> [a]

null :: Either a a -> Bool

length :: Either a a -> Int

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

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

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

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

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

Foldable ((,) a) 

Methods

fold :: Monoid m => (a, m) -> m

foldMap :: Monoid m => (a -> m) -> (a, a) -> m

foldr :: (a -> b -> b) -> b -> (a, a) -> b

foldr' :: (a -> b -> b) -> b -> (a, a) -> b

foldl :: (b -> a -> b) -> b -> (a, a) -> b

foldl' :: (b -> a -> b) -> b -> (a, a) -> b

foldr1 :: (a -> a -> a) -> (a, a) -> a

foldl1 :: (a -> a -> a) -> (a, a) -> a

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

null :: (a, a) -> Bool

length :: (a, a) -> Int

elem :: Eq a => a -> (a, a) -> Bool

maximum :: Ord a => (a, a) -> a

minimum :: Ord a => (a, a) -> a

sum :: Num a => (a, a) -> a

product :: Num a => (a, a) -> a

Foldable (Proxy (TYPE Lifted)) 

Methods

fold :: Monoid m => Proxy (TYPE Lifted) m -> m

foldMap :: Monoid m => (a -> m) -> Proxy (TYPE Lifted) a -> m

foldr :: (a -> b -> b) -> b -> Proxy (TYPE Lifted) a -> b

foldr' :: (a -> b -> b) -> b -> Proxy (TYPE Lifted) a -> b

foldl :: (b -> a -> b) -> b -> Proxy (TYPE Lifted) a -> b

foldl' :: (b -> a -> b) -> b -> Proxy (TYPE Lifted) a -> b

foldr1 :: (a -> a -> a) -> Proxy (TYPE Lifted) a -> a

foldl1 :: (a -> a -> a) -> Proxy (TYPE Lifted) a -> a

toList :: Proxy (TYPE Lifted) a -> [a]

null :: Proxy (TYPE Lifted) a -> Bool

length :: Proxy (TYPE Lifted) a -> Int

elem :: Eq a => a -> Proxy (TYPE Lifted) a -> Bool

maximum :: Ord a => Proxy (TYPE Lifted) a -> a

minimum :: Ord a => Proxy (TYPE Lifted) a -> a

sum :: Num a => Proxy (TYPE Lifted) a -> a

product :: Num a => Proxy (TYPE Lifted) a -> a

Foldable (Arg a) 

Methods

fold :: Monoid m => Arg a m -> m

foldMap :: Monoid m => (a -> m) -> Arg a a -> m

foldr :: (a -> b -> b) -> b -> Arg a a -> b

foldr' :: (a -> b -> b) -> b -> Arg a a -> b

foldl :: (b -> a -> b) -> b -> Arg a a -> b

foldl' :: (b -> a -> b) -> b -> Arg a a -> b

foldr1 :: (a -> a -> a) -> Arg a a -> a

foldl1 :: (a -> a -> a) -> Arg a a -> a

toList :: Arg a a -> [a]

null :: Arg a a -> Bool

length :: Arg a a -> Int

elem :: Eq a => a -> Arg a a -> Bool

maximum :: Ord a => Arg a a -> a

minimum :: Ord a => Arg a a -> a

sum :: Num a => Arg a a -> a

product :: Num a => Arg a a -> a

Foldable (Const (TYPE Lifted) m) 

Methods

fold :: Monoid m => Const (TYPE Lifted) m m -> m

foldMap :: Monoid m => (a -> m) -> Const (TYPE Lifted) m a -> m

foldr :: (a -> b -> b) -> b -> Const (TYPE Lifted) m a -> b

foldr' :: (a -> b -> b) -> b -> Const (TYPE Lifted) m a -> b

foldl :: (b -> a -> b) -> b -> Const (TYPE Lifted) m a -> b

foldl' :: (b -> a -> b) -> b -> Const (TYPE Lifted) m a -> b

foldr1 :: (a -> a -> a) -> Const (TYPE Lifted) m a -> a

foldl1 :: (a -> a -> a) -> Const (TYPE Lifted) m a -> a

toList :: Const (TYPE Lifted) m a -> [a]

null :: Const (TYPE Lifted) m a -> Bool

length :: Const (TYPE Lifted) m a -> Int

elem :: Eq a => a -> Const (TYPE Lifted) m a -> Bool

maximum :: Ord a => Const (TYPE Lifted) m a -> a

minimum :: Ord a => Const (TYPE Lifted) m a -> a

sum :: Num a => Const (TYPE Lifted) m a -> a

product :: Num a => Const (TYPE Lifted) m a -> a

(Foldable f, Foldable g) => Foldable (Product (TYPE Lifted) f g) 

Methods

fold :: Monoid m => Product (TYPE Lifted) f g m -> m

foldMap :: Monoid m => (a -> m) -> Product (TYPE Lifted) f g a -> m

foldr :: (a -> b -> b) -> b -> Product (TYPE Lifted) f g a -> b

foldr' :: (a -> b -> b) -> b -> Product (TYPE Lifted) f g a -> b

foldl :: (b -> a -> b) -> b -> Product (TYPE Lifted) f g a -> b

foldl' :: (b -> a -> b) -> b -> Product (TYPE Lifted) f g a -> b

foldr1 :: (a -> a -> a) -> Product (TYPE Lifted) f g a -> a

foldl1 :: (a -> a -> a) -> Product (TYPE Lifted) f g a -> a

toList :: Product (TYPE Lifted) f g a -> [a]

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

length :: Product (TYPE Lifted) f g a -> Int

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

maximum :: Ord a => Product (TYPE Lifted) f g a -> a

minimum :: Ord a => Product (TYPE Lifted) f g a -> a

sum :: Num a => Product (TYPE Lifted) f g a -> a

product :: Num a => Product (TYPE Lifted) f g a -> a

(Foldable f, Foldable g) => Foldable (Sum (TYPE Lifted) f g) 

Methods

fold :: Monoid m => Sum (TYPE Lifted) f g m -> m

foldMap :: Monoid m => (a -> m) -> Sum (TYPE Lifted) f g a -> m

foldr :: (a -> b -> b) -> b -> Sum (TYPE Lifted) f g a -> b

foldr' :: (a -> b -> b) -> b -> Sum (TYPE Lifted) f g a -> b

foldl :: (b -> a -> b) -> b -> Sum (TYPE Lifted) f g a -> b

foldl' :: (b -> a -> b) -> b -> Sum (TYPE Lifted) f g a -> b

foldr1 :: (a -> a -> a) -> Sum (TYPE Lifted) f g a -> a

foldl1 :: (a -> a -> a) -> Sum (TYPE Lifted) f g a -> a

toList :: Sum (TYPE Lifted) f g a -> [a]

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

length :: Sum (TYPE Lifted) f g a -> Int

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

maximum :: Ord a => Sum (TYPE Lifted) f g a -> a

minimum :: Ord a => Sum (TYPE Lifted) f g a -> a

sum :: Num a => Sum (TYPE Lifted) f g a -> a

product :: Num a => Sum (TYPE Lifted) f g a -> a

(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

foldMap :: Monoid m => (a -> m) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> m

foldr :: (a -> b -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b

foldr' :: (a -> b -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b

foldl :: (b -> a -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b

foldl' :: (b -> a -> b) -> b -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> b

foldr1 :: (a -> a -> a) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> a

foldl1 :: (a -> a -> a) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> a

toList :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> [a]

null :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> Bool

length :: Compose (TYPE Lifted) (TYPE Lifted) f g a -> Int

elem :: Eq a => a -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> Bool

maximum :: Ord a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a

minimum :: Ord a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a

sum :: Num a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a

product :: Num a => Compose (TYPE Lifted) (TYPE Lifted) f g a -> a

class (Functor t, Foldable t) => Traversable t where

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)

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)

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)

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)

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]

sequenceA :: Applicative f => [f a] -> f [a]

mapM :: Monad m => (a -> m b) -> [a] -> m [b]

sequence :: Monad m => [m a] -> m [a]

Traversable Maybe 

Methods

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

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

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

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

Traversable Last 

Methods

traverse :: Applicative f => (a -> f b) -> Last a -> f (Last b)

sequenceA :: Applicative f => Last (f a) -> f (Last a)

mapM :: Monad m => (a -> m b) -> Last a -> m (Last b)

sequence :: Monad m => Last (m a) -> m (Last a)

Traversable First 

Methods

traverse :: Applicative f => (a -> f b) -> First a -> f (First b)

sequenceA :: Applicative f => First (f a) -> f (First a)

mapM :: Monad m => (a -> m b) -> First a -> m (First b)

sequence :: Monad m => First (m a) -> m (First a)

Traversable Product 

Methods

traverse :: Applicative f => (a -> f b) -> Product a -> f (Product b)

sequenceA :: Applicative f => Product (f a) -> f (Product a)

mapM :: Monad m => (a -> m b) -> Product a -> m (Product b)

sequence :: Monad m => Product (m a) -> m (Product a)

Traversable Sum 

Methods

traverse :: Applicative f => (a -> f b) -> Sum a -> f (Sum b)

sequenceA :: Applicative f => Sum (f a) -> f (Sum a)

mapM :: Monad m => (a -> m b) -> Sum a -> m (Sum b)

sequence :: Monad m => Sum (m a) -> m (Sum a)

Traversable Dual 

Methods

traverse :: Applicative f => (a -> f b) -> Dual a -> f (Dual b)

sequenceA :: Applicative f => Dual (f a) -> f (Dual a)

mapM :: Monad m => (a -> m b) -> Dual a -> m (Dual b)

sequence :: Monad m => Dual (m a) -> m (Dual a)

Traversable ZipList 

Methods

traverse :: Applicative f => (a -> f b) -> ZipList a -> f (ZipList b)

sequenceA :: Applicative f => ZipList (f a) -> f (ZipList a)

mapM :: Monad m => (a -> m b) -> ZipList a -> m (ZipList b)

sequence :: Monad m => ZipList (m a) -> m (ZipList a)

Traversable Complex 

Methods

traverse :: Applicative f => (a -> f b) -> Complex a -> f (Complex b)

sequenceA :: Applicative f => Complex (f a) -> f (Complex a)

mapM :: Monad m => (a -> m b) -> Complex a -> m (Complex b)

sequence :: Monad m => Complex (m a) -> m (Complex a)

Traversable NonEmpty 

Methods

traverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b)

sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a)

mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b)

sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a)

Traversable Option 

Methods

traverse :: Applicative f => (a -> f b) -> Option a -> f (Option b)

sequenceA :: Applicative f => Option (f a) -> f (Option a)

mapM :: Monad m => (a -> m b) -> Option a -> m (Option b)

sequence :: Monad m => Option (m a) -> m (Option a)

Traversable Last 

Methods

traverse :: Applicative f => (a -> f b) -> Last a -> f (Last b)

sequenceA :: Applicative f => Last (f a) -> f (Last a)

mapM :: Monad m => (a -> m b) -> Last a -> m (Last b)

sequence :: Monad m => Last (m a) -> m (Last a)

Traversable First 

Methods

traverse :: Applicative f => (a -> f b) -> First a -> f (First b)

sequenceA :: Applicative f => First (f a) -> f (First a)

mapM :: Monad m => (a -> m b) -> First a -> m (First b)

sequence :: Monad m => First (m a) -> m (First a)

Traversable Max 

Methods

traverse :: Applicative f => (a -> f b) -> Max a -> f (Max b)

sequenceA :: Applicative f => Max (f a) -> f (Max a)

mapM :: Monad m => (a -> m b) -> Max a -> m (Max b)

sequence :: Monad m => Max (m a) -> m (Max a)

Traversable Min 

Methods

traverse :: Applicative f => (a -> f b) -> Min a -> f (Min b)

sequenceA :: Applicative f => Min (f a) -> f (Min a)

mapM :: Monad m => (a -> m b) -> Min a -> m (Min b)

sequence :: Monad m => Min (m a) -> m (Min a)

Traversable Identity 

Methods

traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b)

sequenceA :: Applicative f => Identity (f a) -> f (Identity a)

mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b)

sequence :: Monad m => Identity (m a) -> m (Identity a)

Traversable (Either a) 

Methods

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

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

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

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

Traversable ((,) a) 

Methods

traverse :: Applicative f => (a -> f b) -> (a, a) -> f (a, b)

sequenceA :: Applicative f => (a, f a) -> f (a, a)

mapM :: Monad m => (a -> m b) -> (a, a) -> m (a, b)

sequence :: Monad m => (a, m a) -> m (a, a)

Traversable (Proxy (TYPE Lifted)) 

Methods

traverse :: Applicative f => (a -> f b) -> Proxy (TYPE Lifted) a -> f (Proxy (TYPE Lifted) b)

sequenceA :: Applicative f => Proxy (TYPE Lifted) (f a) -> f (Proxy (TYPE Lifted) a)

mapM :: Monad m => (a -> m b) -> Proxy (TYPE Lifted) a -> m (Proxy (TYPE Lifted) b)

sequence :: Monad m => Proxy (TYPE Lifted) (m a) -> m (Proxy (TYPE Lifted) a)

Traversable (Arg a) 

Methods

traverse :: Applicative f => (a -> f b) -> Arg a a -> f (Arg a b)

sequenceA :: Applicative f => Arg a (f a) -> f (Arg a a)

mapM :: Monad m => (a -> m b) -> Arg a a -> m (Arg a b)

sequence :: Monad m => Arg a (m a) -> m (Arg a a)

Traversable (Const (TYPE Lifted) m) 

Methods

traverse :: Applicative f => (a -> f b) -> Const (TYPE Lifted) m a -> f (Const (TYPE Lifted) m b)

sequenceA :: Applicative f => Const (TYPE Lifted) m (f a) -> f (Const (TYPE Lifted) m a)

mapM :: Monad m => (a -> m b) -> Const (TYPE Lifted) m a -> m (Const (TYPE Lifted) m b)

sequence :: Monad m => Const (TYPE Lifted) m (m a) -> m (Const (TYPE Lifted) m a)

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

sequenceA :: Applicative f => Product (TYPE Lifted) f g (f a) -> f (Product (TYPE Lifted) f g a)

mapM :: Monad m => (a -> m b) -> Product (TYPE Lifted) f g a -> m (Product (TYPE Lifted) f g b)

sequence :: Monad m => Product (TYPE Lifted) f g (m a) -> m (Product (TYPE Lifted) f g a)

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

sequenceA :: Applicative f => Sum (TYPE Lifted) f g (f a) -> f (Sum (TYPE Lifted) f g a)

mapM :: Monad m => (a -> m b) -> Sum (TYPE Lifted) f g a -> m (Sum (TYPE Lifted) f g b)

sequence :: Monad m => Sum (TYPE Lifted) f g (m a) -> m (Sum (TYPE Lifted) f g a)

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

sequenceA :: Applicative f => Compose (TYPE Lifted) (TYPE Lifted) f g (f a) -> f (Compose (TYPE Lifted) (TYPE Lifted) f g a)

mapM :: Monad m => (a -> m b) -> Compose (TYPE Lifted) (TYPE Lifted) f g a -> m (Compose (TYPE Lifted) (TYPE Lifted) f g b)

sequence :: Monad m => Compose (TYPE Lifted) (TYPE Lifted) f g (m a) -> m (Compose (TYPE Lifted) (TYPE Lifted) f g a)

Miscellaneous functions

id :: a -> a

Identity function.

const :: a -> b -> a

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

Function composition.

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

flip f takes its (first) two arguments in the reverse order of f.

($) :: (a -> b) -> a -> b infixr 0

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

until p f yields the result of applying f until p holds.

asTypeOf :: a -> a -> a

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 :: (?callStack :: CallStack) => [Char] -> a

error stops execution and displays an error message.

errorWithoutStackTrace :: [Char] -> a

A variant of error that does not produce a stack trace.

Since: 4.9.0.0

undefined :: (?callStack :: CallStack) => a

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

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]

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

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]

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

Extract the first element of a list, which must be non-empty.

last :: [a] -> a

Extract the last element of a list, which must be finite and non-empty.

tail :: [a] -> [a]

Extract the elements after the head of a list, which must be non-empty.

init :: [a] -> [a]

Return all the elements of a list except the last one. The list must be non-empty.

null :: Foldable t => t a -> Bool

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

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

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]

reverse xs returns the elements of xs in reverse order. xs must be finite.

Special folds

and :: Foldable t => t Bool -> Bool

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

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

Determines whether any element of the structure satisfies the predicate.

all :: Foldable t => (a -> Bool) -> t a -> Bool

Determines whether all elements of the structure satisfy the predicate.

concat :: Foldable t => t [a] -> [a]

The concatenation of all the elements of a container of lists.

concatMap :: Foldable t => (a -> [b]) -> t a -> [b]

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]

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]

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]

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]

scanr1 is a variant of scanr that has no starting value argument.

Infinite lists

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

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]

repeat x is an infinite list, with x the value of every element.

replicate :: Int -> a -> [a]

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]

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]

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]

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

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]

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]

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

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

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

notElem is the negation of elem.

lookup :: Eq a => a -> [(a, b)] -> Maybe b

lookup key assocs looks up a key in an association list.

Zipping and unzipping lists

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

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

zip3 takes three lists and returns a list of triples, analogous to zip.

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

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]

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

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

The unzip3 function takes a list of triples and returns three lists, analogous to unzip.

Functions on strings

lines :: String -> [String]

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]

words breaks a string up into a list of words, which were delimited by white space.

unlines :: [String] -> String

unlines is an inverse operation to lines. It joins lines, after appending a terminating newline to each.

unwords :: [String] -> String

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

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

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

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

A specialised variant of showsPrec, using precedence context zero, and returning an ordinary String.

showList :: [a] -> ShowS

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 

Methods

showsPrec :: Int -> Bool -> ShowS

show :: Bool -> String

showList :: [Bool] -> ShowS

Show Char 

Methods

showsPrec :: Int -> Char -> ShowS

show :: Char -> String

showList :: [Char] -> ShowS

Show Int 

Methods

showsPrec :: Int -> Int -> ShowS

show :: Int -> String

showList :: [Int] -> ShowS

Show Int8 

Methods

showsPrec :: Int -> Int8 -> ShowS

show :: Int8 -> String

showList :: [Int8] -> ShowS

Show Int16 

Methods

showsPrec :: Int -> Int16 -> ShowS

show :: Int16 -> String

showList :: [Int16] -> ShowS

Show Int32 

Methods

showsPrec :: Int -> Int32 -> ShowS

show :: Int32 -> String

showList :: [Int32] -> ShowS

Show Int64 

Methods

showsPrec :: Int -> Int64 -> ShowS

show :: Int64 -> String

showList :: [Int64] -> ShowS

Show Integer 
Show Ordering 
Show Word 

Methods

showsPrec :: Int -> Word -> ShowS

show :: Word -> String

showList :: [Word] -> ShowS

Show Word8 

Methods

showsPrec :: Int -> Word8 -> ShowS

show :: Word8 -> String

showList :: [Word8] -> ShowS

Show Word16 
Show Word32 
Show Word64 
Show TypeRep 
Show () 

Methods

showsPrec :: Int -> () -> ShowS

show :: () -> String

showList :: [()] -> ShowS

Show Module 
Show TrName 
Show TyCon 

Methods

showsPrec :: Int -> TyCon -> ShowS

show :: TyCon -> String

showList :: [TyCon] -> ShowS

Show SomeException 
Show GeneralCategory 
Show Number 
Show Lexeme 
Show SomeSymbol 
Show SomeNat 
Show DecidedStrictness 
Show SourceStrictness 
Show SourceUnpackedness 
Show Associativity 
Show Fixity 
Show Any 

Methods

showsPrec :: Int -> Any -> ShowS

show :: Any -> String

showList :: [Any] -> ShowS

Show All 

Methods

showsPrec :: Int -> All -> ShowS

show :: All -> String

showList :: [All] -> ShowS

Show IOMode 
Show Fingerprint 
Show CUIntMax 
Show CIntMax 
Show CUIntPtr 
Show CIntPtr 
Show CSUSeconds 
Show CUSeconds 
Show CTime 

Methods

showsPrec :: Int -> CTime -> ShowS

show :: CTime -> String

showList :: [CTime] -> ShowS

Show CClock 
Show CSigAtomic 
Show CWchar 
Show CSize 

Methods

showsPrec :: Int -> CSize -> ShowS

show :: CSize -> String

showList :: [CSize] -> ShowS

Show CPtrdiff 
Show CDouble 
Show CFloat 
Show CULLong 
Show CLLong 
Show CULong 
Show CLong 

Methods

showsPrec :: Int -> CLong -> ShowS

show :: CLong -> String

showList :: [CLong] -> ShowS

Show CUInt 

Methods

showsPrec :: Int -> CUInt -> ShowS

show :: CUInt -> String

showList :: [CUInt] -> ShowS

Show CInt 

Methods

showsPrec :: Int -> CInt -> ShowS

show :: CInt -> String

showList :: [CInt] -> ShowS

Show CUShort 
Show CShort 
Show CUChar 
Show CSChar 
Show CChar 

Methods

showsPrec :: Int -> CChar -> ShowS

show :: CChar -> String

showList :: [CChar] -> ShowS

Show IntPtr 
Show WordPtr 
Show ArithException 
Show ErrorCall 
Show Dynamic 
Show IOException 
Show MaskingState 
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 CodingFailureMode 
Show Fd 

Methods

showsPrec :: Int -> Fd -> ShowS

show :: Fd -> String

showList :: [Fd] -> ShowS

Show CRLim 

Methods

showsPrec :: Int -> CRLim -> ShowS

show :: CRLim -> String

showList :: [CRLim] -> ShowS

Show CTcflag 
Show CSpeed 
Show CCc 

Methods

showsPrec :: Int -> CCc -> ShowS

show :: CCc -> String

showList :: [CCc] -> ShowS

Show CUid 

Methods

showsPrec :: Int -> CUid -> ShowS

show :: CUid -> String

showList :: [CUid] -> ShowS

Show CNlink 
Show CGid 

Methods

showsPrec :: Int -> CGid -> ShowS

show :: CGid -> String

showList :: [CGid] -> ShowS

Show CSsize 
Show CPid 

Methods

showsPrec :: Int -> CPid -> ShowS

show :: CPid -> String

showList :: [CPid] -> ShowS

Show COff 

Methods

showsPrec :: Int -> COff -> ShowS

show :: COff -> String

showList :: [COff] -> ShowS

Show CMode 

Methods

showsPrec :: Int -> CMode -> ShowS

show :: CMode -> String

showList :: [CMode] -> ShowS

Show CIno 

Methods

showsPrec :: Int -> CIno -> ShowS

show :: CIno -> String

showList :: [CIno] -> ShowS

Show CDev 

Methods

showsPrec :: Int -> CDev -> ShowS

show :: CDev -> String

showList :: [CDev] -> ShowS

Show Lifetime 
Show Event 

Methods

showsPrec :: Int -> Event -> ShowS

show :: Event -> String

showList :: [Event] -> ShowS

Show ThreadStatus 
Show BlockReason 
Show ThreadId 
Show NestedAtomically 
Show NonTermination 
Show TypeError 
Show NoMethodError 
Show RecUpdError 
Show RecConError 
Show RecSelError 
Show PatternMatchFail 
Show FdKey 

Methods

showsPrec :: Int -> FdKey -> ShowS

show :: FdKey -> String

showList :: [FdKey] -> ShowS

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 

Methods

showsPrec :: Int -> Void -> ShowS

show :: Void -> String

showList :: [Void] -> ShowS

Show a => Show [a] 

Methods

showsPrec :: Int -> [a] -> ShowS

show :: [a] -> String

showList :: [[a]] -> ShowS

Show a => Show (Maybe a) 

Methods

showsPrec :: Int -> Maybe a -> ShowS

show :: Maybe a -> String

showList :: [Maybe a] -> ShowS

Show a => Show (Ratio a) 

Methods

showsPrec :: Int -> Ratio a -> ShowS

show :: Ratio a -> String

showList :: [Ratio a] -> ShowS

Show (Ptr a) 

Methods

showsPrec :: Int -> Ptr a -> ShowS

show :: Ptr a -> String

showList :: [Ptr a] -> ShowS

Show (FunPtr a) 

Methods

showsPrec :: Int -> FunPtr a -> ShowS

show :: FunPtr a -> String

showList :: [FunPtr a] -> ShowS

Show (U1 p) 

Methods

showsPrec :: Int -> U1 p -> ShowS

show :: U1 p -> String

showList :: [U1 p] -> ShowS

Show p => Show (Par1 p) 

Methods

showsPrec :: Int -> Par1 p -> ShowS

show :: Par1 p -> String

showList :: [Par1 p] -> ShowS

Show a => Show (Down a) 

Methods

showsPrec :: Int -> Down a -> ShowS

show :: Down a -> String

showList :: [Down a] -> ShowS

Show a => Show (Last a) 

Methods

showsPrec :: Int -> Last a -> ShowS

show :: Last a -> String

showList :: [Last a] -> ShowS

Show a => Show (First a) 

Methods

showsPrec :: Int -> First a -> ShowS

show :: First a -> String

showList :: [First a] -> ShowS

Show a => Show (Product a) 

Methods

showsPrec :: Int -> Product a -> ShowS

show :: Product a -> String

showList :: [Product a] -> ShowS

Show a => Show (Sum a) 

Methods

showsPrec :: Int -> Sum a -> ShowS

show :: Sum a -> String

showList :: [Sum a] -> ShowS

Show a => Show (Dual a) 

Methods

showsPrec :: Int -> Dual a -> ShowS

show :: Dual a -> String

showList :: [Dual a] -> ShowS

Show (ForeignPtr a) 
Show a => Show (ZipList a) 

Methods

showsPrec :: Int -> ZipList a -> ShowS

show :: ZipList a -> String

showList :: [ZipList a] -> ShowS

Show a => Show (Complex a) 

Methods

showsPrec :: Int -> Complex a -> ShowS

show :: Complex a -> String

showList :: [Complex a] -> ShowS

HasResolution a => Show (Fixed a) 

Methods

showsPrec :: Int -> Fixed a -> ShowS

show :: Fixed a -> String

showList :: [Fixed a] -> ShowS

Show a => Show (NonEmpty a) 

Methods

showsPrec :: Int -> NonEmpty a -> ShowS

show :: NonEmpty a -> String

showList :: [NonEmpty a] -> ShowS

Show a => Show (Option a) 

Methods

showsPrec :: Int -> Option a -> ShowS

show :: Option a -> String

showList :: [Option a] -> ShowS

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

Methods

showsPrec :: Int -> Last a -> ShowS

show :: Last a -> String

showList :: [Last a] -> ShowS

Show a => Show (First a) 

Methods

showsPrec :: Int -> First a -> ShowS

show :: First a -> String

showList :: [First a] -> ShowS

Show a => Show (Max a) 

Methods

showsPrec :: Int -> Max a -> ShowS

show :: Max a -> String

showList :: [Max a] -> ShowS

Show a => Show (Min a) 

Methods

showsPrec :: Int -> Min a -> ShowS

show :: Min a -> String

showList :: [Min a] -> ShowS

Show a => Show (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Methods

showsPrec :: Int -> Identity a -> ShowS

show :: Identity a -> String

showList :: [Identity a] -> ShowS

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

Methods

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

show :: Either a b -> String

showList :: [Either a b] -> ShowS

Show (f p) => Show (Rec1 f p) 

Methods

showsPrec :: Int -> Rec1 f p -> ShowS

show :: Rec1 f p -> String

showList :: [Rec1 f p] -> ShowS

Show (URec Char _p) 

Methods

showsPrec :: Int -> URec Char _p -> ShowS

show :: URec Char _p -> String

showList :: [URec Char _p] -> ShowS

Show (URec Double _p) 

Methods

showsPrec :: Int -> URec Double _p -> ShowS

show :: URec Double _p -> String

showList :: [URec Double _p] -> ShowS

Show (URec Float _p) 

Methods

showsPrec :: Int -> URec Float _p -> ShowS

show :: URec Float _p -> String

showList :: [URec Float _p] -> ShowS

Show (URec Int _p) 

Methods

showsPrec :: Int -> URec Int _p -> ShowS

show :: URec Int _p -> String

showList :: [URec Int _p] -> ShowS

Show (URec Word _p) 

Methods

showsPrec :: Int -> URec Word _p -> ShowS

show :: URec Word _p -> String

showList :: [URec Word _p] -> ShowS

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

Methods

showsPrec :: Int -> (a, b) -> ShowS

show :: (a, b) -> String

showList :: [(a, b)] -> ShowS

Show (ST s a) 

Methods

showsPrec :: Int -> ST s a -> ShowS

show :: ST s a -> String

showList :: [ST s a] -> ShowS

Show (Proxy k s) 

Methods

showsPrec :: Int -> Proxy k s -> ShowS

show :: Proxy k s -> String

showList :: [Proxy k s] -> ShowS

(Show a, Show b) => Show (Arg a b) 

Methods

showsPrec :: Int -> Arg a b -> ShowS

show :: Arg a b -> String

showList :: [Arg a b] -> ShowS

Show c => Show (K1 i c p) 

Methods

showsPrec :: Int -> K1 i c p -> ShowS

show :: K1 i c p -> String

showList :: [K1 i c p] -> ShowS

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

Methods

showsPrec :: Int -> (f :+: g) p -> ShowS

show :: (f :+: g) p -> String

showList :: [(f :+: g) p] -> ShowS

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

Methods

showsPrec :: Int -> (f :*: g) p -> ShowS

show :: (f :*: g) p -> String

showList :: [(f :*: g) p] -> ShowS

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

Methods

showsPrec :: Int -> (f :.: g) p -> ShowS

show :: (f :.: g) p -> String

showList :: [(f :.: g) p] -> ShowS

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

Methods

showsPrec :: Int -> (a, b, c) -> ShowS

show :: (a, b, c) -> String

showList :: [(a, b, c)] -> ShowS

Show ((:~:) k a b) 

Methods

showsPrec :: Int -> (k :~: a) b -> ShowS

show :: (k :~: a) b -> String

showList :: [(k :~: a) b] -> ShowS

Show (Coercion k a b) 

Methods

showsPrec :: Int -> Coercion k a b -> ShowS

show :: Coercion k a b -> String

showList :: [Coercion k a b] -> ShowS

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

Methods

showsPrec :: Int -> Alt k f a -> ShowS

show :: Alt k f a -> String

showList :: [Alt k f a] -> ShowS

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

show :: Const k a b -> String

showList :: [Const k a b] -> ShowS

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

Methods

showsPrec :: Int -> M1 i c f p -> ShowS

show :: M1 i c f p -> String

showList :: [M1 i c f p] -> ShowS

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

Methods

showsPrec :: Int -> (a, b, c, d) -> ShowS

show :: (a, b, c, d) -> String

showList :: [(a, b, c, d)] -> ShowS

(Show1 f, Show1 g, Show a) => Show (Product (TYPE Lifted) f g a) 

Methods

showsPrec :: Int -> Product (TYPE Lifted) f g a -> ShowS

show :: Product (TYPE Lifted) f g a -> String

showList :: [Product (TYPE Lifted) f g a] -> ShowS

(Show1 f, Show1 g, Show a) => Show (Sum (TYPE Lifted) f g a) 

Methods

showsPrec :: Int -> Sum (TYPE Lifted) f g a -> ShowS

show :: Sum (TYPE Lifted) f g a -> String

showList :: [Sum (TYPE Lifted) f g a] -> ShowS

(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

show :: (a, b, c, d, e) -> String

showList :: [(a, b, c, d, e)] -> ShowS

(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

show :: (a, b, c, d, e, f) -> String

showList :: [(a, b, c, d, e, f)] -> ShowS

(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

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

showList :: [(a, b, c, d, e, f, g)] -> ShowS

(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

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

showList :: [(a, b, c, d, e, f, g, h)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i) -> String

showList :: [(a, b, c, d, e, f, g, h, i)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i, j) -> String

showList :: [(a, b, c, d, e, f, g, h, i, j)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i, j, k) -> String

showList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i, j, k, l) -> String

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> String

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> String

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> ShowS

(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

show :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> String

showList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> ShowS

shows :: Show a => a -> ShowS

equivalent to showsPrec with a precedence of 0.

showChar :: Char -> ShowS

utility function converting a Char to a show function that simply prepends the character unchanged.

showString :: String -> ShowS

utility function converting a String to a show function that simply prepends the string unchanged.

showParen :: Bool -> ShowS -> ShowS

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

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

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

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]

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] 

Methods

readsPrec :: Int -> ReadS [a]

readList :: ReadS [[a]]

readPrec :: ReadPrec [a]

readListPrec :: ReadPrec [[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) 

Methods

readsPrec :: Int -> ReadS (Rec1 f p)

readList :: ReadS [Rec1 f p]

readPrec :: ReadPrec (Rec1 f p)

readListPrec :: ReadPrec [Rec1 f p]

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

Methods

readsPrec :: Int -> ReadS (a, b)

readList :: ReadS [(a, b)]

readPrec :: ReadPrec (a, b)

readListPrec :: ReadPrec [(a, b)]

Read (Proxy k s) 
(Read a, Read b) => Read (Arg a b) 

Methods

readsPrec :: Int -> ReadS (Arg a b)

readList :: ReadS [Arg a b]

readPrec :: ReadPrec (Arg a b)

readListPrec :: ReadPrec [Arg a b]

Read c => Read (K1 i c p) 

Methods

readsPrec :: Int -> ReadS (K1 i c p)

readList :: ReadS [K1 i c p]

readPrec :: ReadPrec (K1 i c p)

readListPrec :: ReadPrec [K1 i c p]

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

Methods

readsPrec :: Int -> ReadS ((f :+: g) p)

readList :: ReadS [(f :+: g) p]

readPrec :: ReadPrec ((f :+: g) p)

readListPrec :: ReadPrec [(f :+: g) p]

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

Methods

readsPrec :: Int -> ReadS ((f :*: g) p)

readList :: ReadS [(f :*: g) p]

readPrec :: ReadPrec ((f :*: g) p)

readListPrec :: ReadPrec [(f :*: g) p]

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

Methods

readsPrec :: Int -> ReadS ((f :.: g) p)

readList :: ReadS [(f :.: g) p]

readPrec :: ReadPrec ((f :.: g) p)

readListPrec :: ReadPrec [(f :.: g) p]

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

Methods

readsPrec :: Int -> ReadS (a, b, c)

readList :: ReadS [(a, b, c)]

readPrec :: ReadPrec (a, b, c)

readListPrec :: ReadPrec [(a, b, c)]

(~) k a b => Read ((:~:) k a b) 

Methods

readsPrec :: Int -> ReadS ((k :~: a) b)

readList :: ReadS [(k :~: a) b]

readPrec :: ReadPrec ((k :~: a) b)

readListPrec :: ReadPrec [(k :~: a) b]

Coercible k a b => Read (Coercion k a b) 
Read (f a) => Read (Alt k f a) 

Methods

readsPrec :: Int -> ReadS (Alt k f a)

readList :: ReadS [Alt k f a]

readPrec :: ReadPrec (Alt k f a)

readListPrec :: ReadPrec [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

Methods

readsPrec :: Int -> ReadS (Const k a b)

readList :: ReadS [Const k a b]

readPrec :: ReadPrec (Const k a b)

readListPrec :: ReadPrec [Const k a b]

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

Methods

readsPrec :: Int -> ReadS (M1 i c f p)

readList :: ReadS [M1 i c f p]

readPrec :: ReadPrec (M1 i c f p)

readListPrec :: ReadPrec [M1 i c f p]

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

Methods

readsPrec :: Int -> ReadS (a, b, c, d)

readList :: ReadS [(a, b, c, d)]

readPrec :: ReadPrec (a, b, c, d)

readListPrec :: ReadPrec [(a, b, c, d)]

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

Methods

readsPrec :: Int -> ReadS (Sum (TYPE Lifted) f g a)

readList :: ReadS [Sum (TYPE Lifted) f g a]

readPrec :: ReadPrec (Sum (TYPE Lifted) f g a)

readListPrec :: ReadPrec [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)

readList :: ReadS [(a, b, c, d, e)]

readPrec :: ReadPrec (a, b, c, d, e)

readListPrec :: ReadPrec [(a, b, c, d, e)]

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

readList :: ReadS [(a, b, c, d, e, f)]

readPrec :: ReadPrec (a, b, c, d, e, f)

readListPrec :: ReadPrec [(a, b, c, d, e, f)]

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

readList :: ReadS [(a, b, c, d, e, f, g)]

readPrec :: ReadPrec (a, b, c, d, e, f, g)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l, m)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l, m, n)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)]

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

readList :: ReadS [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)]

readPrec :: ReadPrec (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

readListPrec :: ReadPrec [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)]

reads :: Read a => ReadS a

equivalent to readsPrec with a precedence of 0.

readParen :: Bool -> ReadS a -> ReadS a

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

The read function reads input from a string, which must be completely consumed by the input process.

lex :: ReadS String

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

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

return :: a -> IO a

fail :: String -> IO a

Functor IO 

Methods

fmap :: (a -> b) -> IO a -> IO b

(<$) :: a -> IO b -> IO a

MonadFix IO 

Methods

mfix :: (a -> IO a) -> IO a

MonadFail IO 

Methods

fail :: String -> IO a

Applicative IO 

Methods

pure :: a -> IO a

(<*>) :: IO (a -> b) -> IO a -> IO b

(*>) :: IO a -> IO b -> IO b

(<*) :: IO a -> IO b -> IO a

MonadPlus IO 

Methods

mzero :: IO a

mplus :: IO a -> IO a -> IO a

Alternative IO 

Methods

empty :: IO a

(<|>) :: IO a -> IO a -> IO a

some :: IO a -> IO [a]

many :: IO a -> IO [a]

MonadIO IO 

Methods

liftIO :: IO a -> IO a

Monoid a => Monoid (IO a) 

Methods

mempty :: IO a

mappend :: IO a -> IO a -> IO a

mconcat :: [IO a] -> IO a

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

Write a character to the standard output device (same as hPutChar stdout).

putStr :: String -> IO ()

Write a string to the standard output device (same as hPutStr stdout).

putStrLn :: String -> IO ()

The same as putStr, but adds a newline character.

print :: Show a => a -> IO ()

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

Read a character from the standard input device (same as hGetChar stdin).

getLine :: IO String

Read a line from the standard input device (same as hGetLine stdin).

getContents :: IO String

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

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

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

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

The computation writeFile file str function writes the string str, to the file file.

appendFile :: FilePath -> String -> IO ()

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

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

The readLn function combines getLine and readIO.

Exception handling in the I/O monad

type IOError = IOException

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

Raise an IOError in the IO monad.

userError :: String -> IOError

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)