foundation-0.0.5: Alternative prelude with batteries and no dependencies

Foundation

Description

I tried to picture clusters of information As they moved through the computer What do they look like?

Alternative Prelude

Synopsis

# Standard

## Operators

($) :: (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. ($!) :: (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.

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

Boolean "and"

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

Boolean "or"

(.) :: Category k cat => forall b c a. cat b c -> cat a b -> cat a c #

morphism composition

## Functions

not :: Bool -> Bool #

Boolean "not"

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

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

data Tuple2 a b Source #

Strict tuple (a,b)

Constructors

 Tuple2 !a !b

Instances

 Source # Methodsbimap :: (a -> b) -> (c -> d) -> Tuple2 a c -> Tuple2 b d #first :: (a -> b) -> Tuple2 a c -> Tuple2 b c #second :: (b -> c) -> Tuple2 a b -> Tuple2 a c # Nthable 1 (Tuple2 a b) Source # Associated Typestype NthTy (1 :: Nat) (Tuple2 a b) :: * Source # Methodsnth :: proxy 1 -> Tuple2 a b -> NthTy 1 (Tuple2 a b) Source # Nthable 2 (Tuple2 a b) Source # Associated Typestype NthTy (2 :: Nat) (Tuple2 a b) :: * Source # Methodsnth :: proxy 2 -> Tuple2 a b -> NthTy 2 (Tuple2 a b) Source # (Eq b, Eq a) => Eq (Tuple2 a b) Source # Methods(==) :: Tuple2 a b -> Tuple2 a b -> Bool #(/=) :: Tuple2 a b -> Tuple2 a b -> Bool # (Data b, Data a) => Data (Tuple2 a b) Source # Methodsgfoldl :: (forall d c. Data d => c (d -> c) -> d -> c c) -> (forall g. g -> c g) -> Tuple2 a b -> c (Tuple2 a b) #gunfold :: (forall c r. Data c => c (c -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Tuple2 a b) #toConstr :: Tuple2 a b -> Constr #dataTypeOf :: Tuple2 a b -> DataType #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Tuple2 a b)) #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Tuple2 a b)) #gmapT :: (forall c. Data c => c -> c) -> Tuple2 a b -> Tuple2 a b #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tuple2 a b -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tuple2 a b -> r #gmapQ :: (forall d. Data d => d -> u) -> Tuple2 a b -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Tuple2 a b -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tuple2 a b -> m (Tuple2 a b) #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tuple2 a b -> m (Tuple2 a b) #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tuple2 a b -> m (Tuple2 a b) # (Ord b, Ord a) => Ord (Tuple2 a b) Source # Methodscompare :: Tuple2 a b -> Tuple2 a b -> Ordering #(<) :: Tuple2 a b -> Tuple2 a b -> Bool #(<=) :: Tuple2 a b -> Tuple2 a b -> Bool #(>) :: Tuple2 a b -> Tuple2 a b -> Bool #(>=) :: Tuple2 a b -> Tuple2 a b -> Bool #max :: Tuple2 a b -> Tuple2 a b -> Tuple2 a b #min :: Tuple2 a b -> Tuple2 a b -> Tuple2 a b # (Show b, Show a) => Show (Tuple2 a b) Source # MethodsshowsPrec :: Int -> Tuple2 a b -> ShowS #show :: Tuple2 a b -> String #showList :: [Tuple2 a b] -> ShowS # Generic (Tuple2 a b) Source # Associated Typestype Rep (Tuple2 a b) :: * -> * # Methodsfrom :: Tuple2 a b -> Rep (Tuple2 a b) x #to :: Rep (Tuple2 a b) x -> Tuple2 a b # Sndable (Tuple2 a b) Source # Associated Typestype ProductSecond (Tuple2 a b) :: * Source # Methodssnd :: Tuple2 a b -> ProductSecond (Tuple2 a b) Source # Fstable (Tuple2 a b) Source # Associated Typestype ProductFirst (Tuple2 a b) :: * Source # Methodsfst :: Tuple2 a b -> ProductFirst (Tuple2 a b) Source # (Hashable a, Hashable b) => Hashable (Tuple2 a b) Source # MethodshashMix :: Hasher st => Tuple2 a b -> st -> st Source # type NthTy 1 (Tuple2 a b) Source # type NthTy 1 (Tuple2 a b) = a type NthTy 2 (Tuple2 a b) Source # type NthTy 2 (Tuple2 a b) = b type Rep (Tuple2 a b) Source # type Rep (Tuple2 a b) = D1 (MetaData "Tuple2" "Foundation.Tuple" "foundation-0.0.5-2y8kRfBAQmDFaEaZhtknbm" False) (C1 (MetaCons "Tuple2" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)))) type ProductSecond (Tuple2 a b) Source # type ProductSecond (Tuple2 a b) = b type ProductFirst (Tuple2 a b) Source # type ProductFirst (Tuple2 a b) = a

data Tuple3 a b c Source #

Strict tuple (a,b,c)

Constructors

 Tuple3 !a !b !c

Instances

 Nthable 1 (Tuple3 a b c) Source # Associated Typestype NthTy (1 :: Nat) (Tuple3 a b c) :: * Source # Methodsnth :: proxy 1 -> Tuple3 a b c -> NthTy 1 (Tuple3 a b c) Source # Nthable 2 (Tuple3 a b c) Source # Associated Typestype NthTy (2 :: Nat) (Tuple3 a b c) :: * Source # Methodsnth :: proxy 2 -> Tuple3 a b c -> NthTy 2 (Tuple3 a b c) Source # Nthable 3 (Tuple3 a b c) Source # Associated Typestype NthTy (3 :: Nat) (Tuple3 a b c) :: * Source # Methodsnth :: proxy 3 -> Tuple3 a b c -> NthTy 3 (Tuple3 a b c) Source # (Eq c, Eq b, Eq a) => Eq (Tuple3 a b c) Source # Methods(==) :: Tuple3 a b c -> Tuple3 a b c -> Bool #(/=) :: Tuple3 a b c -> Tuple3 a b c -> Bool # (Data c, Data b, Data a) => Data (Tuple3 a b c) Source # Methodsgfoldl :: (forall d e. Data d => c (d -> e) -> d -> c e) -> (forall g. g -> c g) -> Tuple3 a b c -> c (Tuple3 a b c) #gunfold :: (forall d r. Data d => c (d -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Tuple3 a b c) #toConstr :: Tuple3 a b c -> Constr #dataTypeOf :: Tuple3 a b c -> DataType #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Tuple3 a b c)) #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Tuple3 a b c)) #gmapT :: (forall d. Data d => d -> d) -> Tuple3 a b c -> Tuple3 a b c #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tuple3 a b c -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tuple3 a b c -> r #gmapQ :: (forall d. Data d => d -> u) -> Tuple3 a b c -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Tuple3 a b c -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tuple3 a b c -> m (Tuple3 a b c) #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tuple3 a b c -> m (Tuple3 a b c) #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tuple3 a b c -> m (Tuple3 a b c) # (Ord c, Ord b, Ord a) => Ord (Tuple3 a b c) Source # Methodscompare :: Tuple3 a b c -> Tuple3 a b c -> Ordering #(<) :: Tuple3 a b c -> Tuple3 a b c -> Bool #(<=) :: Tuple3 a b c -> Tuple3 a b c -> Bool #(>) :: Tuple3 a b c -> Tuple3 a b c -> Bool #(>=) :: Tuple3 a b c -> Tuple3 a b c -> Bool #max :: Tuple3 a b c -> Tuple3 a b c -> Tuple3 a b c #min :: Tuple3 a b c -> Tuple3 a b c -> Tuple3 a b c # (Show c, Show b, Show a) => Show (Tuple3 a b c) Source # MethodsshowsPrec :: Int -> Tuple3 a b c -> ShowS #show :: Tuple3 a b c -> String #showList :: [Tuple3 a b c] -> ShowS # Generic (Tuple3 a b c) Source # Associated Typestype Rep (Tuple3 a b c) :: * -> * # Methodsfrom :: Tuple3 a b c -> Rep (Tuple3 a b c) x #to :: Rep (Tuple3 a b c) x -> Tuple3 a b c # Thdable (Tuple3 a b c) Source # Associated Typestype ProductThird (Tuple3 a b c) :: * Source # Methodsthd :: Tuple3 a b c -> ProductThird (Tuple3 a b c) Source # Sndable (Tuple3 a b c) Source # Associated Typestype ProductSecond (Tuple3 a b c) :: * Source # Methodssnd :: Tuple3 a b c -> ProductSecond (Tuple3 a b c) Source # Fstable (Tuple3 a b c) Source # Associated Typestype ProductFirst (Tuple3 a b c) :: * Source # Methodsfst :: Tuple3 a b c -> ProductFirst (Tuple3 a b c) Source # (Hashable a, Hashable b, Hashable c) => Hashable (Tuple3 a b c) Source # MethodshashMix :: Hasher st => Tuple3 a b c -> st -> st Source # type NthTy 1 (Tuple3 a b c) Source # type NthTy 1 (Tuple3 a b c) = a type NthTy 2 (Tuple3 a b c) Source # type NthTy 2 (Tuple3 a b c) = b type NthTy 3 (Tuple3 a b c) Source # type NthTy 3 (Tuple3 a b c) = c type Rep (Tuple3 a b c) Source # type Rep (Tuple3 a b c) = D1 (MetaData "Tuple3" "Foundation.Tuple" "foundation-0.0.5-2y8kRfBAQmDFaEaZhtknbm" False) (C1 (MetaCons "Tuple3" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 c))))) type ProductThird (Tuple3 a b c) Source # type ProductThird (Tuple3 a b c) = c type ProductSecond (Tuple3 a b c) Source # type ProductSecond (Tuple3 a b c) = b type ProductFirst (Tuple3 a b c) Source # type ProductFirst (Tuple3 a b c) = a

data Tuple4 a b c d Source #

Strict tuple (a,b,c,d)

Constructors

 Tuple4 !a !b !c !d

Instances

 Nthable 1 (Tuple4 a b c d) Source # Associated Typestype NthTy (1 :: Nat) (Tuple4 a b c d) :: * Source # Methodsnth :: proxy 1 -> Tuple4 a b c d -> NthTy 1 (Tuple4 a b c d) Source # Nthable 2 (Tuple4 a b c d) Source # Associated Typestype NthTy (2 :: Nat) (Tuple4 a b c d) :: * Source # Methodsnth :: proxy 2 -> Tuple4 a b c d -> NthTy 2 (Tuple4 a b c d) Source # Nthable 3 (Tuple4 a b c d) Source # Associated Typestype NthTy (3 :: Nat) (Tuple4 a b c d) :: * Source # Methodsnth :: proxy 3 -> Tuple4 a b c d -> NthTy 3 (Tuple4 a b c d) Source # Nthable 4 (Tuple4 a b c d) Source # Associated Typestype NthTy (4 :: Nat) (Tuple4 a b c d) :: * Source # Methodsnth :: proxy 4 -> Tuple4 a b c d -> NthTy 4 (Tuple4 a b c d) Source # (Eq d, Eq c, Eq b, Eq a) => Eq (Tuple4 a b c d) Source # Methods(==) :: Tuple4 a b c d -> Tuple4 a b c d -> Bool #(/=) :: Tuple4 a b c d -> Tuple4 a b c d -> Bool # (Data d, Data c, Data b, Data a) => Data (Tuple4 a b c d) Source # Methodsgfoldl :: (forall e f. Data e => c (e -> f) -> e -> c f) -> (forall g. g -> c g) -> Tuple4 a b c d -> c (Tuple4 a b c d) #gunfold :: (forall e r. Data e => c (e -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Tuple4 a b c d) #toConstr :: Tuple4 a b c d -> Constr #dataTypeOf :: Tuple4 a b c d -> DataType #dataCast1 :: Typeable (* -> *) t => (forall e. Data e => c (t e)) -> Maybe (c (Tuple4 a b c d)) #dataCast2 :: Typeable (* -> * -> *) t => (forall e f. (Data e, Data f) => c (t e f)) -> Maybe (c (Tuple4 a b c d)) #gmapT :: (forall e. Data e => e -> e) -> Tuple4 a b c d -> Tuple4 a b c d #gmapQl :: (r -> r' -> r) -> r -> (forall e. Data e => e -> r') -> Tuple4 a b c d -> r #gmapQr :: (r' -> r -> r) -> r -> (forall e. Data e => e -> r') -> Tuple4 a b c d -> r #gmapQ :: (forall e. Data e => e -> u) -> Tuple4 a b c d -> [u] #gmapQi :: Int -> (forall e. Data e => e -> u) -> Tuple4 a b c d -> u #gmapM :: Monad m => (forall e. Data e => e -> m e) -> Tuple4 a b c d -> m (Tuple4 a b c d) #gmapMp :: MonadPlus m => (forall e. Data e => e -> m e) -> Tuple4 a b c d -> m (Tuple4 a b c d) #gmapMo :: MonadPlus m => (forall e. Data e => e -> m e) -> Tuple4 a b c d -> m (Tuple4 a b c d) # (Ord d, Ord c, Ord b, Ord a) => Ord (Tuple4 a b c d) Source # Methodscompare :: Tuple4 a b c d -> Tuple4 a b c d -> Ordering #(<) :: Tuple4 a b c d -> Tuple4 a b c d -> Bool #(<=) :: Tuple4 a b c d -> Tuple4 a b c d -> Bool #(>) :: Tuple4 a b c d -> Tuple4 a b c d -> Bool #(>=) :: Tuple4 a b c d -> Tuple4 a b c d -> Bool #max :: Tuple4 a b c d -> Tuple4 a b c d -> Tuple4 a b c d #min :: Tuple4 a b c d -> Tuple4 a b c d -> Tuple4 a b c d # (Show d, Show c, Show b, Show a) => Show (Tuple4 a b c d) Source # MethodsshowsPrec :: Int -> Tuple4 a b c d -> ShowS #show :: Tuple4 a b c d -> String #showList :: [Tuple4 a b c d] -> ShowS # Generic (Tuple4 a b c d) Source # Associated Typestype Rep (Tuple4 a b c d) :: * -> * # Methodsfrom :: Tuple4 a b c d -> Rep (Tuple4 a b c d) x #to :: Rep (Tuple4 a b c d) x -> Tuple4 a b c d # Thdable (Tuple4 a b c d) Source # Associated Typestype ProductThird (Tuple4 a b c d) :: * Source # Methodsthd :: Tuple4 a b c d -> ProductThird (Tuple4 a b c d) Source # Sndable (Tuple4 a b c d) Source # Associated Typestype ProductSecond (Tuple4 a b c d) :: * Source # Methodssnd :: Tuple4 a b c d -> ProductSecond (Tuple4 a b c d) Source # Fstable (Tuple4 a b c d) Source # Associated Typestype ProductFirst (Tuple4 a b c d) :: * Source # Methodsfst :: Tuple4 a b c d -> ProductFirst (Tuple4 a b c d) Source # (Hashable a, Hashable b, Hashable c, Hashable d) => Hashable (Tuple4 a b c d) Source # MethodshashMix :: Hasher st => Tuple4 a b c d -> st -> st Source # type NthTy 1 (Tuple4 a b c d) Source # type NthTy 1 (Tuple4 a b c d) = a type NthTy 2 (Tuple4 a b c d) Source # type NthTy 2 (Tuple4 a b c d) = b type NthTy 3 (Tuple4 a b c d) Source # type NthTy 3 (Tuple4 a b c d) = c type NthTy 4 (Tuple4 a b c d) Source # type NthTy 4 (Tuple4 a b c d) = d type Rep (Tuple4 a b c d) Source # type Rep (Tuple4 a b c d) = D1 (MetaData "Tuple4" "Foundation.Tuple" "foundation-0.0.5-2y8kRfBAQmDFaEaZhtknbm" False) (C1 (MetaCons "Tuple4" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 b))) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 c)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 d))))) type ProductThird (Tuple4 a b c d) Source # type ProductThird (Tuple4 a b c d) = c type ProductSecond (Tuple4 a b c d) Source # type ProductSecond (Tuple4 a b c d) = b type ProductFirst (Tuple4 a b c d) Source # type ProductFirst (Tuple4 a b c d) = a

class Fstable a where Source #

Class of product types that have a first element

Minimal complete definition

fst

Associated Types

type ProductFirst a Source #

Methods

fst :: a -> ProductFirst a Source #

Instances

 Fstable (a, b) Source # Associated Typestype ProductFirst (a, b) :: * Source # Methodsfst :: (a, b) -> ProductFirst (a, b) Source # Fstable (Tuple2 a b) Source # Associated Typestype ProductFirst (Tuple2 a b) :: * Source # Methodsfst :: Tuple2 a b -> ProductFirst (Tuple2 a b) Source # Fstable (a, b, c) Source # Associated Typestype ProductFirst (a, b, c) :: * Source # Methodsfst :: (a, b, c) -> ProductFirst (a, b, c) Source # Fstable (Tuple3 a b c) Source # Associated Typestype ProductFirst (Tuple3 a b c) :: * Source # Methodsfst :: Tuple3 a b c -> ProductFirst (Tuple3 a b c) Source # Fstable (a, b, c, d) Source # Associated Typestype ProductFirst (a, b, c, d) :: * Source # Methodsfst :: (a, b, c, d) -> ProductFirst (a, b, c, d) Source # Fstable (Tuple4 a b c d) Source # Associated Typestype ProductFirst (Tuple4 a b c d) :: * Source # Methodsfst :: Tuple4 a b c d -> ProductFirst (Tuple4 a b c d) Source #

class Sndable a where Source #

Class of product types that have a second element

Minimal complete definition

snd

Associated Types

type ProductSecond a Source #

Methods

snd :: a -> ProductSecond a Source #

Instances

 Sndable (a, b) Source # Associated Typestype ProductSecond (a, b) :: * Source # Methodssnd :: (a, b) -> ProductSecond (a, b) Source # Sndable (Tuple2 a b) Source # Associated Typestype ProductSecond (Tuple2 a b) :: * Source # Methodssnd :: Tuple2 a b -> ProductSecond (Tuple2 a b) Source # Sndable (a, b, c) Source # Associated Typestype ProductSecond (a, b, c) :: * Source # Methodssnd :: (a, b, c) -> ProductSecond (a, b, c) Source # Sndable (Tuple3 a b c) Source # Associated Typestype ProductSecond (Tuple3 a b c) :: * Source # Methodssnd :: Tuple3 a b c -> ProductSecond (Tuple3 a b c) Source # Sndable (a, b, c, d) Source # Associated Typestype ProductSecond (a, b, c, d) :: * Source # Methodssnd :: (a, b, c, d) -> ProductSecond (a, b, c, d) Source # Sndable (Tuple4 a b c d) Source # Associated Typestype ProductSecond (Tuple4 a b c d) :: * Source # Methodssnd :: Tuple4 a b c d -> ProductSecond (Tuple4 a b c d) Source #

class Thdable a where Source #

Class of product types that have a third element

Minimal complete definition

thd

Associated Types

type ProductThird a Source #

Methods

thd :: a -> ProductThird a Source #

Instances

 Thdable (a, b, c) Source # Associated Typestype ProductThird (a, b, c) :: * Source # Methodsthd :: (a, b, c) -> ProductThird (a, b, c) Source # Thdable (Tuple3 a b c) Source # Associated Typestype ProductThird (Tuple3 a b c) :: * Source # Methodsthd :: Tuple3 a b c -> ProductThird (Tuple3 a b c) Source # Thdable (a, b, c, d) Source # Associated Typestype ProductThird (a, b, c, d) :: * Source # Methodsthd :: (a, b, c, d) -> ProductThird (a, b, c, d) Source # Thdable (Tuple4 a b c d) Source # Associated Typestype ProductThird (Tuple4 a b c d) :: * Source # Methodsthd :: Tuple4 a b c d -> ProductThird (Tuple4 a b c d) Source #

id :: Category k cat => forall a. cat a a #

the identity morphism

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


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


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

flip f takes its (first) two arguments in the reverse order of f.

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]


error :: forall r. forall a. HasCallStack => String -> a Source #

stop execution and displays an error message

putStr :: String -> IO () Source #

Print a string to standard output

putStrLn :: String -> IO () Source #

Print a string with a newline to standard output

Returns a list of the program's command line arguments (not including the program name).

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

uncurry converts a curried function to a function on pairs.

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

curry converts an uncurried function to a curried function.

swap :: (a, b) -> (b, a) #

Swap the components of a pair.

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.

undefined :: HasCallStack => 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 #

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.

## Type classes

class Show a #

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

Instances

 MethodsshowsPrec :: Int -> Bool -> ShowS #show :: Bool -> String #showList :: [Bool] -> ShowS # MethodsshowsPrec :: Int -> Char -> ShowS #show :: Char -> String #showList :: [Char] -> ShowS # MethodsshowsPrec :: Int -> Int -> ShowS #show :: Int -> String #showList :: [Int] -> ShowS # MethodsshowsPrec :: Int -> Int8 -> ShowS #show :: Int8 -> String #showList :: [Int8] -> ShowS # MethodsshowsPrec :: Int -> Int16 -> ShowS #show :: Int16 -> String #showList :: [Int16] -> ShowS # MethodsshowsPrec :: Int -> Int32 -> ShowS #show :: Int32 -> String #showList :: [Int32] -> ShowS # MethodsshowsPrec :: Int -> Int64 -> ShowS #show :: Int64 -> String #showList :: [Int64] -> ShowS # MethodsshowList :: [Integer] -> ShowS # MethodsshowList :: [Ordering] -> ShowS # MethodsshowsPrec :: Int -> Word -> ShowS #show :: Word -> String #showList :: [Word] -> ShowS # MethodsshowsPrec :: Int -> Word8 -> ShowS #show :: Word8 -> String #showList :: [Word8] -> ShowS # MethodsshowsPrec :: Int -> Word16 -> ShowS #showList :: [Word16] -> ShowS # MethodsshowsPrec :: Int -> Word32 -> ShowS #showList :: [Word32] -> ShowS # MethodsshowsPrec :: Int -> Word64 -> ShowS #showList :: [Word64] -> ShowS # MethodsshowList :: [CallStack] -> ShowS # MethodsshowList :: [TypeRep] -> ShowS # Show () MethodsshowsPrec :: Int -> () -> ShowS #show :: () -> String #showList :: [()] -> ShowS # MethodsshowsPrec :: Int -> TyCon -> ShowS #show :: TyCon -> String #showList :: [TyCon] -> ShowS # MethodsshowsPrec :: Int -> Module -> ShowS #showList :: [Module] -> ShowS # MethodsshowsPrec :: Int -> TrName -> ShowS #showList :: [TrName] -> ShowS # Show FD MethodsshowsPrec :: Int -> FD -> ShowS #show :: FD -> String #showList :: [FD] -> ShowS # Show HandleType MethodsshowsPrec :: Int -> HandleType -> ShowS #show :: HandleType -> String #showList :: [HandleType] -> ShowS # MethodsshowList :: [Natural] -> ShowS # MethodsshowsPrec :: Int -> Void -> ShowS #show :: Void -> String #showList :: [Void] -> ShowS # MethodsshowList :: [DataType] -> ShowS # MethodsshowsPrec :: Int -> Constr -> ShowS #showList :: [Constr] -> ShowS # MethodsshowList :: [DataRep] -> ShowS # MethodsshowList :: [ConstrRep] -> ShowS # MethodsshowsPrec :: Int -> Fixity -> ShowS #showList :: [Fixity] -> ShowS # MethodsshowList :: [Version] -> ShowS # MethodsshowList :: [HandlePosn] -> ShowS # MethodsshowList :: [PatternMatchFail] -> ShowS # MethodsshowList :: [RecSelError] -> ShowS # MethodsshowList :: [RecConError] -> ShowS # MethodsshowList :: [RecUpdError] -> ShowS # MethodsshowList :: [NoMethodError] -> ShowS # MethodsshowList :: [TypeError] -> ShowS # MethodsshowList :: [NonTermination] -> ShowS # MethodsshowList :: [NestedAtomically] -> ShowS # MethodsshowsPrec :: Int -> CDev -> ShowS #show :: CDev -> String #showList :: [CDev] -> ShowS # MethodsshowsPrec :: Int -> CIno -> ShowS #show :: CIno -> String #showList :: [CIno] -> ShowS # MethodsshowsPrec :: Int -> CMode -> ShowS #show :: CMode -> String #showList :: [CMode] -> ShowS # MethodsshowsPrec :: Int -> COff -> ShowS #show :: COff -> String #showList :: [COff] -> ShowS # MethodsshowsPrec :: Int -> CPid -> ShowS #show :: CPid -> String #showList :: [CPid] -> ShowS # MethodsshowsPrec :: Int -> CSsize -> ShowS #showList :: [CSsize] -> ShowS # MethodsshowsPrec :: Int -> CGid -> ShowS #show :: CGid -> String #showList :: [CGid] -> ShowS # MethodsshowsPrec :: Int -> CNlink -> ShowS #showList :: [CNlink] -> ShowS # MethodsshowsPrec :: Int -> CUid -> ShowS #show :: CUid -> String #showList :: [CUid] -> ShowS # MethodsshowsPrec :: Int -> CCc -> ShowS #show :: CCc -> String #showList :: [CCc] -> ShowS # MethodsshowsPrec :: Int -> CSpeed -> ShowS #showList :: [CSpeed] -> ShowS # MethodsshowList :: [CTcflag] -> ShowS # MethodsshowsPrec :: Int -> CRLim -> ShowS #show :: CRLim -> String #showList :: [CRLim] -> ShowS # MethodsshowsPrec :: Int -> Fd -> ShowS #show :: Fd -> String #showList :: [Fd] -> ShowS # MethodsshowList :: [ThreadId] -> ShowS # MethodsshowList :: [BlockReason] -> ShowS # MethodsshowList :: [ThreadStatus] -> ShowS # Methods Methods MethodsshowList :: [Deadlock] -> ShowS # Methods MethodsshowList :: [AssertionFailed] -> ShowS # MethodsshowList :: [SomeAsyncException] -> ShowS # MethodsshowList :: [AsyncException] -> ShowS # MethodsshowList :: [ArrayException] -> ShowS # MethodsshowList :: [ExitCode] -> ShowS # MethodsshowList :: [IOErrorType] -> ShowS # MethodsshowsPrec :: Int -> Handle -> ShowS #showList :: [Handle] -> ShowS # MethodsshowList :: [BufferMode] -> ShowS # MethodsshowList :: [Newline] -> ShowS # MethodsshowList :: [NewlineMode] -> ShowS # MethodsshowList :: [WordPtr] -> ShowS # MethodsshowsPrec :: Int -> IntPtr -> ShowS #showList :: [IntPtr] -> ShowS # MethodsshowsPrec :: Int -> CChar -> ShowS #show :: CChar -> String #showList :: [CChar] -> ShowS # MethodsshowsPrec :: Int -> CSChar -> ShowS #showList :: [CSChar] -> ShowS # MethodsshowsPrec :: Int -> CUChar -> ShowS #showList :: [CUChar] -> ShowS # MethodsshowsPrec :: Int -> CShort -> ShowS #showList :: [CShort] -> ShowS # MethodsshowList :: [CUShort] -> ShowS # MethodsshowsPrec :: Int -> CInt -> ShowS #show :: CInt -> String #showList :: [CInt] -> ShowS # MethodsshowsPrec :: Int -> CUInt -> ShowS #show :: CUInt -> String #showList :: [CUInt] -> ShowS # MethodsshowsPrec :: Int -> CLong -> ShowS #show :: CLong -> String #showList :: [CLong] -> ShowS # MethodsshowsPrec :: Int -> CULong -> ShowS #showList :: [CULong] -> ShowS # MethodsshowsPrec :: Int -> CLLong -> ShowS #showList :: [CLLong] -> ShowS # MethodsshowList :: [CULLong] -> ShowS # MethodsshowsPrec :: Int -> CFloat -> ShowS #showList :: [CFloat] -> ShowS # MethodsshowList :: [CDouble] -> ShowS # MethodsshowList :: [CPtrdiff] -> ShowS # MethodsshowsPrec :: Int -> CSize -> ShowS #show :: CSize -> String #showList :: [CSize] -> ShowS # MethodsshowsPrec :: Int -> CWchar -> ShowS #showList :: [CWchar] -> ShowS # MethodsshowList :: [CSigAtomic] -> ShowS # MethodsshowsPrec :: Int -> CClock -> ShowS #showList :: [CClock] -> ShowS # MethodsshowsPrec :: Int -> CTime -> ShowS #show :: CTime -> String #showList :: [CTime] -> ShowS # MethodsshowList :: [CUSeconds] -> ShowS # MethodsshowList :: [CSUSeconds] -> ShowS # MethodsshowList :: [CIntPtr] -> ShowS # MethodsshowList :: [CUIntPtr] -> ShowS # MethodsshowList :: [CIntMax] -> ShowS # MethodsshowList :: [CUIntMax] -> ShowS # MethodsshowList :: [SeekMode] -> ShowS # MethodsshowsPrec :: Int -> All -> ShowS #show :: All -> String #showList :: [All] -> ShowS # MethodsshowsPrec :: Int -> Any -> ShowS #show :: Any -> String #showList :: [Any] -> ShowS # MethodsshowsPrec :: Int -> Fixity -> ShowS #showList :: [Fixity] -> ShowS # MethodsshowList :: [Associativity] -> ShowS # MethodsshowList :: [SourceUnpackedness] -> ShowS # MethodsshowList :: [SourceStrictness] -> ShowS # MethodsshowList :: [DecidedStrictness] -> ShowS # MethodsshowList :: [MaskingState] -> ShowS # MethodsshowList :: [IOException] -> ShowS # MethodsshowList :: [ErrorCall] -> ShowS # MethodsshowList :: [ArithException] -> ShowS # MethodsshowList :: [SomeNat] -> ShowS # MethodsshowList :: [SomeSymbol] -> ShowS # MethodsshowsPrec :: Int -> IOMode -> ShowS #showList :: [IOMode] -> ShowS # MethodsshowList :: [GeneralCategory] -> ShowS # MethodsshowList :: [SomeException] -> ShowS # MethodsshowsPrec :: Int -> SrcLoc -> ShowS #showList :: [SrcLoc] -> ShowS # # MethodsshowList :: [PartialError] -> ShowS # # MethodsshowList :: [Endianness] -> ShowS # # MethodsshowList :: [OutOfBound] -> ShowS # # MethodsshowList :: [Encoding] -> ShowS # # MethodsshowList :: [ValidationFailure] -> ShowS # # MethodsshowsPrec :: Int -> String -> ShowS #showList :: [String] -> ShowS # # MethodsshowsPrec :: Int -> Arch -> ShowS #show :: Arch -> String #showList :: [Arch] -> ShowS # # MethodsshowsPrec :: Int -> OS -> ShowS #show :: OS -> String #showList :: [OS] -> ShowS # # MethodsshowList :: [Condition] -> ShowS # # MethodsshowsPrec :: Int -> Count -> ShowS #show :: Count -> String #showList :: [Count] -> ShowS # # MethodsshowList :: [AsciiString] -> ShowS # # MethodsshowsPrec :: Int -> Bitmap -> ShowS #showList :: [Bitmap] -> ShowS # # MethodsshowsPrec :: Int -> IPv4 -> ShowS #show :: IPv4 -> String #showList :: [IPv4] -> ShowS # # MethodsshowsPrec :: Int -> IPv6 -> ShowS #show :: IPv6 -> String #showList :: [IPv6] -> ShowS # # MethodsshowsPrec :: Int -> UUID -> ShowS #show :: UUID -> String #showList :: [UUID] -> ShowS # # MethodsshowList :: [HostName] -> ShowS # # MethodsshowList :: [FileName] -> ShowS # # MethodsshowList :: [FilePath] -> ShowS # # MethodsshowList :: [Relativity] -> ShowS # Show a => Show [a] MethodsshowsPrec :: Int -> [a] -> ShowS #show :: [a] -> String #showList :: [[a]] -> ShowS # Show a => Show (Maybe a) MethodsshowsPrec :: Int -> Maybe a -> ShowS #show :: Maybe a -> String #showList :: [Maybe a] -> ShowS # Show a => Show (Ratio a) MethodsshowsPrec :: Int -> Ratio a -> ShowS #show :: Ratio a -> String #showList :: [Ratio a] -> ShowS # Show (Ptr a) MethodsshowsPrec :: Int -> Ptr a -> ShowS #show :: Ptr a -> String #showList :: [Ptr a] -> ShowS # Show (FunPtr a) MethodsshowsPrec :: Int -> FunPtr a -> ShowS #show :: FunPtr a -> String #showList :: [FunPtr a] -> ShowS # Show (V1 p) MethodsshowsPrec :: Int -> V1 p -> ShowS #show :: V1 p -> String #showList :: [V1 p] -> ShowS # Show (U1 p) MethodsshowsPrec :: Int -> U1 p -> ShowS #show :: U1 p -> String #showList :: [U1 p] -> ShowS # Show p => Show (Par1 p) MethodsshowsPrec :: Int -> Par1 p -> ShowS #show :: Par1 p -> String #showList :: [Par1 p] -> 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 MethodsshowsPrec :: Int -> Identity a -> ShowS #show :: Identity a -> String #showList :: [Identity a] -> ShowS # Show a => Show (Min a) MethodsshowsPrec :: Int -> Min a -> ShowS #show :: Min a -> String #showList :: [Min a] -> ShowS # Show a => Show (Max a) MethodsshowsPrec :: Int -> Max a -> ShowS #show :: Max a -> String #showList :: [Max a] -> ShowS # Show a => Show (First a) MethodsshowsPrec :: Int -> First a -> ShowS #show :: First a -> String #showList :: [First a] -> ShowS # Show a => Show (Last a) MethodsshowsPrec :: Int -> Last a -> ShowS #show :: Last a -> String #showList :: [Last a] -> ShowS # Show m => Show (WrappedMonoid m) MethodsshowsPrec :: Int -> WrappedMonoid m -> ShowS #show :: WrappedMonoid m -> String #showList :: [WrappedMonoid m] -> ShowS # Show a => Show (Option a) MethodsshowsPrec :: Int -> Option a -> ShowS #show :: Option a -> String #showList :: [Option a] -> ShowS # Show a => Show (NonEmpty a) MethodsshowsPrec :: Int -> NonEmpty a -> ShowS #show :: NonEmpty a -> String #showList :: [NonEmpty a] -> ShowS # Show a => Show (ZipList a) MethodsshowsPrec :: Int -> ZipList a -> ShowS #show :: ZipList a -> String #showList :: [ZipList a] -> ShowS # MethodsshowsPrec :: Int -> ForeignPtr a -> ShowS #show :: ForeignPtr a -> String #showList :: [ForeignPtr a] -> ShowS # Show a => Show (Dual a) MethodsshowsPrec :: Int -> Dual a -> ShowS #show :: Dual a -> String #showList :: [Dual a] -> ShowS # Show a => Show (Sum a) MethodsshowsPrec :: Int -> Sum a -> ShowS #show :: Sum a -> String #showList :: [Sum a] -> ShowS # Show a => Show (Product a) MethodsshowsPrec :: Int -> Product a -> ShowS #show :: Product a -> String #showList :: [Product a] -> ShowS # Show a => Show (First a) MethodsshowsPrec :: Int -> First a -> ShowS #show :: First a -> String #showList :: [First a] -> ShowS # Show a => Show (Last a) MethodsshowsPrec :: Int -> Last a -> ShowS #show :: Last a -> String #showList :: [Last a] -> ShowS # Show (Size ty) # MethodsshowsPrec :: Int -> Size ty -> ShowS #show :: Size ty -> String #showList :: [Size ty] -> ShowS # Show (Offset ty) # MethodsshowsPrec :: Int -> Offset ty -> ShowS #show :: Offset ty -> String #showList :: [Offset ty] -> ShowS # Show a => Show (BE a) # MethodsshowsPrec :: Int -> BE a -> ShowS #show :: BE a -> String #showList :: [BE a] -> ShowS # Show a => Show (LE a) # MethodsshowsPrec :: Int -> LE a -> ShowS #show :: LE a -> String #showList :: [LE a] -> ShowS # Show (FinalPtr a) # MethodsshowsPrec :: Int -> FinalPtr a -> ShowS #show :: FinalPtr a -> String #showList :: [FinalPtr a] -> ShowS # (PrimType ty, Show ty) => Show (UArray ty) # MethodsshowsPrec :: Int -> UArray ty -> ShowS #show :: UArray ty -> String #showList :: [UArray ty] -> ShowS # Show a => Show (Array a) # MethodsshowsPrec :: Int -> Array a -> ShowS #show :: Array a -> String #showList :: [Array a] -> ShowS # Show a => Show (NonEmpty a) # MethodsshowsPrec :: Int -> NonEmpty a -> ShowS #show :: NonEmpty a -> String #showList :: [NonEmpty a] -> ShowS # (Show ty, PrimType ty) => Show (ChunkedUArray ty) # MethodsshowsPrec :: Int -> ChunkedUArray ty -> ShowS #show :: ChunkedUArray ty -> String #showList :: [ChunkedUArray ty] -> ShowS # Show input => Show (ParserError input) # MethodsshowsPrec :: Int -> ParserError input -> ShowS #show :: ParserError input -> String #showList :: [ParserError input] -> ShowS # Show address_type => Show (HostNameInfo address_type) # MethodsshowsPrec :: Int -> HostNameInfo address_type -> ShowS #show :: HostNameInfo address_type -> String #showList :: [HostNameInfo address_type] -> ShowS # (Show b, Show a) => Show (Either a b) MethodsshowsPrec :: Int -> Either a b -> ShowS #show :: Either a b -> String #showList :: [Either a b] -> ShowS # Show (f p) => Show (Rec1 f p) MethodsshowsPrec :: Int -> Rec1 f p -> ShowS #show :: Rec1 f p -> String #showList :: [Rec1 f p] -> ShowS # Show (URec Char p) MethodsshowsPrec :: Int -> URec Char p -> ShowS #show :: URec Char p -> String #showList :: [URec Char p] -> ShowS # MethodsshowsPrec :: Int -> URec Double p -> ShowS #show :: URec Double p -> String #showList :: [URec Double p] -> ShowS # MethodsshowsPrec :: Int -> URec Float p -> ShowS #show :: URec Float p -> String #showList :: [URec Float p] -> ShowS # Show (URec Int p) MethodsshowsPrec :: Int -> URec Int p -> ShowS #show :: URec Int p -> String #showList :: [URec Int p] -> ShowS # Show (URec Word p) MethodsshowsPrec :: Int -> URec Word p -> ShowS #show :: URec Word p -> String #showList :: [URec Word p] -> ShowS # (Show a, Show b) => Show (a, b) MethodsshowsPrec :: Int -> (a, b) -> ShowS #show :: (a, b) -> String #showList :: [(a, b)] -> ShowS # (Ix a, Show a, Show b) => Show (Array a b) MethodsshowsPrec :: Int -> Array a b -> ShowS #show :: Array a b -> String #showList :: [Array a b] -> ShowS # (Show b, Show a) => Show (Arg a b) MethodsshowsPrec :: Int -> Arg a b -> ShowS #show :: Arg a b -> String #showList :: [Arg a b] -> ShowS # Show (Proxy k s) MethodsshowsPrec :: Int -> Proxy k s -> ShowS #show :: Proxy k s -> String #showList :: [Proxy k s] -> ShowS # Show (ST s a) MethodsshowsPrec :: Int -> ST s a -> ShowS #show :: ST s a -> String #showList :: [ST s a] -> ShowS # (Show b, Show a) => Show (Tuple2 a b) # MethodsshowsPrec :: Int -> Tuple2 a b -> ShowS #show :: Tuple2 a b -> String #showList :: [Tuple2 a b] -> ShowS # (Show ba, Show a) => Show (Result ba a) # MethodsshowsPrec :: Int -> Result ba a -> ShowS #show :: Result ba a -> String #showList :: [Result ba a] -> ShowS # Show c => Show (K1 i c p) MethodsshowsPrec :: Int -> K1 i c p -> ShowS #show :: K1 i c p -> String #showList :: [K1 i c p] -> ShowS # (Show (g p), Show (f p)) => Show ((:+:) f g p) MethodsshowsPrec :: Int -> (f :+: g) p -> ShowS #show :: (f :+: g) p -> String #showList :: [(f :+: g) p] -> ShowS # (Show (g p), Show (f p)) => Show ((:*:) f g p) MethodsshowsPrec :: Int -> (f :*: g) p -> ShowS #show :: (f :*: g) p -> String #showList :: [(f :*: g) p] -> ShowS # Show (f (g p)) => Show ((:.:) f g p) MethodsshowsPrec :: 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) MethodsshowsPrec :: Int -> (a, b, c) -> ShowS #show :: (a, b, c) -> String #showList :: [(a, b, c)] -> 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 MethodsshowsPrec :: Int -> Const k a b -> ShowS #show :: Const k a b -> String #showList :: [Const k a b] -> ShowS # Show (f a) => Show (Alt k f a) MethodsshowsPrec :: Int -> Alt k f a -> ShowS #show :: Alt k f a -> String #showList :: [Alt k f a] -> ShowS # Show (Coercion k a b) MethodsshowsPrec :: Int -> Coercion k a b -> ShowS #show :: Coercion k a b -> String #showList :: [Coercion k a b] -> ShowS # Show ((:~:) k a b) MethodsshowsPrec :: Int -> (k :~: a) b -> ShowS #show :: (k :~: a) b -> String #showList :: [(k :~: a) b] -> ShowS # (Show c, Show b, Show a) => Show (Tuple3 a b c) # MethodsshowsPrec :: Int -> Tuple3 a b c -> ShowS #show :: Tuple3 a b c -> String #showList :: [Tuple3 a b c] -> ShowS # Show (f p) => Show (M1 i c f p) MethodsshowsPrec :: 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) MethodsshowsPrec :: Int -> (a, b, c, d) -> ShowS #show :: (a, b, c, d) -> String #showList :: [(a, b, c, d)] -> ShowS # (Show d, Show c, Show b, Show a) => Show (Tuple4 a b c d) # MethodsshowsPrec :: Int -> Tuple4 a b c d -> ShowS #show :: Tuple4 a b c d -> String #showList :: [Tuple4 a b c d] -> ShowS # (Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) MethodsshowsPrec :: Int -> (a, b, c, d, e) -> ShowS #show :: (a, b, c, d, e) -> String #showList :: [(a, b, c, d, e)] -> ShowS # (Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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) MethodsshowsPrec :: 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 #

show :: Show a => a -> String Source #

Use the Show class to create a String.

Note that this is not efficient, since an intermediate [Char] is going to be created before turning into a real String.

class Eq a => Ord a where #

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

Methods

compare :: a -> a -> Ordering #

(<) :: a -> a -> Bool infix 4 #

(<=) :: a -> a -> Bool infix 4 #

(>) :: a -> a -> Bool infix 4 #

(>=) :: a -> a -> Bool infix 4 #

max :: a -> a -> a #

min :: a -> a -> a #

Instances

class Eq a where #

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

Methods

(==) :: a -> a -> Bool infix 4 #

(/=) :: a -> a -> Bool infix 4 #

Instances

 Methods(==) :: Bool -> Bool -> Bool #(/=) :: Bool -> Bool -> Bool # Methods(==) :: Char -> Char -> Bool #(/=) :: Char -> Char -> Bool # Methods(==) :: Double -> Double -> Bool #(/=) :: Double -> Double -> Bool # Methods(==) :: Float -> Float -> Bool #(/=) :: Float -> Float -> Bool # Methods(==) :: Int -> Int -> Bool #(/=) :: Int -> Int -> Bool # Methods(==) :: Int8 -> Int8 -> Bool #(/=) :: Int8 -> Int8 -> Bool # Methods(==) :: Int16 -> Int16 -> Bool #(/=) :: Int16 -> Int16 -> Bool # Methods(==) :: Int32 -> Int32 -> Bool #(/=) :: Int32 -> Int32 -> Bool # Methods(==) :: Int64 -> Int64 -> Bool #(/=) :: Int64 -> Int64 -> Bool # Methods(==) :: Integer -> Integer -> Bool #(/=) :: Integer -> Integer -> Bool # Methods Methods(==) :: Word -> Word -> Bool #(/=) :: Word -> Word -> Bool # Methods(==) :: Word8 -> Word8 -> Bool #(/=) :: Word8 -> Word8 -> Bool # Methods(==) :: Word16 -> Word16 -> Bool #(/=) :: Word16 -> Word16 -> Bool # Methods(==) :: Word32 -> Word32 -> Bool #(/=) :: Word32 -> Word32 -> Bool # Methods(==) :: Word64 -> Word64 -> Bool #(/=) :: Word64 -> Word64 -> Bool # Methods(==) :: TypeRep -> TypeRep -> Bool #(/=) :: TypeRep -> TypeRep -> Bool # Eq () Methods(==) :: () -> () -> Bool #(/=) :: () -> () -> Bool # Methods(==) :: TyCon -> TyCon -> Bool #(/=) :: TyCon -> TyCon -> Bool # Methods(==) :: BigNat -> BigNat -> Bool #(/=) :: BigNat -> BigNat -> Bool # Methods Methods(==) :: Natural -> Natural -> Bool #(/=) :: Natural -> Natural -> Bool # Methods(==) :: Void -> Void -> Bool #(/=) :: Void -> Void -> Bool # Equality of constructors Methods(==) :: Constr -> Constr -> Bool #(/=) :: Constr -> Constr -> Bool # Methods(==) :: DataRep -> DataRep -> Bool #(/=) :: DataRep -> DataRep -> Bool # Methods Methods(==) :: Fixity -> Fixity -> Bool #(/=) :: Fixity -> Fixity -> Bool # Methods(==) :: Version -> Version -> Bool #(/=) :: Version -> Version -> Bool # Methods Methods(==) :: CDev -> CDev -> Bool #(/=) :: CDev -> CDev -> Bool # Methods(==) :: CIno -> CIno -> Bool #(/=) :: CIno -> CIno -> Bool # Methods(==) :: CMode -> CMode -> Bool #(/=) :: CMode -> CMode -> Bool # Methods(==) :: COff -> COff -> Bool #(/=) :: COff -> COff -> Bool # Methods(==) :: CPid -> CPid -> Bool #(/=) :: CPid -> CPid -> Bool # Methods(==) :: CSsize -> CSsize -> Bool #(/=) :: CSsize -> CSsize -> Bool # Methods(==) :: CGid -> CGid -> Bool #(/=) :: CGid -> CGid -> Bool # Methods(==) :: CNlink -> CNlink -> Bool #(/=) :: CNlink -> CNlink -> Bool # Methods(==) :: CUid -> CUid -> Bool #(/=) :: CUid -> CUid -> Bool # Methods(==) :: CCc -> CCc -> Bool #(/=) :: CCc -> CCc -> Bool # Methods(==) :: CSpeed -> CSpeed -> Bool #(/=) :: CSpeed -> CSpeed -> Bool # Methods(==) :: CTcflag -> CTcflag -> Bool #(/=) :: CTcflag -> CTcflag -> Bool # Methods(==) :: CRLim -> CRLim -> Bool #(/=) :: CRLim -> CRLim -> Bool # Methods(==) :: Fd -> Fd -> Bool #(/=) :: Fd -> Fd -> Bool # Methods Methods Methods Methods(==) :: Errno -> Errno -> Bool #(/=) :: Errno -> Errno -> Bool # Methods Methods Methods Methods Methods(==) :: Handle -> Handle -> Bool #(/=) :: Handle -> Handle -> Bool # Methods Methods(==) :: Newline -> Newline -> Bool #(/=) :: Newline -> Newline -> Bool # Methods Methods(==) :: WordPtr -> WordPtr -> Bool #(/=) :: WordPtr -> WordPtr -> Bool # Methods(==) :: IntPtr -> IntPtr -> Bool #(/=) :: IntPtr -> IntPtr -> Bool # Methods(==) :: CChar -> CChar -> Bool #(/=) :: CChar -> CChar -> Bool # Methods(==) :: CSChar -> CSChar -> Bool #(/=) :: CSChar -> CSChar -> Bool # Methods(==) :: CUChar -> CUChar -> Bool #(/=) :: CUChar -> CUChar -> Bool # Methods(==) :: CShort -> CShort -> Bool #(/=) :: CShort -> CShort -> Bool # Methods(==) :: CUShort -> CUShort -> Bool #(/=) :: CUShort -> CUShort -> Bool # Methods(==) :: CInt -> CInt -> Bool #(/=) :: CInt -> CInt -> Bool # Methods(==) :: CUInt -> CUInt -> Bool #(/=) :: CUInt -> CUInt -> Bool # Methods(==) :: CLong -> CLong -> Bool #(/=) :: CLong -> CLong -> Bool # Methods(==) :: CULong -> CULong -> Bool #(/=) :: CULong -> CULong -> Bool # Methods(==) :: CLLong -> CLLong -> Bool #(/=) :: CLLong -> CLLong -> Bool # Methods(==) :: CULLong -> CULLong -> Bool #(/=) :: CULLong -> CULLong -> Bool # Methods(==) :: CFloat -> CFloat -> Bool #(/=) :: CFloat -> CFloat -> Bool # Methods(==) :: CDouble -> CDouble -> Bool #(/=) :: CDouble -> CDouble -> Bool # Methods Methods(==) :: CSize -> CSize -> Bool #(/=) :: CSize -> CSize -> Bool # Methods(==) :: CWchar -> CWchar -> Bool #(/=) :: CWchar -> CWchar -> Bool # Methods Methods(==) :: CClock -> CClock -> Bool #(/=) :: CClock -> CClock -> Bool # Methods(==) :: CTime -> CTime -> Bool #(/=) :: CTime -> CTime -> Bool # Methods Methods Methods(==) :: CIntPtr -> CIntPtr -> Bool #(/=) :: CIntPtr -> CIntPtr -> Bool # Methods Methods(==) :: CIntMax -> CIntMax -> Bool #(/=) :: CIntMax -> CIntMax -> Bool # Methods Methods Methods Methods(==) :: All -> All -> Bool #(/=) :: All -> All -> Bool # Methods(==) :: Any -> Any -> Bool #(/=) :: Any -> Any -> Bool # Methods(==) :: Fixity -> Fixity -> Bool #(/=) :: Fixity -> Fixity -> Bool # Methods Methods Methods Methods Methods Methods Methods Methods Methods(==) :: SomeNat -> SomeNat -> Bool #(/=) :: SomeNat -> SomeNat -> Bool # Methods Methods(==) :: IOMode -> IOMode -> Bool #(/=) :: IOMode -> IOMode -> Bool # Methods Methods(==) :: SrcLoc -> SrcLoc -> Bool #(/=) :: SrcLoc -> SrcLoc -> Bool # # Methods(==) :: Sign -> Sign -> Bool #(/=) :: Sign -> Sign -> Bool # # Methods # Methods # Methods # Methods # Methods(==) :: String -> String -> Bool #(/=) :: String -> String -> Bool # # Methods(==) :: Arch -> Arch -> Bool #(/=) :: Arch -> Arch -> Bool # # Methods(==) :: OS -> OS -> Bool #(/=) :: OS -> OS -> Bool # # Methods # Methods(==) :: Bitmap -> Bitmap -> Bool #(/=) :: Bitmap -> Bitmap -> Bool # # Methods(==) :: IPv4 -> IPv4 -> Bool #(/=) :: IPv4 -> IPv4 -> Bool # # Methods(==) :: IPv6 -> IPv6 -> Bool #(/=) :: IPv6 -> IPv6 -> Bool # # Methods(==) :: UUID -> UUID -> Bool #(/=) :: UUID -> UUID -> Bool # # Methods # Methods # Methods # Methods Eq a => Eq [a] Methods(==) :: [a] -> [a] -> Bool #(/=) :: [a] -> [a] -> Bool # Eq a => Eq (Maybe a) Methods(==) :: Maybe a -> Maybe a -> Bool #(/=) :: Maybe a -> Maybe a -> Bool # Eq a => Eq (Ratio a) Methods(==) :: Ratio a -> Ratio a -> Bool #(/=) :: Ratio a -> Ratio a -> Bool # Eq (Ptr a) Methods(==) :: Ptr a -> Ptr a -> Bool #(/=) :: Ptr a -> Ptr a -> Bool # Eq (FunPtr a) Methods(==) :: FunPtr a -> FunPtr a -> Bool #(/=) :: FunPtr a -> FunPtr a -> Bool # Eq (V1 p) Methods(==) :: V1 p -> V1 p -> Bool #(/=) :: V1 p -> V1 p -> Bool # Eq (U1 p) Methods(==) :: U1 p -> U1 p -> Bool #(/=) :: U1 p -> U1 p -> Bool # Eq p => Eq (Par1 p) Methods(==) :: Par1 p -> Par1 p -> Bool #(/=) :: Par1 p -> Par1 p -> Bool # Eq a => Eq (Identity a) Methods(==) :: Identity a -> Identity a -> Bool #(/=) :: Identity a -> Identity a -> Bool # Eq a => Eq (Min a) Methods(==) :: Min a -> Min a -> Bool #(/=) :: Min a -> Min a -> Bool # Eq a => Eq (Max a) Methods(==) :: Max a -> Max a -> Bool #(/=) :: Max a -> Max a -> Bool # Eq a => Eq (First a) Methods(==) :: First a -> First a -> Bool #(/=) :: First a -> First a -> Bool # Eq a => Eq (Last a) Methods(==) :: Last a -> Last a -> Bool #(/=) :: Last a -> Last a -> Bool # Eq m => Eq (WrappedMonoid m) Methods(==) :: WrappedMonoid m -> WrappedMonoid m -> Bool #(/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # Eq a => Eq (Option a) Methods(==) :: Option a -> Option a -> Bool #(/=) :: Option a -> Option a -> Bool # Eq a => Eq (NonEmpty a) Methods(==) :: NonEmpty a -> NonEmpty a -> Bool #(/=) :: NonEmpty a -> NonEmpty a -> Bool # Eq a => Eq (ZipList a) Methods(==) :: ZipList a -> ZipList a -> Bool #(/=) :: ZipList a -> ZipList a -> Bool # Eq (TVar a) Methods(==) :: TVar a -> TVar a -> Bool #(/=) :: TVar a -> TVar a -> Bool # Eq (ForeignPtr a) Methods(==) :: ForeignPtr a -> ForeignPtr a -> Bool #(/=) :: ForeignPtr a -> ForeignPtr a -> Bool # Eq a => Eq (Dual a) Methods(==) :: Dual a -> Dual a -> Bool #(/=) :: Dual a -> Dual a -> Bool # Eq a => Eq (Sum a) Methods(==) :: Sum a -> Sum a -> Bool #(/=) :: Sum a -> Sum a -> Bool # Eq a => Eq (Product a) Methods(==) :: Product a -> Product a -> Bool #(/=) :: Product a -> Product a -> Bool # Eq a => Eq (First a) Methods(==) :: First a -> First a -> Bool #(/=) :: First a -> First a -> Bool # Eq a => Eq (Last a) Methods(==) :: Last a -> Last a -> Bool #(/=) :: Last a -> Last a -> Bool # Eq (IORef a) Methods(==) :: IORef a -> IORef a -> Bool #(/=) :: IORef a -> IORef a -> Bool # Eq (MVar a) Methods(==) :: MVar a -> MVar a -> Bool #(/=) :: MVar a -> MVar a -> Bool # Eq (Size ty) # Methods(==) :: Size ty -> Size ty -> Bool #(/=) :: Size ty -> Size ty -> Bool # Eq (Offset ty) # Methods(==) :: Offset ty -> Offset ty -> Bool #(/=) :: Offset ty -> Offset ty -> Bool # Eq a => Eq (BE a) # Methods(==) :: BE a -> BE a -> Bool #(/=) :: BE a -> BE a -> Bool # Eq a => Eq (LE a) # Methods(==) :: LE a -> LE a -> Bool #(/=) :: LE a -> LE a -> Bool # Eq (FinalPtr a) # Methods(==) :: FinalPtr a -> FinalPtr a -> Bool #(/=) :: FinalPtr a -> FinalPtr a -> Bool # (PrimType ty, Eq ty) => Eq (UArray ty) # Methods(==) :: UArray ty -> UArray ty -> Bool #(/=) :: UArray ty -> UArray ty -> Bool # Eq a => Eq (Array a) # Methods(==) :: Array a -> Array a -> Bool #(/=) :: Array a -> Array a -> Bool # Eq a => Eq (NonEmpty a) # Methods(==) :: NonEmpty a -> NonEmpty a -> Bool #(/=) :: NonEmpty a -> NonEmpty a -> Bool # PrimType ty => Eq (ChunkedUArray ty) # Methods(==) :: ChunkedUArray ty -> ChunkedUArray ty -> Bool #(/=) :: ChunkedUArray ty -> ChunkedUArray ty -> Bool # Eq input => Eq (ParserError input) # Methods(==) :: ParserError input -> ParserError input -> Bool #(/=) :: ParserError input -> ParserError input -> Bool # Eq address_type => Eq (HostNameInfo address_type) # Methods(==) :: HostNameInfo address_type -> HostNameInfo address_type -> Bool #(/=) :: HostNameInfo address_type -> HostNameInfo address_type -> Bool # (Eq b, Eq a) => Eq (Either a b) Methods(==) :: Either a b -> Either a b -> Bool #(/=) :: Either a b -> Either a b -> Bool # Eq (f p) => Eq (Rec1 f p) Methods(==) :: Rec1 f p -> Rec1 f p -> Bool #(/=) :: Rec1 f p -> Rec1 f p -> Bool # Eq (URec Char p) Methods(==) :: URec Char p -> URec Char p -> Bool #(/=) :: URec Char p -> URec Char p -> Bool # Eq (URec Double p) Methods(==) :: URec Double p -> URec Double p -> Bool #(/=) :: URec Double p -> URec Double p -> Bool # Eq (URec Float p) Methods(==) :: URec Float p -> URec Float p -> Bool #(/=) :: URec Float p -> URec Float p -> Bool # Eq (URec Int p) Methods(==) :: URec Int p -> URec Int p -> Bool #(/=) :: URec Int p -> URec Int p -> Bool # Eq (URec Word p) Methods(==) :: URec Word p -> URec Word p -> Bool #(/=) :: URec Word p -> URec Word p -> Bool # Eq (URec (Ptr ()) p) Methods(==) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool #(/=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (Eq a, Eq b) => Eq (a, b) Methods(==) :: (a, b) -> (a, b) -> Bool #(/=) :: (a, b) -> (a, b) -> Bool # (Ix i, Eq e) => Eq (Array i e) Methods(==) :: Array i e -> Array i e -> Bool #(/=) :: Array i e -> Array i e -> Bool # Eq a => Eq (Arg a b) Methods(==) :: Arg a b -> Arg a b -> Bool #(/=) :: Arg a b -> Arg a b -> Bool # Eq (Proxy k s) Methods(==) :: Proxy k s -> Proxy k s -> Bool #(/=) :: Proxy k s -> Proxy k s -> Bool # Eq (STRef s a) Methods(==) :: STRef s a -> STRef s a -> Bool #(/=) :: STRef s a -> STRef s a -> Bool # (Eq b, Eq a) => Eq (Tuple2 a b) # Methods(==) :: Tuple2 a b -> Tuple2 a b -> Bool #(/=) :: Tuple2 a b -> Tuple2 a b -> Bool # Eq c => Eq (K1 i c p) Methods(==) :: K1 i c p -> K1 i c p -> Bool #(/=) :: K1 i c p -> K1 i c p -> Bool # (