| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
CorePrelude
Synopsis
- ($) :: (a -> b) -> a -> b
- ($!) :: (a -> b) -> a -> b
- (&&) :: Bool -> Bool -> Bool
- (||) :: Bool -> Bool -> Bool
- (.) :: forall (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
- not :: Bool -> Bool
- otherwise :: Bool
- fst :: (a, b) -> a
- snd :: (a, b) -> b
- id :: forall (a :: k). Category cat => cat a a
- maybe :: b -> (a -> b) -> Maybe a -> b
- either :: (a -> c) -> (b -> c) -> Either a b -> c
- flip :: (a -> b -> c) -> b -> a -> c
- const :: a -> b -> a
- error :: HasCallStack => [Char] -> a
- putStr :: MonadIO m => Text -> m ()
- putStrLn :: MonadIO m => Text -> m ()
- print :: (MonadIO m, Show a) => a -> m ()
- getArgs :: MonadIO m => m [Text]
- terror :: HasCallStack => Text -> a
- odd :: Integral a => a -> Bool
- even :: Integral a => a -> Bool
- uncurry :: (a -> b -> c) -> (a, b) -> c
- curry :: ((a, b) -> c) -> a -> b -> c
- swap :: (a, b) -> (b, a)
- until :: (a -> Bool) -> (a -> a) -> a -> a
- asTypeOf :: a -> a -> a
- undefined :: HasCallStack => a
- seq :: a -> b -> b
- class Eq a => Ord a where
- class Eq a where
- class Bounded a where
- class Enum a where
- succ :: a -> a
- pred :: a -> a
- toEnum :: Int -> a
- fromEnum :: a -> Int
- enumFrom :: a -> [a]
- enumFromThen :: a -> a -> [a]
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
- class Show a
- class Read a
- class Functor (f :: Type -> Type) where
- class Applicative m => Monad (m :: Type -> Type) where
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- class IsString a where
- fromString :: String -> a
- class Num a where
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- class (Real a, Enum a) => Integral a where
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class Fractional a => Floating a where
- class (Real a, Fractional a) => RealFrac a where
- class (RealFrac a, Floating a) => RealFloat a where
- floatRadix :: a -> Integer
- floatDigits :: a -> Int
- floatRange :: a -> (Int, Int)
- decodeFloat :: a -> (Integer, Int)
- encodeFloat :: Integer -> Int -> a
- exponent :: a -> Int
- significand :: a -> a
- scaleFloat :: Int -> a -> a
- isNaN :: a -> Bool
- isInfinite :: a -> Bool
- isDenormalized :: a -> Bool
- isNegativeZero :: a -> Bool
- isIEEE :: a -> Bool
- atan2 :: a -> a -> a
- data Maybe a
- data Ordering
- data Bool
- data Char
- data IO a
- data Either a b
- data ByteString
- type LByteString = ByteString
- data Text
- type LText = Text
- data Map k a
- data HashMap k v
- data IntMap a
- data Set a
- data HashSet a
- data IntSet
- data Seq a
- data Vector a
- type UVector = Vector
- class (Vector Vector a, MVector MVector a) => Unbox a
- type SVector = Vector
- class Storable a
- class Eq a => Hashable a
- data Word
- data Word8
- data Word32
- data Word64
- data Int
- data Int32
- data Int64
- data Integer
- type Rational = Ratio Integer
- data Float
- data Double
- (^) :: (Num a, Integral b) => a -> b -> a
- (^^) :: (Fractional a, Integral b) => a -> b -> a
- subtract :: Num a => a -> a -> a
- fromIntegral :: (Integral a, Num b) => a -> b
- realToFrac :: (Real a, Fractional b) => a -> b
- class Semigroup a => Monoid a where
- (<>) :: Semigroup a => a -> a -> a
- class Foldable (t :: Type -> Type)
- asum :: (Foldable t, Alternative f) => t (f a) -> f a
- class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
- first :: Arrow a => a b c -> a (b, d) (c, d)
- second :: Arrow a => a b c -> a (d, b) (d, c)
- (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
- (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
- bool :: a -> a -> Bool -> a
- mapMaybe :: (a -> Maybe b) -> [a] -> [b]
- catMaybes :: [Maybe a] -> [a]
- fromMaybe :: a -> Maybe a -> a
- isJust :: Maybe a -> Bool
- isNothing :: Maybe a -> Bool
- listToMaybe :: [a] -> Maybe a
- maybeToList :: Maybe a -> [a]
- partitionEithers :: [Either a b] -> ([a], [b])
- lefts :: [Either a b] -> [a]
- rights :: [Either a b] -> [b]
- on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
- comparing :: Ord a => (b -> a) -> b -> b -> Ordering
- equating :: Eq a => (b -> a) -> b -> b -> Bool
- newtype Down a = Down {
- getDown :: a
- class Functor f => Applicative (f :: Type -> Type) where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (<|>) :: Alternative f => f a -> f a -> f a
- (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
- lift :: (MonadTrans t, Monad m) => m a -> t m a
- class Monad m => MonadIO (m :: Type -> Type)
- liftIO :: MonadIO m => IO a -> m a
- class (Typeable e, Show e) => Exception e where
- toException :: e -> SomeException
- fromException :: SomeException -> Maybe e
- displayException :: e -> String
- backtraceDesired :: e -> Bool
- class Typeable (a :: k)
- data SomeException
- data IOException
- module System.IO.Error
- type FilePath = String
- (</>) :: FilePath -> FilePath -> FilePath
- (<.>) :: FilePath -> String -> FilePath
- type String = [Char]
- hash :: Hashable a => a -> Int
- hashWithSalt :: Hashable a => Int -> a -> Int
Standard
Operators
($) :: (a -> b) -> a -> b infixr 0 #
is the function application operator.($)
Applying to a function ($)f and an argument x gives the same result as applying f to x directly. The definition is akin to this:
($) :: (a -> b) -> a -> b ($) f x = f x
This is specialized from ida -> a to (a -> b) -> (a -> b) which by the associativity of (->)
is the same as (a -> b) -> a -> b.
On the face of it, this may appear pointless! But it's actually one of the most useful and important operators in Haskell.
The order of operations is very different between ($) and normal function application. Normal function application has precedence 10 - higher than any operator - and associates to the left. So these two definitions are equivalent:
expr = min 5 1 + 5 expr = ((min 5) 1) + 5
($) has precedence 0 (the lowest) and associates to the right, so these are equivalent:
expr = min 5 $ 1 + 5 expr = (min 5) (1 + 5)
Examples
A common use cases of ($) is to avoid parentheses in complex expressions.
For example, instead of using nested parentheses in the following Haskell function:
-- | Sum numbers in a string: strSum "100 5 -7" == 98 strSum ::String->IntstrSum s =sum(mapMaybereadMaybe(wordss))
we can deploy the function application operator:
-- | Sum numbers in a string: strSum "100 5 -7" == 98 strSum ::String->IntstrSum s =sum$mapMaybereadMaybe$wordss
($) is also used as a section (a partially applied operator), in order to indicate that we wish to apply some yet-unspecified function to a given value. For example, to apply the argument 5 to a list of functions:
applyFive :: [Int] applyFive = map ($ 5) [(+1), (2^)] >>> [6, 32]
Technical Remark (Representation Polymorphism)
($) is fully representation-polymorphic. This allows it to also be used with arguments of unlifted and even unboxed kinds, such as unboxed integers:
fastMod :: Int -> Int -> Int fastMod (I# x) (I# m) = I# $ remInt# x m
($!) :: (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.
(.) :: forall (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c infixr 9 #
morphism composition
Functions
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 NothingFalse
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 GHC.Internal.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 , apply the first function to Left aa;
if it is , apply the second function to Right bb.
Examples
We create two values of type , one using the
Either String IntLeft 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) s3>>>either length (*2) n6
flip :: (a -> b -> c) -> b -> a -> c #
takes its (first) two arguments in the reverse order of flip ff.
flip f x y = f y x
flip . flip = id
Examples
>>>flip (++) "hello" "world""worldhello"
>>>let (.>) = flip (.) in (+1) .> show $ 5"6"
const x y always evaluates to x, ignoring its second argument.
const x = \_ -> x
This function might seem useless at first glance, but it can be very useful in a higher order context.
Examples
>>>const 42 "hello"42
>>>map (const 42) [0..3][42,42,42,42]
error :: HasCallStack => [Char] -> a #
error stops execution and displays an error message.
terror :: HasCallStack => Text -> a #
error applied to Text
Since 0.4.1
uncurry :: (a -> b -> c) -> (a, b) -> c #
uncurry converts a curried function to a function on pairs.
Examples
>>>uncurry (+) (1,2)3
>>>uncurry ($) (show, 1)"1"
>>>map (uncurry max) [(1,2), (3,4), (6,8)][2,4,8]
curry :: ((a, b) -> c) -> a -> b -> c #
Convert an uncurried function to a curried function.
Examples
>>>curry fst 1 21
until :: (a -> Bool) -> (a -> a) -> a -> a #
yields the result of applying until p ff until p holds.
undefined :: HasCallStack => a #
The value of is bottom if seq a ba is bottom, and
otherwise equal to b. In other words, it evaluates the first
argument a to weak head normal form (WHNF). seq is usually
introduced to improve performance by avoiding unneeded laziness.
A note on evaluation order: the expression does
not guarantee that seq a ba 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
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.
Ord, as defined by the Haskell report, implements a total order and has the
following properties:
- Comparability
x <= y || y <= x=True- Transitivity
- if
x <= y && y <= z=True, thenx <= z=True - Reflexivity
x <= x=True- Antisymmetry
- if
x <= y && y <= x=True, thenx == y=True
The following operator interactions are expected to hold:
x >= y=y <= xx < y=x <= y && x /= yx > y=y < xx < y=compare x y == LTx > y=compare x y == GTx == y=compare x y == EQmin x y == if x <= y then x else y=Truemax x y == if x >= y then x else y=True
Note that (7.) and (8.) do not require min and max to return either of
their arguments. The result is merely required to equal one of the
arguments in terms of (==).
Minimal complete definition: either compare or <=.
Using compare can be more efficient for complex types.
Methods
compare :: a -> a -> Ordering #
(<) :: a -> a -> Bool infix 4 #
(<=) :: a -> a -> Bool infix 4 #
(>) :: a -> a -> Bool infix 4 #
Instances
| Ord ByteArray | Non-lexicographic ordering. This compares the lengths of the byte arrays first and uses a lexicographic ordering if the lengths are equal. Subject to change between major versions. Since: base-4.17.0.0 |
| Ord ByteString | |
Defined in Data.ByteString.Internal.Type Methods compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |
| Ord ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods compare :: ByteString -> ByteString -> Ordering # (<) :: ByteString -> ByteString -> Bool # (<=) :: ByteString -> ByteString -> Bool # (>) :: ByteString -> ByteString -> Bool # (>=) :: ByteString -> ByteString -> Bool # max :: ByteString -> ByteString -> ByteString # min :: ByteString -> ByteString -> ByteString # | |
| Ord ShortByteString | Lexicographic order. |
Defined in Data.ByteString.Short.Internal Methods compare :: ShortByteString -> ShortByteString -> Ordering # (<) :: ShortByteString -> ShortByteString -> Bool # (<=) :: ShortByteString -> ShortByteString -> Bool # (>) :: ShortByteString -> ShortByteString -> Bool # (>=) :: ShortByteString -> ShortByteString -> Bool # max :: ShortByteString -> ShortByteString -> ShortByteString # min :: ShortByteString -> ShortByteString -> ShortByteString # | |
| Ord IntSet | |
| Ord BigNat | |
| Ord Void | @since base-4.8.0.0 |
| Ord SomeTypeRep | |
Defined in GHC.Internal.Data.Typeable.Internal Methods compare :: SomeTypeRep -> SomeTypeRep -> Ordering # (<) :: SomeTypeRep -> SomeTypeRep -> Bool # (<=) :: SomeTypeRep -> SomeTypeRep -> Bool # (>) :: SomeTypeRep -> SomeTypeRep -> Bool # (>=) :: SomeTypeRep -> SomeTypeRep -> Bool # max :: SomeTypeRep -> SomeTypeRep -> SomeTypeRep # min :: SomeTypeRep -> SomeTypeRep -> SomeTypeRep # | |
| Ord Version | @since base-2.01 |
Defined in GHC.Internal.Data.Version | |
| Ord ArithException | @since base-3.0 |
Defined in GHC.Internal.Exception.Type Methods compare :: ArithException -> ArithException -> Ordering # (<) :: ArithException -> ArithException -> Bool # (<=) :: ArithException -> ArithException -> Bool # (>) :: ArithException -> ArithException -> Bool # (>=) :: ArithException -> ArithException -> Bool # max :: ArithException -> ArithException -> ArithException # min :: ArithException -> ArithException -> ArithException # | |
| Ord CBool | |
| Ord CChar | |
| Ord CClock | |
| Ord CDouble | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CFloat | |
| Ord CInt | |
| Ord CIntMax | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CLLong | |
| Ord CLong | |
| Ord CPtrdiff | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CSChar | |
| Ord CSUSeconds | |
Defined in GHC.Internal.Foreign.C.Types Methods compare :: CSUSeconds -> CSUSeconds -> Ordering # (<) :: CSUSeconds -> CSUSeconds -> Bool # (<=) :: CSUSeconds -> CSUSeconds -> Bool # (>) :: CSUSeconds -> CSUSeconds -> Bool # (>=) :: CSUSeconds -> CSUSeconds -> Bool # max :: CSUSeconds -> CSUSeconds -> CSUSeconds # min :: CSUSeconds -> CSUSeconds -> CSUSeconds # | |
| Ord CShort | |
| Ord CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types Methods compare :: CSigAtomic -> CSigAtomic -> Ordering # (<) :: CSigAtomic -> CSigAtomic -> Bool # (<=) :: CSigAtomic -> CSigAtomic -> Bool # (>) :: CSigAtomic -> CSigAtomic -> Bool # (>=) :: CSigAtomic -> CSigAtomic -> Bool # max :: CSigAtomic -> CSigAtomic -> CSigAtomic # min :: CSigAtomic -> CSigAtomic -> CSigAtomic # | |
| Ord CSize | |
| Ord CTime | |
| Ord CUChar | |
| Ord CUInt | |
| Ord CUIntMax | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CULLong | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CULong | |
| Ord CUSeconds | |
| Ord CUShort | |
Defined in GHC.Internal.Foreign.C.Types | |
| Ord CWchar | |
| Ord Associativity | @since base-4.6.0.0 |
Defined in GHC.Internal.Generics Methods compare :: Associativity -> Associativity -> Ordering # (<) :: Associativity -> Associativity -> Bool # (<=) :: Associativity -> Associativity -> Bool # (>) :: Associativity -> Associativity -> Bool # (>=) :: Associativity -> Associativity -> Bool # max :: Associativity -> Associativity -> Associativity # min :: Associativity -> Associativity -> Associativity # | |
| Ord DecidedStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods compare :: DecidedStrictness -> DecidedStrictness -> Ordering # (<) :: DecidedStrictness -> DecidedStrictness -> Bool # (<=) :: DecidedStrictness -> DecidedStrictness -> Bool # (>) :: DecidedStrictness -> DecidedStrictness -> Bool # (>=) :: DecidedStrictness -> DecidedStrictness -> Bool # max :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # min :: DecidedStrictness -> DecidedStrictness -> DecidedStrictness # | |
| Ord Fixity | @since base-4.6.0.0 |
| Ord SourceStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods compare :: SourceStrictness -> SourceStrictness -> Ordering # (<) :: SourceStrictness -> SourceStrictness -> Bool # (<=) :: SourceStrictness -> SourceStrictness -> Bool # (>) :: SourceStrictness -> SourceStrictness -> Bool # (>=) :: SourceStrictness -> SourceStrictness -> Bool # max :: SourceStrictness -> SourceStrictness -> SourceStrictness # min :: SourceStrictness -> SourceStrictness -> SourceStrictness # | |
| Ord SourceUnpackedness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods compare :: SourceUnpackedness -> SourceUnpackedness -> Ordering # (<) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (<=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (>=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # max :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # min :: SourceUnpackedness -> SourceUnpackedness -> SourceUnpackedness # | |
| Ord ArrayException | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Exception Methods compare :: ArrayException -> ArrayException -> Ordering # (<) :: ArrayException -> ArrayException -> Bool # (<=) :: ArrayException -> ArrayException -> Bool # (>) :: ArrayException -> ArrayException -> Bool # (>=) :: ArrayException -> ArrayException -> Bool # max :: ArrayException -> ArrayException -> ArrayException # min :: ArrayException -> ArrayException -> ArrayException # | |
| Ord AsyncException | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Exception Methods compare :: AsyncException -> AsyncException -> Ordering # (<) :: AsyncException -> AsyncException -> Bool # (<=) :: AsyncException -> AsyncException -> Bool # (>) :: AsyncException -> AsyncException -> Bool # (>=) :: AsyncException -> AsyncException -> Bool # max :: AsyncException -> AsyncException -> AsyncException # min :: AsyncException -> AsyncException -> AsyncException # | |
| Ord ExitCode | |
Defined in GHC.Internal.IO.Exception | |
| Ord BufferMode | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types Methods compare :: BufferMode -> BufferMode -> Ordering # (<) :: BufferMode -> BufferMode -> Bool # (<=) :: BufferMode -> BufferMode -> Bool # (>) :: BufferMode -> BufferMode -> Bool # (>=) :: BufferMode -> BufferMode -> Bool # max :: BufferMode -> BufferMode -> BufferMode # min :: BufferMode -> BufferMode -> BufferMode # | |
| Ord Newline | @since base-4.3.0.0 |
Defined in GHC.Internal.IO.Handle.Types | |
| Ord NewlineMode | @since base-4.3.0.0 |
Defined in GHC.Internal.IO.Handle.Types Methods compare :: NewlineMode -> NewlineMode -> Ordering # (<) :: NewlineMode -> NewlineMode -> Bool # (<=) :: NewlineMode -> NewlineMode -> Bool # (>) :: NewlineMode -> NewlineMode -> Bool # (>=) :: NewlineMode -> NewlineMode -> Bool # max :: NewlineMode -> NewlineMode -> NewlineMode # min :: NewlineMode -> NewlineMode -> NewlineMode # | |
| Ord Int16 | @since base-2.01 |
| Ord Int32 | @since base-2.01 |
| Ord Int64 | @since base-2.01 |
| Ord Int8 | @since base-2.01 |
| Ord Word16 | @since base-2.01 |
| Ord Word32 | @since base-2.01 |
| Ord Word64 | @since base-2.01 |
| Ord Word8 | @since base-2.01 |
| Ord Ordering | |
Defined in GHC.Classes | |
| Ord TyCon | |
| Ord OsChar | Byte ordering of the internal representation. |
| Ord OsString | Byte ordering of the internal representation. |
Defined in System.OsString.Internal.Types | |
| Ord PosixChar | |
| Ord PosixString | |
Defined in System.OsString.Internal.Types Methods compare :: PosixString -> PosixString -> Ordering # (<) :: PosixString -> PosixString -> Bool # (<=) :: PosixString -> PosixString -> Bool # (>) :: PosixString -> PosixString -> Bool # (>=) :: PosixString -> PosixString -> Bool # max :: PosixString -> PosixString -> PosixString # min :: PosixString -> PosixString -> PosixString # | |
| Ord WindowsChar | |
Defined in System.OsString.Internal.Types Methods compare :: WindowsChar -> WindowsChar -> Ordering # (<) :: WindowsChar -> WindowsChar -> Bool # (<=) :: WindowsChar -> WindowsChar -> Bool # (>) :: WindowsChar -> WindowsChar -> Bool # (>=) :: WindowsChar -> WindowsChar -> Bool # max :: WindowsChar -> WindowsChar -> WindowsChar # min :: WindowsChar -> WindowsChar -> WindowsChar # | |
| Ord WindowsString | |
Defined in System.OsString.Internal.Types Methods compare :: WindowsString -> WindowsString -> Ordering # (<) :: WindowsString -> WindowsString -> Bool # (<=) :: WindowsString -> WindowsString -> Bool # (>) :: WindowsString -> WindowsString -> Bool # (>=) :: WindowsString -> WindowsString -> Bool # max :: WindowsString -> WindowsString -> WindowsString # min :: WindowsString -> WindowsString -> WindowsString # | |
| Ord I8 | |
| Ord Builder | |
Defined in Data.Text.Internal.Builder | |
| Ord Integer | |
| Ord Natural | |
| Ord () | |
| Ord Bool | |
| Ord Char | |
| Ord Double | IEEE 754 IEEE 754-2008, section 5.11 requires that if at least one of arguments of
IEEE 754-2008, section 5.10 defines Thus, users must be extremely cautious when using Moving further, the behaviour of IEEE 754-2008 compliant |
| Ord Float | See |
| Ord Int | |
| Ord Word | |
| Ord a => Ord (First a) | Since: base-4.9.0.0 |
| Ord a => Ord (Last a) | Since: base-4.9.0.0 |
| Ord a => Ord (Max a) | Since: base-4.9.0.0 |
| Ord a => Ord (Min a) | Since: base-4.9.0.0 |
| Ord m => Ord (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods compare :: WrappedMonoid m -> WrappedMonoid m -> Ordering # (<) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (<=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (>) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (>=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # max :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # min :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # | |
| Ord a => Ord (IntMap a) | |
Defined in Data.IntMap.Internal | |
| Ord a => Ord (Seq a) | |
| Ord a => Ord (ViewL a) | |
Defined in Data.Sequence.Internal | |
| Ord a => Ord (ViewR a) | |
Defined in Data.Sequence.Internal | |
| Ord a => Ord (Intersection a) | |
Defined in Data.Set.Internal Methods compare :: Intersection a -> Intersection a -> Ordering # (<) :: Intersection a -> Intersection a -> Bool # (<=) :: Intersection a -> Intersection a -> Bool # (>) :: Intersection a -> Intersection a -> Bool # (>=) :: Intersection a -> Intersection a -> Bool # max :: Intersection a -> Intersection a -> Intersection a # min :: Intersection a -> Intersection a -> Intersection a # | |
| Ord a => Ord (Set a) | |
| Ord a => Ord (Tree a) | Since: containers-0.6.5 |
| Ord a => Ord (NonEmpty a) | @since base-4.9.0.0 |
| Ord a => Ord (Down a) | @since base-4.6.0.0 |
| Ord p => Ord (Par1 p) | @since base-4.7.0.0 |
| Integral a => Ord (Ratio a) | @since base-2.0.1 |
| Ord a => Ord (Hashed a) | |
Defined in Data.Hashable.Class | |
| Ord a => Ord (Array a) | Lexicographic ordering. Subject to change between major versions. |
Defined in Data.Primitive.Array | |
| (Ord a, Prim a) => Ord (PrimArray a) | Lexicographic ordering. Subject to change between major versions. Since: primitive-0.6.4.0 |
Defined in Data.Primitive.PrimArray | |
| Ord a => Ord (SmallArray a) | Lexicographic ordering. Subject to change between major versions. |
Defined in Data.Primitive.SmallArray Methods compare :: SmallArray a -> SmallArray a -> Ordering # (<) :: SmallArray a -> SmallArray a -> Bool # (<=) :: SmallArray a -> SmallArray a -> Bool # (>) :: SmallArray a -> SmallArray a -> Bool # (>=) :: SmallArray a -> SmallArray a -> Bool # max :: SmallArray a -> SmallArray a -> SmallArray a # min :: SmallArray a -> SmallArray a -> SmallArray a # | |
| Ord a => Ord (Stream a) | |
Defined in Data.Text.Internal.Fusion.Types | |
| Ord a => Ord (HashSet a) | |
| Ord a => Ord (Vector a) | |
Defined in Data.Vector | |
| (Prim a, Ord a) => Ord (Vector a) | |
Defined in Data.Vector.Primitive | |
| (Storable a, Ord a) => Ord (Vector a) | |
Defined in Data.Vector.Storable | |
| Ord a => Ord (Vector a) | |
Defined in Data.Vector.Strict | |
| Ord a => Ord (Maybe a) | @since base-2.01 |
| Ord a => Ord (Solo a) | |
| Ord a => Ord [a] | |
| Ord (Fixed a) | Since: base-2.1 |
| Ord a => Ord (Arg a b) | Since: base-4.9.0.0 |
| (Ord k, Ord v) => Ord (Map k v) | |
| (Ord a, Ord b) => Ord (Either a b) | @since base-2.01 |
Defined in GHC.Internal.Data.Either | |
| Ord (TypeRep a) | @since base-4.4.0.0 |
Defined in GHC.Internal.Data.Typeable.Internal | |
| Ord (U1 p) | @since base-4.7.0.0 |
| Ord (V1 p) | @since base-4.9.0.0 |
| (Ord1 f, Ord a) => Ord (Lift f a) | |
Defined in Control.Applicative.Lift | |
| (Ord1 m, Ord a) => Ord (MaybeT m a) | |
Defined in Control.Monad.Trans.Maybe | |
| (Ord k, Ord v) => Ord (HashMap k v) | The ordering is total and consistent with the |
Defined in Data.HashMap.Internal | |
| (Ord a, Ord b) => Ord (a, b) | |
| (Generic1 f, Ord (Rep1 f a)) => Ord (Generically1 f a) | @since base-4.18.0.0 |
Defined in GHC.Internal.Generics Methods compare :: Generically1 f a -> Generically1 f a -> Ordering # (<) :: Generically1 f a -> Generically1 f a -> Bool # (<=) :: Generically1 f a -> Generically1 f a -> Bool # (>) :: Generically1 f a -> Generically1 f a -> Bool # (>=) :: Generically1 f a -> Generically1 f a -> Bool # max :: Generically1 f a -> Generically1 f a -> Generically1 f a # min :: Generically1 f a -> Generically1 f a -> Generically1 f a # | |
| Ord (f p) => Ord (Rec1 f p) | @since base-4.7.0.0 |
Defined in GHC.Internal.Generics | |
| Ord (URec (Ptr ()) p) | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering # (<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # | |
| Ord (URec Char p) | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Ord (URec Double p) | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods compare :: URec Double p -> URec Double p -> Ordering # (<) :: URec Double p -> URec Double p -> Bool # (<=) :: URec Double p -> URec Double p -> Bool # (>) :: URec Double p -> URec Double p -> Bool # (>=) :: URec Double p -> URec Double p -> Bool # | |
| Ord (URec Float p) | |
Defined in GHC.Internal.Generics | |
| Ord (URec Int p) | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Ord (URec Word p) | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| (Ord1 f, Ord a) => Ord (Backwards f a) | |
Defined in Control.Applicative.Backwards Methods compare :: Backwards f a -> Backwards f a -> Ordering # (<) :: Backwards f a -> Backwards f a -> Bool # (<=) :: Backwards f a -> Backwards f a -> Bool # (>) :: Backwards f a -> Backwards f a -> Bool # (>=) :: Backwards f a -> Backwards f a -> Bool # | |
| (Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) | |
Defined in Control.Monad.Trans.Except Methods compare :: ExceptT e m a -> ExceptT e m a -> Ordering # (<) :: ExceptT e m a -> ExceptT e m a -> Bool # (<=) :: ExceptT e m a -> ExceptT e m a -> Bool # (>) :: ExceptT e m a -> ExceptT e m a -> Bool # (>=) :: ExceptT e m a -> ExceptT e m a -> Bool # | |
| (Ord1 f, Ord a) => Ord (IdentityT f a) | |
Defined in Control.Monad.Trans.Identity Methods compare :: IdentityT f a -> IdentityT f a -> Ordering # (<) :: IdentityT f a -> IdentityT f a -> Bool # (<=) :: IdentityT f a -> IdentityT f a -> Bool # (>) :: IdentityT f a -> IdentityT f a -> Bool # (>=) :: IdentityT f a -> IdentityT f a -> Bool # | |
| (Ord w, Ord1 m, Ord a) => Ord (WriterT w m a) | |
Defined in Control.Monad.Trans.Writer.Lazy Methods compare :: WriterT w m a -> WriterT w m a -> Ordering # (<) :: WriterT w m a -> WriterT w m a -> Bool # (<=) :: WriterT w m a -> WriterT w m a -> Bool # (>) :: WriterT w m a -> WriterT w m a -> Bool # (>=) :: WriterT w m a -> WriterT w m a -> Bool # | |
| (Ord w, Ord1 m, Ord a) => Ord (WriterT w m a) | |
Defined in Control.Monad.Trans.Writer.Strict Methods compare :: WriterT w m a -> WriterT w m a -> Ordering # (<) :: WriterT w m a -> WriterT w m a -> Bool # (<=) :: WriterT w m a -> WriterT w m a -> Bool # (>) :: WriterT w m a -> WriterT w m a -> Bool # (>=) :: WriterT w m a -> WriterT w m a -> Bool # | |
| Ord a => Ord (Constant a b) | |
Defined in Data.Functor.Constant | |
| (Ord1 f, Ord a) => Ord (Reverse f a) | |
Defined in Data.Functor.Reverse | |
| (Ord a, Ord b, Ord c) => Ord (a, b, c) | |
| (Ord (f a), Ord (g a)) => Ord (Product f g a) | Since: base-4.18.0.0 |
Defined in Data.Functor.Product Methods compare :: Product f g a -> Product f g a -> Ordering # (<) :: Product f g a -> Product f g a -> Bool # (<=) :: Product f g a -> Product f g a -> Bool # (>) :: Product f g a -> Product f g a -> Bool # (>=) :: Product f g a -> Product f g a -> Bool # | |
| (Ord (f a), Ord (g a)) => Ord (Sum f g a) | Since: base-4.18.0.0 |
| (Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | @since base-4.7.0.0 |
Defined in GHC.Internal.Generics | |
| (Ord (f p), Ord (g p)) => Ord ((f :+: g) p) | @since base-4.7.0.0 |
Defined in GHC.Internal.Generics | |
| Ord c => Ord (K1 i c p) | @since base-4.7.0.0 |
Defined in GHC.Internal.Generics | |
| (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) | |
Defined in GHC.Classes | |
| Ord (f (g a)) => Ord (Compose f g a) | Since: base-4.18.0.0 |
Defined in Data.Functor.Compose Methods compare :: Compose f g a -> Compose f g a -> Ordering # (<) :: Compose f g a -> Compose f g a -> Bool # (<=) :: Compose f g a -> Compose f g a -> Bool # (>) :: Compose f g a -> Compose f g a -> Bool # (>=) :: Compose f g a -> Compose f g a -> Bool # | |
| Ord (f (g p)) => Ord ((f :.: g) p) | @since base-4.7.0.0 |
Defined in GHC.Internal.Generics | |
| Ord (f p) => Ord (M1 i c f p) | @since base-4.7.0.0 |
Defined in GHC.Internal.Generics | |
| (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) | |
Defined in GHC.Classes Methods compare :: (a, b, c, d, e) -> (a, b, c, d, e) -> Ordering # (<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # (>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool # max :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # min :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) | |
Defined in GHC.Classes Methods compare :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Ordering # (<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # (>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool # max :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # min :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) # | |
| (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) | |
Defined in GHC.Classes Methods compare :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Ordering # (<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # (>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool # max :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # min :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) # | |
| (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) | |
Defined in GHC.Classes Methods compare :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Ordering # (<) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (<=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # (>=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes Methods compare :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes Methods compare :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Ordering # (<) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes 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 # (<) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (<=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # (>=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes 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 # (<) :: (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 # (<=) :: (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 # (>) :: (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 # (>=) :: (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 # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes 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 # (<) :: (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 # (<=) :: (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 # (>) :: (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 # (>=) :: (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 # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes 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 # (<) :: (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 # (<=) :: (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 # (>) :: (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 # (>=) :: (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 # 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) # 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) # | |
| (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) | |
Defined in GHC.Classes 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 # (<) :: (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 # (<=) :: (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 # (>) :: (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 # (>=) :: (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 # 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) # 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) # | |
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.
The Haskell Report defines no laws for Eq. However, instances are
encouraged to follow these properties:
Instances
| Eq ByteArray | Since: base-4.17.0.0 |
| Eq Timeout | |
| Eq ByteString | |
Defined in Data.ByteString.Internal.Type | |
| Eq ByteString | |
Defined in Data.ByteString.Lazy.Internal | |
| Eq ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods (==) :: ShortByteString -> ShortByteString -> Bool # (/=) :: ShortByteString -> ShortByteString -> Bool # | |
| Eq IntSet | |
| Eq BigNat | |
| Eq Void | @since base-4.8.0.0 |
| Eq SomeTypeRep | |
Defined in GHC.Internal.Data.Typeable.Internal | |
| Eq Version | @since base-2.01 |
| Eq ArithException | @since base-3.0 |
Defined in GHC.Internal.Exception.Type Methods (==) :: ArithException -> ArithException -> Bool # (/=) :: ArithException -> ArithException -> Bool # | |
| Eq CBool | |
| Eq CChar | |
| Eq CClock | |
| Eq CDouble | |
| Eq CFloat | |
| Eq CInt | |
| Eq CIntMax | |
| Eq CIntPtr | |
| Eq CLLong | |
| Eq CLong | |
| Eq CPtrdiff | |
| Eq CSChar | |
| Eq CSUSeconds | |
Defined in GHC.Internal.Foreign.C.Types | |
| Eq CShort | |
| Eq CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types | |
| Eq CSize | |
| Eq CTime | |
| Eq CUChar | |
| Eq CUInt | |
| Eq CUIntMax | |
| Eq CUIntPtr | |
| Eq CULLong | |
| Eq CULong | |
| Eq CUSeconds | |
| Eq CUShort | |
| Eq CWchar | |
| Eq Associativity | @since base-4.6.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: Associativity -> Associativity -> Bool # (/=) :: Associativity -> Associativity -> Bool # | |
| Eq DecidedStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: DecidedStrictness -> DecidedStrictness -> Bool # (/=) :: DecidedStrictness -> DecidedStrictness -> Bool # | |
| Eq Fixity | @since base-4.6.0.0 |
| Eq SourceStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: SourceStrictness -> SourceStrictness -> Bool # (/=) :: SourceStrictness -> SourceStrictness -> Bool # | |
| Eq SourceUnpackedness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: SourceUnpackedness -> SourceUnpackedness -> Bool # (/=) :: SourceUnpackedness -> SourceUnpackedness -> Bool # | |
| Eq MaskingState | @since base-4.3.0.0 |
Defined in GHC.Internal.IO | |
| Eq ArrayException | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Exception Methods (==) :: ArrayException -> ArrayException -> Bool # (/=) :: ArrayException -> ArrayException -> Bool # | |
| Eq AsyncException | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Exception Methods (==) :: AsyncException -> AsyncException -> Bool # (/=) :: AsyncException -> AsyncException -> Bool # | |
| Eq ExitCode | |
| Eq IOErrorType | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception | |
| Eq IOException | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception | |
| Eq BufferMode | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types | |
| Eq Handle | @since base-4.1.0.0 |
| Eq Newline | @since base-4.2.0.0 |
| Eq NewlineMode | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types | |
| Eq Int16 | @since base-2.01 |
| Eq Int32 | @since base-2.01 |
| Eq Int64 | @since base-2.01 |
| Eq Int8 | @since base-2.01 |
| Eq SrcLoc | @since base-4.9.0.0 |
| Eq Word16 | @since base-2.01 |
| Eq Word32 | @since base-2.01 |
| Eq Word64 | @since base-2.01 |
| Eq Word8 | @since base-2.01 |
| Eq Module | |
| Eq Ordering | |
| Eq TrName | |
| Eq TyCon | |
| Eq OsChar | Byte equality of the internal representation. |
| Eq OsString | Byte equality of the internal representation. |
| Eq PosixChar | |
| Eq PosixString | |
Defined in System.OsString.Internal.Types | |
| Eq WindowsChar | |
Defined in System.OsString.Internal.Types | |
| Eq WindowsString | |
Defined in System.OsString.Internal.Types Methods (==) :: WindowsString -> WindowsString -> Bool # (/=) :: WindowsString -> WindowsString -> Bool # | |
| Eq Mode | |
| Eq Style | |
| Eq TextDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ | |
| Eq Doc | |
| Eq UnicodeException | |
Defined in Data.Text.Encoding.Error Methods (==) :: UnicodeException -> UnicodeException -> Bool # (/=) :: UnicodeException -> UnicodeException -> Bool # | |
| Eq I8 | |
| Eq Builder | |
| Eq PartialUtf8CodePoint | |
| Eq Utf8State | |
| Eq DecoderState | |
Defined in Data.Text.Internal.Encoding.Utf8 | |
| Eq Size | |
| Eq SubHashPath | |
Defined in Data.HashMap.Internal.Debug | |
| Eq Size | |
| Eq Checks | |
| Eq Integer | |
| Eq Natural | |
| Eq () | |
| Eq Bool | |
| Eq Char | |
| Eq Double | Note that due to the presence of
Also note that
|
| Eq Float | Note that due to the presence of
Also note that
|
| Eq Int | |
| Eq Word | |
| Eq (Chan a) | Since: base-4.4.0.0 |
| Eq (MutableByteArray s) | Since: base-4.17.0.0 |
Defined in Data.Array.Byte Methods (==) :: MutableByteArray s -> MutableByteArray s -> Bool # (/=) :: MutableByteArray s -> MutableByteArray s -> Bool # | |
| Eq a => Eq (Complex a) | Since: base-2.1 |
| Eq a => Eq (First a) | Since: base-4.9.0.0 |
| Eq a => Eq (Last a) | Since: base-4.9.0.0 |
| Eq a => Eq (Max a) | Since: base-4.9.0.0 |
| Eq a => Eq (Min a) | Since: base-4.9.0.0 |
| Eq m => Eq (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods (==) :: WrappedMonoid m -> WrappedMonoid m -> Bool # (/=) :: WrappedMonoid m -> WrappedMonoid m -> Bool # | |
| Eq vertex => Eq (SCC vertex) | Since: containers-0.5.9 |
| Eq a => Eq (IntMap a) | |
| Eq a => Eq (Seq a) | |
| Eq a => Eq (ViewL a) | |
| Eq a => Eq (ViewR a) | |
| Eq a => Eq (Intersection a) | |
Defined in Data.Set.Internal Methods (==) :: Intersection a -> Intersection a -> Bool # (/=) :: Intersection a -> Intersection a -> Bool # | |
| Eq a => Eq (Set a) | |
| Eq a => Eq (Tree a) | |
| Eq a => Eq (NonEmpty a) | @since base-4.9.0.0 |
| Eq a => Eq (Down a) | @since base-4.6.0.0 |
| Eq p => Eq (Par1 p) | @since base-4.7.0.0 |
| Eq a => Eq (Ratio a) | @since base-2.01 |
| Eq a => Eq (Hashed a) | Uses precomputed hash to detect inequality faster |
| Eq a => Eq (AnnotDetails a) | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods (==) :: AnnotDetails a -> AnnotDetails a -> Bool # (/=) :: AnnotDetails a -> AnnotDetails a -> Bool # | |
| Eq (Doc a) | |
| Eq a => Eq (Span a) | |
| Eq a => Eq (Array a) | |
| (Eq a, Prim a) => Eq (PrimArray a) | Since: primitive-0.6.4.0 |
| Eq a => Eq (SmallArray a) | |
Defined in Data.Primitive.SmallArray | |
| Eq a => Eq (Stream a) | |
| Eq k => Eq (Error k) | |
| Eq k => Eq (Validity k) | |
| Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. |
| Eq a => Eq (Vector a) | |
| (Prim a, Eq a) => Eq (Vector a) | |
| (Storable a, Eq a) => Eq (Vector a) | |
| Eq a => Eq (Vector a) | |
| Eq a => Eq (Maybe a) | @since base-2.01 |
| Eq a => Eq (Solo a) | |
| Eq a => Eq [a] | |
| Eq (Fixed a) | Since: base-2.1 |
| Eq a => Eq (Arg a b) | Since: base-4.9.0.0 |
| (Eq k, Eq a) => Eq (Map k a) | |
| (Eq a, Eq b) => Eq (Either a b) | @since base-2.01 |
| Eq (TypeRep a) | @since base-2.01 |
| Eq (U1 p) | @since base-4.9.0.0 |
| Eq (V1 p) | @since base-4.9.0.0 |
| Eq (MutableArray s a) | |
Defined in Data.Primitive.Array Methods (==) :: MutableArray s a -> MutableArray s a -> Bool # (/=) :: MutableArray s a -> MutableArray s a -> Bool # | |
| Eq (MutablePrimArray s a) | |
Defined in Data.Primitive.PrimArray Methods (==) :: MutablePrimArray s a -> MutablePrimArray s a -> Bool # (/=) :: MutablePrimArray s a -> MutablePrimArray s a -> Bool # | |
| Eq (SmallMutableArray s a) | |
Defined in Data.Primitive.SmallArray Methods (==) :: SmallMutableArray s a -> SmallMutableArray s a -> Bool # (/=) :: SmallMutableArray s a -> SmallMutableArray s a -> Bool # | |
| (Eq1 f, Eq a) => Eq (Lift f a) | |
| (Eq1 m, Eq a) => Eq (MaybeT m a) | |
| (Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. |
| (Eq k, Eq v) => Eq (Leaf k v) | |
| (Eq a, Eq b) => Eq (a, b) | |
| (Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) | @since base-4.18.0.0 |
Defined in GHC.Internal.Generics Methods (==) :: Generically1 f a -> Generically1 f a -> Bool # (/=) :: Generically1 f a -> Generically1 f a -> Bool # | |
| Eq (f p) => Eq (Rec1 f p) | @since base-4.7.0.0 |
| Eq (URec (Ptr ()) p) | @since base-4.9.0.0 |
| Eq (URec Char p) | @since base-4.9.0.0 |
| Eq (URec Double p) | @since base-4.9.0.0 |
| Eq (URec Float p) | |
| Eq (URec Int p) | @since base-4.9.0.0 |
| Eq (URec Word p) | @since base-4.9.0.0 |
| (Eq1 f, Eq a) => Eq (Backwards f a) | |
| (Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |
| (Eq1 f, Eq a) => Eq (IdentityT f a) | |
| (Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) | |
| (Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) | |
| Eq a => Eq (Constant a b) | |
| (Eq1 f, Eq a) => Eq (Reverse f a) | |
| (Eq a, Eq b, Eq c) => Eq (a, b, c) | |
| (Eq (f a), Eq (g a)) => Eq (Product f g a) | Since: base-4.18.0.0 |
| (Eq (f a), Eq (g a)) => Eq (Sum f g a) | Since: base-4.18.0.0 |
| (Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | @since base-4.7.0.0 |
| (Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | @since base-4.7.0.0 |
| Eq c => Eq (K1 i c p) | @since base-4.7.0.0 |
| (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) | |
| Eq (f (g a)) => Eq (Compose f g a) | Since: base-4.18.0.0 |
| Eq (f (g p)) => Eq ((f :.: g) p) | @since base-4.7.0.0 |
| Eq (f p) => Eq (M1 i c f p) | @since base-4.7.0.0 |
| (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) | |
| (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) | |
| (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) | |
| (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) | |
| (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) | |
| (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) | |
| (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) | |
| (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) | |
| (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) | |
| (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) | |
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.
Instances
| Bounded CBool | |
| Bounded CChar | |
| Bounded CInt | |
| Bounded CIntMax | |
| Bounded CIntPtr | |
| Bounded CLLong | |
| Bounded CLong | |
| Bounded CPtrdiff | |
| Bounded CSChar | |
| Bounded CShort | |
| Bounded CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types | |
| Bounded CSize | |
| Bounded CUChar | |
| Bounded CUInt | |
| Bounded CUIntMax | |
| Bounded CUIntPtr | |
| Bounded CULLong | |
| Bounded CULong | |
| Bounded CUShort | |
| Bounded CWchar | |
| Bounded Associativity | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Bounded DecidedStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Bounded SourceStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Bounded SourceUnpackedness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics | |
| Bounded Int16 | @since base-2.01 |
| Bounded Int32 | @since base-2.01 |
| Bounded Int64 | @since base-2.01 |
| Bounded Int8 | @since base-2.01 |
| Bounded Word16 | @since base-2.01 |
| Bounded Word32 | @since base-2.01 |
| Bounded Word64 | @since base-2.01 |
| Bounded Word8 | @since base-2.01 |
| Bounded Ordering | @since base-2.01 |
| Bounded I8 | |
| Bounded FPFormat | |
| Bounded () | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| Bounded Bool | @since base-2.01 |
| Bounded Char | @since base-2.01 |
| Bounded Int | @since base-2.01 |
| Bounded Levity | @since base-4.16.0.0 |
| Bounded VecCount | @since base-4.10.0.0 |
| Bounded VecElem | @since base-4.10.0.0 |
| Bounded Word | @since base-2.01 |
| Bounded a => Bounded (First a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Last a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Max a) | Since: base-4.9.0.0 |
| Bounded a => Bounded (Min a) | Since: base-4.9.0.0 |
| Bounded m => Bounded (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
| Bounded a => Bounded (Down a) | Swaps @since base-4.14.0.0 |
| Bounded a => Bounded (Solo a) | |
| (Bounded a, Bounded b) => Bounded (a, b) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| Bounded (f (g a)) => Bounded (Compose f g a) | Since: base-4.19.0.0 |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Enum | |
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:
- The calls
andsuccmaxBoundshould result in a runtime error.predminBound fromEnumandtoEnumshould give a runtime error if the result value is not representable in the result type. For example,is an error.toEnum7 ::BoolenumFromandenumFromThenshould be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound
enumFromThen x y = enumFromThenTo x y bound
where
bound | fromEnum y >= fromEnum x = maxBound
| otherwise = minBoundMethods
Successor of a value. For numeric types, succ adds 1.
Predecessor of a value. For numeric types, pred subtracts 1.
Convert from an 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.
Used in Haskell's translation of [n..] with [n..] = enumFrom n,
a possible implementation being enumFrom n = n : enumFrom (succ n).
Examples
enumFrom 4 :: [Integer] = [4,5,6,7,...]
enumFrom 6 :: [Int] = [6,7,8,9,...,maxBound :: Int]
enumFromThen :: a -> a -> [a] #
Used in Haskell's translation of [n,n'..]
with [n,n'..] = enumFromThen n n', a possible implementation being
enumFromThen n n' = n : n' : worker (f x) (f x n'),
worker s v = v : worker s (s v), x = fromEnum n' - fromEnum n and
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y
Examples
enumFromThen 4 6 :: [Integer] = [4,6,8,10...]
enumFromThen 6 2 :: [Int] = [6,2,-2,-6,...,minBound :: Int]
enumFromTo :: a -> a -> [a] #
Used in Haskell's translation of [n..m] with
[n..m] = enumFromTo n m, a possible implementation being
enumFromTo n m
| n <= m = n : enumFromTo (succ n) m
| otherwise = []
Examples
enumFromTo 6 10 :: [Int] = [6,7,8,9,10]
enumFromTo 42 1 :: [Integer] = []
enumFromThenTo :: a -> a -> a -> [a] #
Used in Haskell's translation of [n,n'..m] with
[n,n'..m] = enumFromThenTo n n' m, a possible implementation
being enumFromThenTo n n' m = worker (f x) (c x) n m,
x = fromEnum n' - fromEnum n, c x = bool (>=) ((x 0)
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y
and
worker s c v m
| c v m = v : worker s c (s v) m
| otherwise = []
Examples
enumFromThenTo 4 2 -6 :: [Integer] = [4,2,0,-2,-4,-6]
enumFromThenTo 6 8 2 :: [Int] = []
Instances
Conversion of values to readable Strings.
Derived instances of Show have the following properties, which
are compatible with derived instances of Read:
- The result of
showis a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used. - If the constructor is defined to be an infix operator, then
showsPrecwill produce infix applications of the constructor. - the representation will be enclosed in parentheses if the
precedence of the top-level constructor in
xis less thand(associativity is ignored). Thus, ifdis0then the result is never surrounded in parentheses; ifdis11it is always surrounded in parentheses, unless it is an atomic expression. - If the constructor is defined using record syntax, then
showwill produce the record-syntax form, with the fields given in the same order as the original declaration.
For example, given the declarations
infixr 5 :^: data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Show is equivalent to
instance (Show a) => Show (Tree a) where
showsPrec d (Leaf m) = showParen (d > app_prec) $
showString "Leaf " . showsPrec (app_prec+1) m
where app_prec = 10
showsPrec d (u :^: v) = showParen (d > up_prec) $
showsPrec (up_prec+1) u .
showString " :^: " .
showsPrec (up_prec+1) v
where up_prec = 5Note that right-associativity of :^: is ignored. For example,
produces the stringshow(Leaf 1 :^: Leaf 2 :^: Leaf 3)"Leaf 1 :^: (Leaf 2 :^: Leaf 3)".
Instances
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
Readinstance 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
Readwill parse only the record-syntax form, and furthermore, the fields must be given in the same order as the original declaration. - The derived
Readinstance 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 = 5Note 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 = readListPrecDefaultWhy do both readsPrec and readPrec exist, and why does GHC opt to
implement readPrec in derived Read instances instead of readsPrec?
The reason is that readsPrec is based on the ReadS type, and although
ReadS is mentioned in the Haskell 2010 Report, it is not a very efficient
parser data structure.
readPrec, on the other hand, is based on a much more efficient ReadPrec
datatype (a.k.a "new-style parsers"), but its definition relies on the use
of the RankNTypes language extension. Therefore, readPrec (and its
cousin, readListPrec) are marked as GHC-only. Nevertheless, it is
recommended to use readPrec instead of readsPrec whenever possible
for the efficiency improvements it brings.
As mentioned above, derived Read instances in GHC will implement
readPrec instead of readsPrec. The default implementations of
readsPrec (and its cousin, readList) will simply use readPrec under
the hood. If you are writing a Read instance by hand, it is recommended
to write it like so:
instanceReadT wherereadPrec= ...readListPrec=readListPrecDefault
Instances
| Read ByteString | |
Defined in Data.ByteString.Internal.Type Methods readsPrec :: Int -> ReadS ByteString # readList :: ReadS [ByteString] # readPrec :: ReadPrec ByteString # readListPrec :: ReadPrec [ByteString] # | |
| Read ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods readsPrec :: Int -> ReadS ByteString # readList :: ReadS [ByteString] # readPrec :: ReadPrec ByteString # readListPrec :: ReadPrec [ByteString] # | |
| Read ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods readsPrec :: Int -> ReadS ShortByteString # readList :: ReadS [ShortByteString] # | |
| Read IntSet | |
| Read Void | Reading a @since base-4.8.0.0 |
| Read Version | @since base-2.01 |
| Read CBool | |
| Read CChar | |
| Read CClock | |
| Read CDouble | |
| Read CFloat | |
| Read CInt | |
| Read CIntMax | |
| Read CIntPtr | |
| Read CLLong | |
| Read CLong | |
| Read CPtrdiff | |
| Read CSChar | |
| Read CSUSeconds | |
Defined in GHC.Internal.Foreign.C.Types Methods readsPrec :: Int -> ReadS CSUSeconds # readList :: ReadS [CSUSeconds] # readPrec :: ReadPrec CSUSeconds # readListPrec :: ReadPrec [CSUSeconds] # | |
| Read CShort | |
| Read CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types Methods readsPrec :: Int -> ReadS CSigAtomic # readList :: ReadS [CSigAtomic] # readPrec :: ReadPrec CSigAtomic # readListPrec :: ReadPrec [CSigAtomic] # | |
| Read CSize | |
| Read CTime | |
| Read CUChar | |
| Read CUInt | |
| Read CUIntMax | |
| Read CUIntPtr | |
| Read CULLong | |
| Read CULong | |
| Read CUSeconds | |
| Read CUShort | |
| Read CWchar | |
| Read Associativity | @since base-4.6.0.0 |
Defined in GHC.Internal.Generics Methods readsPrec :: Int -> ReadS Associativity # readList :: ReadS [Associativity] # | |
| Read DecidedStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods readsPrec :: Int -> ReadS DecidedStrictness # readList :: ReadS [DecidedStrictness] # | |
| Read Fixity | @since base-4.6.0.0 |
| Read SourceStrictness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods readsPrec :: Int -> ReadS SourceStrictness # readList :: ReadS [SourceStrictness] # | |
| Read SourceUnpackedness | @since base-4.9.0.0 |
Defined in GHC.Internal.Generics Methods readsPrec :: Int -> ReadS SourceUnpackedness # readList :: ReadS [SourceUnpackedness] # | |
| Read ExitCode | |
| Read BufferMode | @since base-4.2.0.0 |
Defined in GHC.Internal.IO.Handle.Types Methods readsPrec :: Int -> ReadS BufferMode # readList :: ReadS [BufferMode] # readPrec :: ReadPrec BufferMode # readListPrec :: ReadPrec [BufferMode] # | |
| Read Newline | @since base-4.3.0.0 |
| Read NewlineMode | @since base-4.3.0.0 |
Defined in GHC.Internal.IO.Handle.Types Methods readsPrec :: Int -> ReadS NewlineMode # readList :: ReadS [NewlineMode] # readPrec :: ReadPrec NewlineMode # readListPrec :: ReadPrec [NewlineMode] # | |
| Read Int16 | @since base-2.01 |
| Read Int32 | @since base-2.01 |
| Read Int64 | @since base-2.01 |
| Read Int8 | @since base-2.01 |
| Read Lexeme | @since base-2.01 |
| Read GeneralCategory | @since base-2.01 |
Defined in GHC.Internal.Read Methods readsPrec :: Int -> ReadS GeneralCategory # readList :: ReadS [GeneralCategory] # | |
| Read Word16 | @since base-2.01 |
| Read Word32 | @since base-2.01 |
| Read Word64 | @since base-2.01 |
| Read Word8 | @since base-2.01 |
| Read Ordering | @since base-2.01 |
| Read I8 | |
| Read FPFormat | |
| Read Integer | @since base-2.01 |
| Read Natural | @since base-4.8.0.0 |
| Read () | @since base-2.01 |
| Read Bool | @since base-2.01 |
| Read Char | @since base-2.01 |
| Read Double | @since base-2.01 |
| Read Float | @since base-2.01 |
| Read Int | @since base-2.01 |
| Read Word | @since base-4.5.0.0 |
| Read a => Read (Complex a) | Since: base-2.1 |
| Read a => Read (First a) | Since: base-4.9.0.0 |
| Read a => Read (Last a) | Since: base-4.9.0.0 |
| Read a => Read (Max a) | Since: base-4.9.0.0 |
| Read a => Read (Min a) | Since: base-4.9.0.0 |
| Read m => Read (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods readsPrec :: Int -> ReadS (WrappedMonoid m) # readList :: ReadS [WrappedMonoid m] # readPrec :: ReadPrec (WrappedMonoid m) # readListPrec :: ReadPrec [WrappedMonoid m] # | |
| Read vertex => Read (SCC vertex) | Since: containers-0.5.9 |
| Read e => Read (IntMap e) | |
| Read a => Read (Seq a) | |
| Read a => Read (ViewL a) | |
| Read a => Read (ViewR a) | |
| (Read a, Ord a) => Read (Set a) | |
| Read a => Read (Tree a) | |
| Read a => Read (NonEmpty a) | @since base-4.11.0.0 |
| Read a => Read (Down a) | This instance would be equivalent to the derived instances of the
@since base-4.7.0.0 |
| Read p => Read (Par1 p) | @since base-4.7.0.0 |
| (Integral a, Read a) => Read (Ratio a) | @since base-2.01 |
| Read a => Read (Array a) | |
| Read a => Read (SmallArray a) | |
Defined in Data.Primitive.SmallArray Methods readsPrec :: Int -> ReadS (SmallArray a) # readList :: ReadS [SmallArray a] # readPrec :: ReadPrec (SmallArray a) # readListPrec :: ReadPrec [SmallArray a] # | |
| (Eq a, Hashable a, Read a) => Read (HashSet a) | |
| Read a => Read (Vector a) | |
| (Read a, Prim a) => Read (Vector a) | |
| (Read a, Storable a) => Read (Vector a) | |
| Read a => Read (Vector a) | |
| Read a => Read (Maybe a) | @since base-2.01 |
| Read a => Read (Solo a) | @since base-4.15 |
| Read a => Read [a] | @since base-2.01 |
| HasResolution a => Read (Fixed a) | Since: base-4.3.0.0 |
| (Read a, Read b) => Read (Arg a b) | Since: base-4.9.0.0 |
| (Ord k, Read k, Read e) => Read (Map k e) | |
| (Ix a, Read a, Read b) => Read (Array a b) | @since base-2.01 |
| (Read a, Read b) => Read (Either a b) | @since base-3.0 |
| Read (U1 p) | @since base-4.9.0.0 |
| Read (V1 p) | @since base-4.9.0.0 |
| (Read1 f, Read a) => Read (Lift f a) | |
| (Read1 m, Read a) => Read (MaybeT m a) | |
| (Eq k, Hashable k, Read k, Read e) => Read (HashMap k e) | |
| (Read a, Read b) => Read (a, b) | @since base-2.01 |
| Read (f p) => Read (Rec1 f p) | @since base-4.7.0.0 |
| (Read1 f, Read a) => Read (Backwards f a) | |
| (Read e, Read1 m, Read a) => Read (ExceptT e m a) | |
| (Read1 f, Read a) => Read (IdentityT f a) | |
| (Read w, Read1 m, Read a) => Read (WriterT w m a) | |
| (Read w, Read1 m, Read a) => Read (WriterT w m a) | |
| Read a => Read (Constant a b) | |
| (Read1 f, Read a) => Read (Reverse f a) | |
| (Read a, Read b, Read c) => Read (a, b, c) | @since base-2.01 |
| (Read (f a), Read (g a)) => Read (Product f g a) | Since: base-4.18.0.0 |
| (Read (f a), Read (g a)) => Read (Sum f g a) | Since: base-4.18.0.0 |
| (Read (f p), Read (g p)) => Read ((f :*: g) p) | @since base-4.7.0.0 |
| (Read (f p), Read (g p)) => Read ((f :+: g) p) | @since base-4.7.0.0 |
| Read c => Read (K1 i c p) | @since base-4.7.0.0 |
| (Read a, Read b, Read c, Read d) => Read (a, b, c, d) | @since base-2.01 |
| Read (f (g a)) => Read (Compose f g a) | Since: base-4.18.0.0 |
| Read (f (g p)) => Read ((f :.: g) p) | @since base-4.7.0.0 |
| Read (f p) => Read (M1 i c f p) | @since base-4.7.0.0 |
| (Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e) | @since base-2.01 |
| (Read a, Read b, Read c, Read d, Read e, Read f) => Read (a, b, c, d, e, f) | @since base-2.01 |
| (Read a, Read b, Read c, Read d, Read e, Read f, Read g) => Read (a, b, c, d, e, f, g) | @since base-2.01 |
| (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) | @since base-2.01 |
| (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) | @since base-2.01 |
| (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) | @since base-2.01 |
| (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) | @since base-2.01 |
| (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) | @since base-2.01 |
| (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) | @since base-2.01 |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Read | |
| (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) | @since base-2.01 |
Defined in GHC.Internal.Read | |
class Functor (f :: Type -> Type) where #
A type f is a Functor if it provides a function fmap which, given any types a and b
lets you apply any function from (a -> b) to turn an f a into an f b, preserving the
structure of f. Furthermore f needs to adhere to the following:
Note, that the second law follows from the free theorem of the type fmap and
the first law, so you need only check that the former condition holds.
See these articles by School of Haskell or
David Luposchainsky
for an explanation.
Minimal complete definition
Methods
fmap :: (a -> b) -> f a -> f b #
fmap is used to apply a function of type (a -> b) to a value of type f a,
where f is a functor, to produce a value of type f b.
Note that for any type constructor with more than one parameter (e.g., Either),
only the last type parameter can be modified with fmap (e.g., b in `Either a b`).
Some type constructors with two parameters or more have a instance that allows
both the last and the penultimate parameters to be mapped over.Bifunctor
Examples
Convert from a to a Maybe IntMaybe String
using show:
>>>fmap show NothingNothing>>>fmap show (Just 3)Just "3"
Convert from an to an
Either Int IntEither Int String using show:
>>>fmap show (Left 17)Left 17>>>fmap show (Right 17)Right "17"
Double each element of a list:
>>>fmap (*2) [1,2,3][2,4,6]
Apply even to the second element of a pair:
>>>fmap even (2,2)(2,True)
It may seem surprising that the function is only applied to the last element of the tuple
compared to the list example above which applies it to every element in the list.
To understand, remember that tuples are type constructors with multiple type parameters:
a tuple of 3 elements (a,b,c) can also be written (,,) a b c and its Functor instance
is defined for Functor ((,,) a b) (i.e., only the third parameter is free to be mapped over
with fmap).
It explains why fmap can be used with tuples containing values of different types as in the
following example:
>>>fmap even ("hello", 1.0, 4)("hello",1.0,True)
Instances
| Functor Complex | Since: base-4.9.0.0 |
| Functor First | Since: base-4.9.0.0 |
| Functor Last | Since: base-4.9.0.0 |
| Functor Max | Since: base-4.9.0.0 |
| Functor Min | Since: base-4.9.0.0 |
| Functor ArgDescr | Since: base-4.7.0.0 |
| Functor ArgOrder | Since: base-4.7.0.0 |
| Functor OptDescr | Since: base-4.7.0.0 |
| Functor Put | |
| Functor SCC | Since: containers-0.5.4 |
| Functor IntMap | |
| Functor Digit | |
| Functor Elem | |
| Functor FingerTree | |
Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> FingerTree a -> FingerTree b # (<$) :: a -> FingerTree b -> FingerTree a # | |
| Functor Node | |
| Functor Seq | |
| Functor ViewL | |
| Functor ViewR | |
| Functor Tree | |
| Functor NonEmpty | @since base-4.9.0.0 |
| Functor Down | @since base-4.11.0.0 |
| Functor Par1 | @since base-4.9.0.0 |
| Functor P | @since base-4.8.0.0 |
Defined in GHC.Internal.Text.ParserCombinators.ReadP | |
| Functor ReadP | @since base-2.01 |
| Functor IO | @since base-2.01 |
| Functor AnnotDetails | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods fmap :: (a -> b) -> AnnotDetails a -> AnnotDetails b # (<$) :: a -> AnnotDetails b -> AnnotDetails a # | |
| Functor Doc | |
| Functor Span | |
| Functor Array | |
| Functor SmallArray | |
Defined in Data.Primitive.SmallArray Methods fmap :: (a -> b) -> SmallArray a -> SmallArray b # (<$) :: a -> SmallArray b -> SmallArray a # | |
| Functor Vector | |
| Functor Id | |
Defined in Data.Vector.Fusion.Util | |
| Functor Vector | |
Defined in Data.Vector.Strict | |
| Functor Maybe | @since base-2.01 |
| Functor Solo | @since base-4.15 |
| Functor [] | @since base-2.01 |
Defined in GHC.Internal.Base | |
| Monad m => Functor (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative Methods fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b # (<$) :: a -> WrappedMonad m b -> WrappedMonad m a # | |
| Functor (Arg a) | Since: base-4.9.0.0 |
| Functor (SetM s) | |
Defined in Data.Graph | |
| Functor (Map k) | |
| Arrow a => Functor (ArrowMonad a) | @since base-4.6.0.0 |
Defined in GHC.Internal.Control.Arrow Methods fmap :: (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # (<$) :: a0 -> ArrowMonad a b -> ArrowMonad a a0 # | |
| Functor (Either a) | @since base-3.0 |
| Functor (U1 :: Type -> Type) | @since base-4.9.0.0 |
| Functor (V1 :: Type -> Type) | @since base-4.9.0.0 |
| Functor (IParser t) | |
| Functor f => Functor (Lift f) | |
| Functor m => Functor (MaybeT m) | |
| Functor (HashMap k) | |
| Functor ((,) a) | @since base-2.01 |
Defined in GHC.Internal.Base | |
| Arrow a => Functor (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative Methods fmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # (<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |
| (Applicative f, Monad f) => Functor (WhenMissing f x) | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods fmap :: (a -> b) -> WhenMissing f x a -> WhenMissing f x b # (<$) :: a -> WhenMissing f x b -> WhenMissing f x a # | |
| Functor m => Functor (Kleisli m a) | @since base-4.14.0.0 |
| (Generic1 f, Functor (Rep1 f)) => Functor (Generically1 f) | @since base-4.17.0.0 |
Defined in GHC.Internal.Generics Methods fmap :: (a -> b) -> Generically1 f a -> Generically1 f b # (<$) :: a -> Generically1 f b -> Generically1 f a # | |
| Functor f => Functor (Rec1 f) | @since base-4.9.0.0 |
| Functor (URec (Ptr ()) :: Type -> Type) | @since base-4.9.0.0 |
| Functor (URec Char :: Type -> Type) | @since base-4.9.0.0 |
| Functor (URec Double :: Type -> Type) | @since base-4.9.0.0 |
| Functor (URec Float :: Type -> Type) | @since base-4.9.0.0 |
| Functor (URec Int :: Type -> Type) | @since base-4.9.0.0 |
| Functor (URec Word :: Type -> Type) | @since base-4.9.0.0 |
| Functor f => Functor (Backwards f) | Derived instance. |
| Functor m => Functor (AccumT w m) | |
| Functor m => Functor (ExceptT e m) | |
| Functor m => Functor (IdentityT m) | |
| Functor m => Functor (ReaderT r m) | |
| Functor m => Functor (SelectT r m) | |
| Functor m => Functor (StateT s m) | |
| Functor m => Functor (StateT s m) | |
| Functor m => Functor (WriterT w m) | |
| Functor m => Functor (WriterT w m) | |
| Functor m => Functor (WriterT w m) | |
| Functor (Constant a :: Type -> Type) | |
| Functor f => Functor (Reverse f) | Derived instance. |
| Monad m => Functor (Bundle m v) | |
Defined in Data.Vector.Fusion.Bundle.Monadic | |
| Functor ((,,) a b) | @since base-4.14.0.0 |
Defined in GHC.Internal.Base | |
| (Functor f, Functor g) => Functor (Product f g) | Since: base-4.9.0.0 |
| (Functor f, Functor g) => Functor (Sum f g) | Since: base-4.9.0.0 |
| Functor f => Functor (WhenMatched f x y) | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods fmap :: (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b # (<$) :: a -> WhenMatched f x y b -> WhenMatched f x y a # | |
| (Applicative f, Monad f) => Functor (WhenMissing f k x) | Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods fmap :: (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b # (<$) :: a -> WhenMissing f k x b -> WhenMissing f k x a # | |
| (Functor f, Functor g) => Functor (f :*: g) | @since base-4.9.0.0 |
| (Functor f, Functor g) => Functor (f :+: g) | @since base-4.9.0.0 |
| Functor (K1 i c :: Type -> Type) | @since base-4.9.0.0 |
| Functor (ContT r m) | |
| Functor ((,,,) a b c) | @since base-4.14.0.0 |
Defined in GHC.Internal.Base | |
| Functor ((->) r) | @since base-2.01 |
Defined in GHC.Internal.Base | |
| (Functor f, Functor g) => Functor (Compose f g) | Since: base-4.9.0.0 |
| Functor f => Functor (WhenMatched f k x y) | Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods fmap :: (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b # (<$) :: a -> WhenMatched f k x y b -> WhenMatched f k x y a # | |
| (Functor f, Functor g) => Functor (f :.: g) | @since base-4.9.0.0 |
| Functor f => Functor (M1 i c f) | @since base-4.9.0.0 |
| Functor m => Functor (RWST r w s m) | |
| Functor m => Functor (RWST r w s m) | |
| Functor m => Functor (RWST r w s m) | |
| Functor ((,,,,) a b c d) | @since base-4.18.0.0 |
Defined in GHC.Internal.Base | |
| Functor ((,,,,,) a b c d e) | @since base-4.18.0.0 |
Defined in GHC.Internal.Base | |
| Functor ((,,,,,,) a b c d e f) | @since base-4.18.0.0 |
Defined in GHC.Internal.Base | |
class Applicative m => Monad (m :: Type -> Type) 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:
- Left identity
returna>>=k = k a- Right identity
m>>=return= m- Associativity
m>>=(\x -> k x>>=h) = (m>>=k)>>=h
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 List, Maybe and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Methods
(>>=) :: 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.
'as ' can be understood as the >>= bsdo expression
do a <- as bs a
An alternative name for this function is 'bind', but some people may refer to it as 'flatMap', which results from it being equivialent to
\x f ->join(fmapf x) :: Monad m => m a -> (a -> m b) -> m b
which can be seen as mapping a value with
Monad m => m a -> m (m b) and then 'flattening' m (m b) to m b using join.
(>>) :: 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.
'as ' can be understood as the >> bsdo expression
do as bs
or in terms of as(>>=)
as >>= const bs
Inject a value into the monadic type.
This function should not be different from its default implementation
as pure. The justification for the existence of this function is
merely historic.
Instances
| Monad Complex | Since: base-4.9.0.0 |
| Monad First | Since: base-4.9.0.0 |
| Monad Last | Since: base-4.9.0.0 |
| Monad Max | Since: base-4.9.0.0 |
| Monad Min | Since: base-4.9.0.0 |
| Monad Put | |
| Monad Seq | |
| Monad Tree | |
| Monad NonEmpty | @since base-4.9.0.0 |
| Monad Down | @since base-4.11.0.0 |
| Monad Par1 | @since base-4.9.0.0 |
| Monad P | @since base-2.01 |
| Monad ReadP | @since base-2.01 |
| Monad IO | @since base-2.01 |
| Monad Array | |
| Monad SmallArray | |
Defined in Data.Primitive.SmallArray Methods (>>=) :: SmallArray a -> (a -> SmallArray b) -> SmallArray b # (>>) :: SmallArray a -> SmallArray b -> SmallArray b # return :: a -> SmallArray a # | |
| Monad Vector | |
| Monad Id | |
| Monad Vector | |
| Monad Maybe | @since base-2.01 |
| Monad Solo | @since base-4.15 |
| Monad [] | @since base-2.01 |
| Monad m => Monad (WrappedMonad m) | Since: base-4.7.0.0 |
Defined in Control.Applicative 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 # | |
| Monad (SetM s) | |
| ArrowApply a => Monad (ArrowMonad a) | @since base-2.01 |
Defined in GHC.Internal.Control.Arrow Methods (>>=) :: ArrowMonad a a0 -> (a0 -> ArrowMonad a b) -> ArrowMonad a b # (>>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b # return :: a0 -> ArrowMonad a a0 # | |
| Monad (Either e) | @since base-4.4.0.0 |
| Monad (U1 :: Type -> Type) | @since base-4.9.0.0 |
| Monad (IParser t) | |
| Monad m => Monad (MaybeT m) | |
| Monoid a => Monad ((,) a) | @since base-4.9.0.0 |
| (Applicative f, Monad f) => Monad (WhenMissing f x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods (>>=) :: WhenMissing f x a -> (a -> WhenMissing f x b) -> WhenMissing f x b # (>>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b # return :: a -> WhenMissing f x a # | |
| Monad m => Monad (Kleisli m a) | @since base-4.14.0.0 |
| Monad f => Monad (Rec1 f) | @since base-4.9.0.0 |
| (Monoid w, Functor m, Monad m) => Monad (AccumT w m) | |
| Monad m => Monad (ExceptT e m) | |
| Monad m => Monad (IdentityT m) | |
| Monad m => Monad (ReaderT r m) | |
| Monad m => Monad (SelectT r m) | |
| Monad m => Monad (StateT s m) | |
| Monad m => Monad (StateT s m) | |
| Monad m => Monad (WriterT w m) | |
| (Monoid w, Monad m) => Monad (WriterT w m) | |
| (Monoid w, Monad m) => Monad (WriterT w m) | |
| Monad m => Monad (Reverse m) | Derived instance. |
| (Monoid a, Monoid b) => Monad ((,,) a b) | @since base-4.14.0.0 |
| (Monad f, Monad g) => Monad (Product f g) | Since: base-4.9.0.0 |
| (Monad f, Applicative f) => Monad (WhenMatched f x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods (>>=) :: WhenMatched f x y a -> (a -> WhenMatched f x y b) -> WhenMatched f x y b # (>>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b # return :: a -> WhenMatched f x y a # | |
| (Applicative f, Monad f) => Monad (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods (>>=) :: WhenMissing f k x a -> (a -> WhenMissing f k x b) -> WhenMissing f k x b # (>>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # return :: a -> WhenMissing f k x a # | |
| (Monad f, Monad g) => Monad (f :*: g) | @since base-4.9.0.0 |
| Monad (ContT r m) | |
| (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) | @since base-4.14.0.0 |
| Monad ((->) r) | @since base-2.01 |
| (Monad f, Applicative f) => Monad (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods (>>=) :: WhenMatched f k x y a -> (a -> WhenMatched f k x y b) -> WhenMatched f k x y b # (>>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # return :: a -> WhenMatched f k x y a # | |
| Monad f => Monad (M1 i c f) | @since base-4.9.0.0 |
| Monad m => Monad (RWST r w s m) | |
| (Monoid w, Monad m) => Monad (RWST r w s m) | |
| (Monoid w, Monad m) => Monad (RWST r w s m) | |
(=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 #
Same as >>=, but with the arguments interchanged.
as >>= f == f =<< as
IsString is used in combination with the -XOverloadedStrings
language extension to convert the literals to different string types.
For example, if you use the text package, you can say
{-# LANGUAGE OverloadedStrings #-}
myText = "hello world" :: Text
Internally, the extension will convert this to the equivalent of
myText = fromString @Text ("hello world" :: String)
Note: You can use fromString in normal code as well,
but the usual performance/memory efficiency problems with String apply.
Methods
fromString :: String -> a #
Instances
| IsString ByteString | Beware: |
Defined in Data.ByteString.Internal.Type Methods fromString :: String -> ByteString # | |
| IsString ByteString | Beware: |
Defined in Data.ByteString.Lazy.Internal Methods fromString :: String -> ByteString # | |
| IsString ShortByteString | Beware: |
Defined in Data.ByteString.Short.Internal Methods fromString :: String -> ShortByteString # | |
| IsString Doc | |
Defined in Text.PrettyPrint.HughesPJ Methods fromString :: String -> Doc # | |
| IsString Builder | Performs replacement on invalid scalar values:
|
Defined in Data.Text.Internal.Builder Methods fromString :: String -> Builder # | |
| a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
| IsString a => IsString (Identity a) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.String Methods fromString :: String -> Identity a # | |
| (IsString a, Hashable a) => IsString (Hashed a) | |
Defined in Data.Hashable.Class Methods fromString :: String -> Hashed a # | |
| IsString (Doc a) | |
Defined in Text.PrettyPrint.Annotated.HughesPJ Methods fromString :: String -> Doc a # | |
| a ~ Char => IsString [a] |
@since base-2.01 |
Defined in GHC.Internal.Data.String Methods fromString :: String -> [a] # | |
| IsString a => IsString (Const a b) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.String Methods fromString :: String -> Const a b # | |
Numeric type classes
Basic numeric class.
The Haskell Report defines no laws for Num. However, ( and +)( are
customarily expected to define a ring and have the following properties:*)
- Associativity of
(+) (x + y) + z=x + (y + z)- Commutativity of
(+) x + y=y + xis the additive identityfromInteger0x + fromInteger 0=xnegategives the additive inversex + negate x=fromInteger 0- Associativity of
(*) (x * y) * z=x * (y * z)is the multiplicative identityfromInteger1x * fromInteger 1=xandfromInteger 1 * x=x- Distributivity of
(with respect to*)(+) a * (b + c)=(a * b) + (a * c)and(b + c) * a=(b * a) + (c * a)- Coherence with
toInteger - if the type also implements
Integral, thenfromIntegeris a left inverse fortoInteger, i.e.fromInteger (toInteger i) == i
Note that it isn't customarily expected that a type instance of both Num
and Ord implement an ordered ring. Indeed, in base only Integer and
Rational do.
Methods
Unary negation.
Absolute value.
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 CBool | |
| Num CChar | |
| Num CClock | |
| Num CDouble | |
| Num CFloat | |
| Num CInt | |
| Num CIntMax | |
| Num CIntPtr | |
| Num CLLong | |
| Num CLong | |
| Num CPtrdiff | |
| Num CSChar | |
| Num CSUSeconds | |
Defined in GHC.Internal.Foreign.C.Types Methods (+) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (-) :: CSUSeconds -> CSUSeconds -> CSUSeconds # (*) :: CSUSeconds -> CSUSeconds -> CSUSeconds # negate :: CSUSeconds -> CSUSeconds # abs :: CSUSeconds -> CSUSeconds # signum :: CSUSeconds -> CSUSeconds # fromInteger :: Integer -> CSUSeconds # | |
| Num CShort | |
| Num CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types Methods (+) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (-) :: CSigAtomic -> CSigAtomic -> CSigAtomic # (*) :: CSigAtomic -> CSigAtomic -> CSigAtomic # negate :: CSigAtomic -> CSigAtomic # abs :: CSigAtomic -> CSigAtomic # signum :: CSigAtomic -> CSigAtomic # fromInteger :: Integer -> CSigAtomic # | |
| Num CSize | |
| Num CTime | |
| Num CUChar | |
| Num CUInt | |
| Num CUIntMax | |
| Num CUIntPtr | |
| Num CULLong | |
| Num CULong | |
| Num CUSeconds | |
Defined in GHC.Internal.Foreign.C.Types | |
| Num CUShort | |
| Num CWchar | |
| Num Int16 | @since base-2.01 |
| Num Int32 | @since base-2.01 |
| Num Int64 | @since base-2.01 |
| Num Int8 | @since base-2.01 |
| Num Word16 | @since base-2.01 |
| Num Word32 | @since base-2.01 |
| Num Word64 | @since base-2.01 |
| Num Word8 | @since base-2.01 |
| Num I8 | |
| Num Size | |
| Num Size | |
| Num Integer | @since base-2.01 |
| Num Natural | Note that @since base-4.8.0.0 |
| Num Int | @since base-2.01 |
| Num Word | @since base-2.01 |
| RealFloat a => Num (Complex a) | Since: base-2.1 |
| Num a => Num (Max a) | Since: base-4.9.0.0 |
| Num a => Num (Min a) | Since: base-4.9.0.0 |
| Num a => Num (Down a) | @since base-4.11.0.0 |
| Integral a => Num (Ratio a) | @since base-2.0.1 |
| HasResolution a => Num (Fixed a) | Multiplication is not associative or distributive:
Since: base-2.1 |
| Num a => Num (Op a b) | |
| Num (f (g a)) => Num (Compose f g a) | Since: base-4.19.0.0 |
Defined in Data.Functor.Compose Methods (+) :: Compose f g a -> Compose f g a -> Compose f g a # (-) :: Compose f g a -> Compose f g a -> Compose f g a # (*) :: Compose f g a -> Compose f g a -> Compose f g a # negate :: Compose f g a -> Compose f g a # abs :: Compose f g a -> Compose f g a # signum :: Compose f g a -> Compose f g a # fromInteger :: Integer -> Compose f g a # | |
class (Num a, Ord a) => Real a where #
Real numbers.
The Haskell report defines no laws for Real, however Real instances
are customarily expected to adhere to the following law:
- Coherence with
fromRational - if the type also implements
Fractional, thenfromRationalis a left inverse fortoRational, i.e.fromRational (toRational i) = i
The law does not hold for Float, Double, CFloat,
CDouble, etc., because these types contain non-finite values,
which cannot be roundtripped through Rational.
Instances
class (Real a, Enum a) => Integral a where #
Integral numbers, supporting integer division.
The Haskell Report defines no laws for Integral. However, Integral
instances are customarily expected to define a Euclidean domain and have the
following properties for the div/mod and quot/rem pairs, given
suitable Euclidean functions f and g:
x=y * quot x y + rem x ywithrem x y=fromInteger 0org (rem x y)<g yx=y * div x y + mod x ywithmod x y=fromInteger 0orf (mod x y)<f y
An example of a suitable Euclidean function, for Integer's instance, is
abs.
In addition, toInteger should be total, and fromInteger should be a left
inverse for it, i.e. fromInteger (toInteger i) = i.
Methods
quot :: a -> a -> a infixl 7 #
Integer division truncated toward zero.
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
Integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == x
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
Integer division truncated toward negative infinity.
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
Integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
WARNING: This function is partial (because it throws when 0 is passed as
the divisor) for all the integer types in base.
Conversion to Integer.
Instances
class Num a => Fractional a where #
Fractional numbers, supporting real division.
The Haskell Report defines no laws for Fractional. However, ( and
+)( are customarily expected to define a division ring and have the
following properties:*)
recipgives the multiplicative inversex * recip x=recip x * x=fromInteger 1- Totality of
toRational toRationalis total- Coherence with
toRational - if the type also implements
Real, thenfromRationalis a left inverse fortoRational, i.e.fromRational (toRational i) = i
Note that it isn't customarily expected that a type instance of
Fractional implement a field. However, all instances in base do.
Minimal complete definition
fromRational, (recip | (/))
Methods
Fractional division.
Reciprocal fraction.
fromRational :: Rational -> a #
Conversion from a Rational (that is ).
A floating literal stands for an application of Ratio IntegerfromRational
to a value of type Rational, so such literals have type
(.Fractional a) => a
Instances
| Fractional CDouble | |
| Fractional CFloat | |
| RealFloat a => Fractional (Complex a) | Since: base-2.1 |
| Fractional a => Fractional (Down a) | @since base-4.14.0.0 |
| Integral a => Fractional (Ratio a) | @since base-2.0.1 |
| HasResolution a => Fractional (Fixed a) | Since: base-2.1 |
| Fractional a => Fractional (Op a b) | |
| Fractional (f (g a)) => Fractional (Compose f g a) | Since: base-4.20.0.0 |
class Fractional a => Floating a where #
Trigonometric and hyperbolic functions and related functions.
The Haskell Report defines no laws for Floating. However, (, +)(
and *)exp are customarily expected to define an exponential field and have
the following properties:
exp (a + b)=exp a * exp bexp (fromInteger 0)=fromInteger 1
Minimal complete definition
pi, exp, log, sin, cos, asin, acos, atan, sinh, cosh, asinh, acosh, atanh
Instances
class (Real a, Fractional a) => RealFrac a where #
Extracting components of fractions.
Minimal complete definition
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:
nis an integral number with the same sign asx; andfis a fraction with the same type and sign asx, and with absolute value less than1.
The default definitions of the ceiling, floor, truncate
and round functions are in terms of properFraction.
truncate :: Integral b => a -> b #
returns the integer nearest truncate xx between zero and x
round :: Integral b => a -> b #
returns the nearest integer to round xx;
the even integer if x is equidistant between two integers
ceiling :: Integral b => a -> b #
returns the least integer not less than ceiling xx
floor :: Integral b => a -> b #
returns the greatest integer not greater than floor xx
class (RealFrac a, Floating a) => RealFloat a where #
Efficient, machine-independent access to the components of a floating-point number.
Minimal complete definition
floatRadix, floatDigits, floatRange, decodeFloat, encodeFloat, isNaN, isInfinite, isDenormalized, isNegativeZero, isIEEE
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
yields decodeFloat x(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) <= , where abs m < b^dd is
the value of .
In particular, floatDigits x. If the type
contains a negative zero, also decodeFloat 0 = (0,0).
The result of decodeFloat (-0.0) = (0,0) is unspecified if either of
decodeFloat x or isNaN x is isInfinite xTrue.
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 is one of the two closest representable
floating-point numbers to encodeFloat m nm*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 corresponds to the second component of decodeFloat.
and for finite nonzero exponent 0 = 0x,
.
If exponent x = snd (decodeFloat x) + floatDigits xx is a finite floating-point number, it is equal in value to
, where significand x * b ^^ exponent xb 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
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
True if the argument is an IEEE floating point number
a version of arctangent taking two real floating-point arguments.
For real floating x and y, computes the angle
(from the positive x-axis) of the vector from the origin to the
point atan2 y x(x,y). returns a value in the range [atan2 y x-pi,
pi]. It follows the Common Lisp semantics for the origin when
signed zeroes are supported. , with atan2 y 1y in a type
that is RealFloat, should return the same value as .
A default definition of atan yatan2 is provided, but implementors
can provide a more accurate implementation.
Instances
Data types
The Maybe type encapsulates an optional value. A value of type
either contains a value of type Maybe aa (represented as ),
or it is empty (represented as Just aNothing). 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.
Instances
| MonadZip Maybe | Since: base-4.8.0.0 | ||||
| Eq1 Maybe | Since: base-4.9.0.0 | ||||
| Ord1 Maybe | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read1 Maybe | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Show1 Maybe | Since: base-4.9.0.0 | ||||
| Alternative Maybe | Picks the leftmost @since base-2.01 | ||||
| Applicative Maybe | @since base-2.01 | ||||
| Functor Maybe | @since base-2.01 | ||||
| Monad Maybe | @since base-2.01 | ||||
| MonadPlus Maybe | Picks the leftmost @since base-2.01 | ||||
| MonadFail Maybe | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Control.Monad.Fail | |||||
| Foldable Maybe | @since base-2.01 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Maybe m -> m # foldMap :: Monoid m => (a -> m) -> Maybe a -> 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 # elem :: Eq a => a -> Maybe a -> Bool # maximum :: Ord a => Maybe a -> a # minimum :: Ord a => Maybe a -> a # | |||||
| Traversable Maybe | @since base-2.01 | ||||
| Hashable1 Maybe | |||||
Defined in Data.Hashable.Class | |||||
| Generic1 Maybe | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner @since base-2.01 | ||||
| Semigroup a => Semigroup (Maybe a) | @since base-4.9.0.0 | ||||
| Generic (Maybe a) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| SingKind a => SingKind (Maybe a) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Read a => Read (Maybe a) | @since base-2.01 | ||||
| Show a => Show (Maybe a) | @since base-2.01 | ||||
| Eq a => Eq (Maybe a) | @since base-2.01 | ||||
| Ord a => Ord (Maybe a) | @since base-2.01 | ||||
| Hashable a => Hashable (Maybe a) | |||||
Defined in Data.Hashable.Class | |||||
| SingI ('Nothing :: Maybe a) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| SingI a2 => SingI ('Just a2 :: Maybe a1) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep1 Maybe | @since base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type DemoteRep (Maybe a) | |||||
Defined in GHC.Internal.Generics | |||||
| type Rep (Maybe a) | @since base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| data Sing (b :: Maybe a) | |||||
Instances
| Monoid Ordering | @since base-2.01 |
| Semigroup Ordering | @since base-4.9.0.0 |
| Bounded Ordering | @since base-2.01 |
| Enum Ordering | @since base-2.01 |
Defined in GHC.Internal.Enum | |
| Generic Ordering | |
Defined in GHC.Internal.Generics | |
| Read Ordering | @since base-2.01 |
| Show Ordering | @since base-2.01 |
| Eq Ordering | |
| Ord Ordering | |
Defined in GHC.Classes | |
| Hashable Ordering | |
Defined in Data.Hashable.Class | |
| type Rep Ordering | @since base-4.6.0.0 |
Instances
| Bounded Bool | @since base-2.01 | ||||
| Enum Bool | @since base-2.01 | ||||
| Storable Bool | @since base-2.01 | ||||
Defined in GHC.Internal.Foreign.Storable | |||||
| Generic Bool | |||||
Defined in GHC.Internal.Generics | |||||
| SingKind Bool | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Read Bool | @since base-2.01 | ||||
| Show Bool | @since base-2.01 | ||||
| Eq Bool | |||||
| Ord Bool | |||||
| Hashable Bool | |||||
Defined in Data.Hashable.Class | |||||
| Unbox Bool | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| SingI 'False | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| SingI 'True | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| Vector Vector Bool | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Bool -> ST s (Vector Bool) basicUnsafeThaw :: Vector Bool -> ST s (Mutable Vector s Bool) basicLength :: Vector Bool -> Int basicUnsafeSlice :: Int -> Int -> Vector Bool -> Vector Bool basicUnsafeIndexM :: Vector Bool -> Int -> Box Bool basicUnsafeCopy :: Mutable Vector s Bool -> Vector Bool -> ST s () | |||||
| MVector MVector Bool | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Bool -> Int basicUnsafeSlice :: Int -> Int -> MVector s Bool -> MVector s Bool basicOverlaps :: MVector s Bool -> MVector s Bool -> Bool basicUnsafeNew :: Int -> ST s (MVector s Bool) basicInitialize :: MVector s Bool -> ST s () basicUnsafeReplicate :: Int -> Bool -> ST s (MVector s Bool) basicUnsafeRead :: MVector s Bool -> Int -> ST s Bool basicUnsafeWrite :: MVector s Bool -> Int -> Bool -> ST s () basicClear :: MVector s Bool -> ST s () basicSet :: MVector s Bool -> Bool -> ST s () basicUnsafeCopy :: MVector s Bool -> MVector s Bool -> ST s () basicUnsafeMove :: MVector s Bool -> MVector s Bool -> ST s () basicUnsafeGrow :: MVector s Bool -> Int -> ST s (MVector s Bool) | |||||
| type DemoteRep Bool | |||||
Defined in GHC.Internal.Generics | |||||
| type Rep Bool | @since base-4.6.0.0 | ||||
| data Sing (a :: Bool) | |||||
| newtype Vector Bool | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| newtype MVector s Bool | |||||
Defined in Data.Vector.Unboxed.Base | |||||
The character type Char represents Unicode codespace
and its elements are code points as in definitions
D9 and D10 of the Unicode Standard.
Character literals in Haskell are single-quoted: 'Q', 'Я' or 'Ω'.
To represent a single quote itself use '\'', and to represent a backslash
use '\\'. The full grammar can be found in the section 2.6 of the
Haskell 2010 Language Report.
To specify a character by its code point one can use decimal, hexadecimal
or octal notation: '\65', '\x41' and '\o101' are all alternative forms
of 'A'. The largest code point is '\x10ffff'.
There is a special escape syntax for ASCII control characters:
| Escape | Alternatives | Meaning |
|---|---|---|
'\NUL' | '\0' | null character |
'\SOH' | '\1' | start of heading |
'\STX' | '\2' | start of text |
'\ETX' | '\3' | end of text |
'\EOT' | '\4' | end of transmission |
'\ENQ' | '\5' | enquiry |
'\ACK' | '\6' | acknowledge |
'\BEL' | '\7', '\a' | bell (alert) |
'\BS' | '\8', '\b' | backspace |
'\HT' | '\9', '\t' | horizontal tab |
'\LF' | '\10', '\n' | line feed (new line) |
'\VT' | '\11', '\v' | vertical tab |
'\FF' | '\12', '\f' | form feed |
'\CR' | '\13', '\r' | carriage return |
'\SO' | '\14' | shift out |
'\SI' | '\15' | shift in |
'\DLE' | '\16' | data link escape |
'\DC1' | '\17' | device control 1 |
'\DC2' | '\18' | device control 2 |
'\DC3' | '\19' | device control 3 |
'\DC4' | '\20' | device control 4 |
'\NAK' | '\21' | negative acknowledge |
'\SYN' | '\22' | synchronous idle |
'\ETB' | '\23' | end of transmission block |
'\CAN' | '\24' | cancel |
'\EM' | '\25' | end of medium |
'\SUB' | '\26' | substitute |
'\ESC' | '\27' | escape |
'\FS' | '\28' | file separator |
'\GS' | '\29' | group separator |
'\RS' | '\30' | record separator |
'\US' | '\31' | unit separator |
'\SP' | '\32', ' ' | space |
'\DEL' | '\127' | delete |
Instances
| IsChar Char | Since: base-2.1 | ||||
| PrintfArg Char | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Bounded Char | @since base-2.01 | ||||
| Enum Char | @since base-2.01 | ||||
| Storable Char | @since base-2.01 | ||||
Defined in GHC.Internal.Foreign.Storable | |||||
| Read Char | @since base-2.01 | ||||
| Show Char | @since base-2.01 | ||||
| Eq Char | |||||
| Ord Char | |||||
| Hashable Char | |||||
Defined in Data.Hashable.Class | |||||
| Unbox Char | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| Vector Vector Char | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Char -> ST s (Vector Char) basicUnsafeThaw :: Vector Char -> ST s (Mutable Vector s Char) basicLength :: Vector Char -> Int basicUnsafeSlice :: Int -> Int -> Vector Char -> Vector Char basicUnsafeIndexM :: Vector Char -> Int -> Box Char basicUnsafeCopy :: Mutable Vector s Char -> Vector Char -> ST s () | |||||
| MVector MVector Char | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Char -> Int basicUnsafeSlice :: Int -> Int -> MVector s Char -> MVector s Char basicOverlaps :: MVector s Char -> MVector s Char -> Bool basicUnsafeNew :: Int -> ST s (MVector s Char) basicInitialize :: MVector s Char -> ST s () basicUnsafeReplicate :: Int -> Char -> ST s (MVector s Char) basicUnsafeRead :: MVector s Char -> Int -> ST s Char basicUnsafeWrite :: MVector s Char -> Int -> Char -> ST s () basicClear :: MVector s Char -> ST s () basicSet :: MVector s Char -> Char -> ST s () basicUnsafeCopy :: MVector s Char -> MVector s Char -> ST s () basicUnsafeMove :: MVector s Char -> MVector s Char -> ST s () basicUnsafeGrow :: MVector s Char -> Int -> ST s (MVector s Char) | |||||
| Generic1 (URec Char :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UChar :: Type -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |||||
| Traversable (UChar :: Type -> Type) | @since base-4.9.0.0 | ||||
| Functor (URec Char :: Type -> Type) | @since base-4.9.0.0 | ||||
| Generic (URec Char p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Show (URec Char p) | @since base-4.9.0.0 | ||||
| Eq (URec Char p) | @since base-4.9.0.0 | ||||
| Ord (URec Char p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| newtype Vector Char | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| data URec Char (p :: k) | Used for marking occurrences of @since base-4.9.0.0 | ||||
| newtype MVector s Char | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep1 (URec Char :: k -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep (URec Char p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
A value of type is a computation which, when performed,
does some I/O before returning a value of type IO aa.
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
| MonadIO IO | Since: base-4.9.0.0 |
Defined in Control.Monad.IO.Class | |
| Alternative IO | Takes the first non-throwing @since base-4.9.0.0 |
| Applicative IO | @since base-2.01 |
| Functor IO | @since base-2.01 |
| Monad IO | @since base-2.01 |
| MonadPlus IO | Takes the first non-throwing @since base-4.9.0.0 |
| MonadFail IO | @since base-4.9.0.0 |
Defined in GHC.Internal.Control.Monad.Fail | |
| PrimBase IO | |
| PrimMonad IO | |
| a ~ () => HPrintfType (IO a) | Since: base-4.7.0.0 |
Defined in Text.Printf | |
| a ~ () => PrintfType (IO a) | Since: base-4.7.0.0 |
Defined in Text.Printf | |
| Monoid a => Monoid (IO a) | @since base-4.9.0.0 |
| Semigroup a => Semigroup (IO a) | @since base-4.10.0.0 |
| type PrimState IO | |
Defined in Control.Monad.Primitive | |
The Either type represents values with two possibilities: a value of
type is either Either a b or Left a.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 is the type of values which can be either
a Either String IntString 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>>>sLeft "foo">>>let n = Right 3 :: Either String Int>>>nRight 3>>>:type ss :: Either String Int>>>:type nn :: 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) sLeft "foo">>>fmap (*2) nRight 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)>>>:}
>>>parseMultipleRight 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)>>>:}
>>>parseMultipleLeft "parse error"
Instances
| Bifoldable Either | Since: base-4.10.0.0 | ||||
| Bifoldable1 Either | |||||
Defined in Data.Bifoldable1 | |||||
| Bifunctor Either | Since: base-4.8.0.0 | ||||
| Bitraversable Either | Since: base-4.10.0.0 | ||||
Defined in Data.Bitraversable Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) # | |||||
| Eq2 Either | Since: base-4.9.0.0 | ||||
| Ord2 Either | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read2 Either | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes 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] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Either a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Either a b] # | |||||
| Show2 Either | Since: base-4.9.0.0 | ||||
| Hashable2 Either | |||||
Defined in Data.Hashable.Class | |||||
| Generic1 (Either a :: Type -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Eq a => Eq1 (Either a) | Since: base-4.9.0.0 | ||||
| Ord a => Ord1 (Either a) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read a => Read1 (Either a) | Since: base-4.9.0.0 | ||||
Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Either a a0) # liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Either a a0] # liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Either a a0) # liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Either a a0] # | |||||
| Show a => Show1 (Either a) | Since: base-4.9.0.0 | ||||
| Applicative (Either e) | @since base-3.0 | ||||
| Functor (Either a) | @since base-3.0 | ||||
| Monad (Either e) | @since base-4.4.0.0 | ||||
| Foldable (Either a) | @since base-4.7.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Either a m -> m # foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # toList :: Either a a0 -> [a0] # length :: Either a a0 -> Int # elem :: Eq a0 => a0 -> Either a a0 -> Bool # maximum :: Ord a0 => Either a a0 -> a0 # minimum :: Ord a0 => Either a a0 -> a0 # | |||||
| Traversable (Either a) | @since base-4.7.0.0 | ||||
Defined in GHC.Internal.Data.Traversable | |||||
| Hashable a => Hashable1 (Either a) | |||||
Defined in Data.Hashable.Class | |||||
| Semigroup (Either a b) | @since base-4.9.0.0 | ||||
| Generic (Either a b) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| (Read a, Read b) => Read (Either a b) | @since base-3.0 | ||||
| (Show a, Show b) => Show (Either a b) | @since base-3.0 | ||||
| (Eq a, Eq b) => Eq (Either a b) | @since base-2.01 | ||||
| (Ord a, Ord b) => Ord (Either a b) | @since base-2.01 | ||||
Defined in GHC.Internal.Data.Either | |||||
| (Hashable a, Hashable b) => Hashable (Either a b) | |||||
Defined in Data.Hashable.Class | |||||
| type Rep1 (Either a :: Type -> Type) | @since base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics type Rep1 (Either a :: Type -> Type) = D1 ('MetaData "Either" "GHC.Internal.Data.Either" "ghc-internal" 'False) (C1 ('MetaCons "Left" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Right" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1)) | |||||
| type Rep (Either a b) | @since base-4.6.0.0 | ||||
Defined in GHC.Internal.Generics type Rep (Either a b) = D1 ('MetaData "Either" "GHC.Internal.Data.Either" "ghc-internal" 'False) (C1 ('MetaCons "Left" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Right" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 b))) | |||||
Re-exports
Packed reps
data ByteString #
A space-efficient representation of a Word8 vector, supporting many
efficient operations.
A ByteString contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
Instances
type LByteString = ByteString #
A space efficient, packed, unboxed Unicode text type.
Containers
A Map from keys k to values a.
The Semigroup operation for Map is union, which prefers
values from the left operand. If m1 maps a key k to a value
a1, and m2 maps the same key to a different value a2, then
their union m1 <> m2 maps k to a1.
Instances
| Bifoldable Map | Since: containers-0.6.3.1 |
| Eq2 Map | Since: containers-0.5.9 |
| Ord2 Map | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
| Show2 Map | Since: containers-0.5.9 |
| Hashable2 Map | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| (Lift k, Lift a) => Lift (Map k a :: Type) | Since: containers-0.6.6 |
| Eq k => Eq1 (Map k) | Since: containers-0.5.9 |
| Ord k => Ord1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
| (Ord k, Read k) => Read1 (Map k) | Since: containers-0.5.9 |
Defined in Data.Map.Internal | |
| Show k => Show1 (Map k) | Since: containers-0.5.9 |
| Functor (Map k) | |
| Foldable (Map k) | Folds in order of increasing key. |
Defined in Data.Map.Internal Methods fold :: Monoid m => Map k m -> m # foldMap :: Monoid m => (a -> m) -> Map k a -> m # foldMap' :: Monoid m => (a -> m) -> Map k a -> m # foldr :: (a -> b -> b) -> b -> Map k a -> b # foldr' :: (a -> b -> b) -> b -> Map k a -> b # foldl :: (b -> a -> b) -> b -> Map k a -> b # foldl' :: (b -> a -> b) -> b -> Map k a -> b # foldr1 :: (a -> a -> a) -> Map k a -> a # foldl1 :: (a -> a -> a) -> Map k a -> a # elem :: Eq a => a -> Map k a -> Bool # maximum :: Ord a => Map k a -> a # minimum :: Ord a => Map k a -> a # | |
| Traversable (Map k) | Traverses in order of increasing key. |
| Hashable k => Hashable1 (Map k) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| (NFData k, NFData a) => NFData (Map k a) | |
Defined in Data.Map.Internal | |
| Ord k => Monoid (Map k v) | |
| Ord k => Semigroup (Map k v) | |
| (Data k, Data a, Ord k) => Data (Map k a) | |
Defined in Data.Map.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Map k a -> c (Map k a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Map k a) # toConstr :: Map k a -> Constr # dataTypeOf :: Map k a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Map k a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k a)) # gmapT :: (forall b. Data b => b -> b) -> Map k a -> Map k a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Map k a -> r # gmapQ :: (forall d. Data d => d -> u) -> Map k a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Map k a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Map k a -> m (Map k a) # | |
| Ord k => IsList (Map k v) | Since: containers-0.5.6.2 |
| (Ord k, Read k, Read e) => Read (Map k e) | |
| (Show k, Show a) => Show (Map k a) | |
| (Eq k, Eq a) => Eq (Map k a) | |
| (Ord k, Ord v) => Ord (Map k v) | |
| (Hashable k, Hashable v) => Hashable (Map k v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| type Item (Map k v) | |
Defined in Data.Map.Internal | |
A map from keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
Instances
| Bifoldable HashMap | Since: unordered-containers-0.2.11 | ||||
| Eq2 HashMap | |||||
| Ord2 HashMap | |||||
Defined in Data.HashMap.Internal | |||||
| Show2 HashMap | |||||
| NFData2 HashMap | Since: unordered-containers-0.2.14.0 | ||||
Defined in Data.HashMap.Internal | |||||
| Hashable2 HashMap | |||||
Defined in Data.HashMap.Internal | |||||
| (Lift k, Lift v) => Lift (HashMap k v :: Type) | Since: unordered-containers-0.2.17.0 | ||||
| Eq k => Eq1 (HashMap k) | |||||
| Ord k => Ord1 (HashMap k) | |||||
Defined in Data.HashMap.Internal | |||||
| (Eq k, Hashable k, Read k) => Read1 (HashMap k) | |||||
Defined in Data.HashMap.Internal | |||||
| Show k => Show1 (HashMap k) | |||||
| NFData k => NFData1 (HashMap k) | Since: unordered-containers-0.2.14.0 | ||||
Defined in Data.HashMap.Internal | |||||
| Functor (HashMap k) | |||||
| Foldable (HashMap k) | |||||
Defined in Data.HashMap.Internal Methods fold :: Monoid m => HashMap k m -> m # foldMap :: Monoid m => (a -> m) -> HashMap k a -> m # foldMap' :: Monoid m => (a -> m) -> HashMap k a -> m # foldr :: (a -> b -> b) -> b -> HashMap k a -> b # foldr' :: (a -> b -> b) -> b -> HashMap k a -> b # foldl :: (b -> a -> b) -> b -> HashMap k a -> b # foldl' :: (b -> a -> b) -> b -> HashMap k a -> b # foldr1 :: (a -> a -> a) -> HashMap k a -> a # foldl1 :: (a -> a -> a) -> HashMap k a -> a # toList :: HashMap k a -> [a] # length :: HashMap k a -> Int # elem :: Eq a => a -> HashMap k a -> Bool # maximum :: Ord a => HashMap k a -> a # minimum :: Ord a => HashMap k a -> a # | |||||
| Traversable (HashMap k) | |||||
Defined in Data.HashMap.Internal | |||||
| Hashable k => Hashable1 (HashMap k) | |||||
Defined in Data.HashMap.Internal | |||||
| (NFData k, NFData v) => NFData (HashMap k v) | |||||
Defined in Data.HashMap.Internal | |||||
| (Eq k, Hashable k) => Monoid (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
| ||||
| (Eq k, Hashable k) => Semigroup (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
| ||||
| (Data k, Data v, Eq k, Hashable k) => Data (HashMap k v) | |||||
Defined in Data.HashMap.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashMap k v -> c (HashMap k v) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashMap k v) # toConstr :: HashMap k v -> Constr # dataTypeOf :: HashMap k v -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashMap k v)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashMap k v)) # gmapT :: (forall b. Data b => b -> b) -> HashMap k v -> HashMap k v # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashMap k v -> r # gmapQ :: (forall d. Data d => d -> u) -> HashMap k v -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HashMap k v -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashMap k v -> m (HashMap k v) # | |||||
| (Eq k, Hashable k) => IsList (HashMap k v) | |||||
Defined in Data.HashMap.Internal Associated Types
| |||||
| (Eq k, Hashable k, Read k, Read e) => Read (HashMap k e) | |||||
| (Show k, Show v) => Show (HashMap k v) | |||||
| (Eq k, Eq v) => Eq (HashMap k v) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. | ||||
| (Ord k, Ord v) => Ord (HashMap k v) | The ordering is total and consistent with the | ||||
Defined in Data.HashMap.Internal | |||||
| (Hashable k, Hashable v) => Hashable (HashMap k v) | |||||
Defined in Data.HashMap.Internal | |||||
| type Item (HashMap k v) | |||||
Defined in Data.HashMap.Internal | |||||
A map of integers to values a.
Instances
| Eq1 IntMap | Since: containers-0.5.9 |
| Ord1 IntMap | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal | |
| Read1 IntMap | Since: containers-0.5.9 |
Defined in Data.IntMap.Internal | |
| Show1 IntMap | Since: containers-0.5.9 |
| Functor IntMap | |
| Foldable IntMap | Folds in order of increasing key. |
Defined in Data.IntMap.Internal Methods fold :: Monoid m => IntMap m -> m # foldMap :: Monoid m => (a -> m) -> IntMap a -> m # foldMap' :: Monoid m => (a -> m) -> IntMap a -> m # foldr :: (a -> b -> b) -> b -> IntMap a -> b # foldr' :: (a -> b -> b) -> b -> IntMap a -> b # foldl :: (b -> a -> b) -> b -> IntMap a -> b # foldl' :: (b -> a -> b) -> b -> IntMap a -> b # foldr1 :: (a -> a -> a) -> IntMap a -> a # foldl1 :: (a -> a -> a) -> IntMap a -> a # elem :: Eq a => a -> IntMap a -> Bool # maximum :: Ord a => IntMap a -> a # minimum :: Ord a => IntMap a -> a # | |
| Traversable IntMap | Traverses in order of increasing key. |
| Hashable1 IntMap | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift a => Lift (IntMap a :: Type) | Since: containers-0.6.6 |
| NFData a => NFData (IntMap a) | |
Defined in Data.IntMap.Internal | |
| Monoid (IntMap a) | |
| Semigroup (IntMap a) | Since: containers-0.5.7 |
| Data a => Data (IntMap a) | |
Defined in Data.IntMap.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IntMap a -> c (IntMap a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (IntMap a) # toConstr :: IntMap a -> Constr # dataTypeOf :: IntMap a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (IntMap a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IntMap a)) # gmapT :: (forall b. Data b => b -> b) -> IntMap a -> IntMap a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntMap a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntMap a -> r # gmapQ :: (forall d. Data d => d -> u) -> IntMap a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> IntMap a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IntMap a -> m (IntMap a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IntMap a -> m (IntMap a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IntMap a -> m (IntMap a) # | |
| IsList (IntMap a) | Since: containers-0.5.6.2 |
| Read e => Read (IntMap e) | |
| Show a => Show (IntMap a) | |
| Eq a => Eq (IntMap a) | |
| Ord a => Ord (IntMap a) | |
Defined in Data.IntMap.Internal | |
| Hashable v => Hashable (IntMap v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| type Item (IntMap a) | |
Defined in Data.IntMap.Internal | |
A set of values a.
Instances
| Eq1 Set | Since: containers-0.5.9 |
| Ord1 Set | Since: containers-0.5.9 |
Defined in Data.Set.Internal | |
| Show1 Set | Since: containers-0.5.9 |
| Foldable Set | Folds in order of increasing key. |
Defined in Data.Set.Internal Methods fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldMap' :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # | |
| Hashable1 Set | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift a => Lift (Set a :: Type) | Since: containers-0.6.6 |
| NFData a => NFData (Set a) | |
Defined in Data.Set.Internal | |
| Ord a => Monoid (Set a) | |
| Ord a => Semigroup (Set a) | Since: containers-0.5.7 |
| (Data a, Ord a) => Data (Set a) | |
Defined in Data.Set.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Set a -> c (Set a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Set a) # dataTypeOf :: Set a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Set a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set a)) # gmapT :: (forall b. Data b => b -> b) -> Set a -> Set a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQ :: (forall d. Data d => d -> u) -> Set a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Set a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # | |
| Ord a => IsList (Set a) | Since: containers-0.5.6.2 |
| (Read a, Ord a) => Read (Set a) | |
| Show a => Show (Set a) | |
| Eq a => Eq (Set a) | |
| Ord a => Ord (Set a) | |
| Hashable v => Hashable (Set v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| type Item (Set a) | |
Defined in Data.Set.Internal | |
A set of values. A set cannot contain duplicate values.
Instances
| Eq1 HashSet | |
| Ord1 HashSet | |
Defined in Data.HashSet.Internal | |
| Show1 HashSet | |
| NFData1 HashSet | Since: unordered-containers-0.2.14.0 |
Defined in Data.HashSet.Internal | |
| Foldable HashSet | |
Defined in Data.HashSet.Internal Methods fold :: Monoid m => HashSet m -> m # foldMap :: Monoid m => (a -> m) -> HashSet a -> m # foldMap' :: Monoid m => (a -> m) -> HashSet a -> m # foldr :: (a -> b -> b) -> b -> HashSet a -> b # foldr' :: (a -> b -> b) -> b -> HashSet a -> b # foldl :: (b -> a -> b) -> b -> HashSet a -> b # foldl' :: (b -> a -> b) -> b -> HashSet a -> b # foldr1 :: (a -> a -> a) -> HashSet a -> a # foldl1 :: (a -> a -> a) -> HashSet a -> a # elem :: Eq a => a -> HashSet a -> Bool # maximum :: Ord a => HashSet a -> a # minimum :: Ord a => HashSet a -> a # | |
| Hashable1 HashSet | |
Defined in Data.HashSet.Internal | |
| Lift a => Lift (HashSet a :: Type) | Since: unordered-containers-0.2.17.0 |
| NFData a => NFData (HashSet a) | |
Defined in Data.HashSet.Internal | |
| (Hashable a, Eq a) => Monoid (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
| (Hashable a, Eq a) => Semigroup (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
| (Data a, Eq a, Hashable a) => Data (HashSet a) | |
Defined in Data.HashSet.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashSet a -> c (HashSet a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashSet a) # toConstr :: HashSet a -> Constr # dataTypeOf :: HashSet a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashSet a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashSet a)) # gmapT :: (forall b. Data b => b -> b) -> HashSet a -> HashSet a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r # gmapQ :: (forall d. Data d => d -> u) -> HashSet a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HashSet a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) # | |
| (Eq a, Hashable a) => IsList (HashSet a) | |
| (Eq a, Hashable a, Read a) => Read (HashSet a) | |
| Show a => Show (HashSet a) | |
| Eq a => Eq (HashSet a) | Note that, in the presence of hash collisions, equal
In general, the lack of extensionality can be observed with any function that depends on the key ordering, such as folds and traversals. |
| Ord a => Ord (HashSet a) | |
| Hashable a => Hashable (HashSet a) | |
Defined in Data.HashSet.Internal | |
| type Item (HashSet a) | |
Defined in Data.HashSet.Internal | |
A set of integers.
Instances
| NFData IntSet | |
Defined in Data.IntSet.Internal | |
| Monoid IntSet | |
| Semigroup IntSet | Since: containers-0.5.7 |
| Data IntSet | |
Defined in Data.IntSet.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IntSet -> c IntSet # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IntSet # toConstr :: IntSet -> Constr # dataTypeOf :: IntSet -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IntSet) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntSet) # gmapT :: (forall b. Data b => b -> b) -> IntSet -> IntSet # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r # gmapQ :: (forall d. Data d => d -> u) -> IntSet -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> IntSet -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IntSet -> m IntSet # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IntSet -> m IntSet # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IntSet -> m IntSet # | |
| IsList IntSet | Since: containers-0.5.6.2 |
| Read IntSet | |
| Show IntSet | |
| Eq IntSet | |
| Ord IntSet | |
| Hashable IntSet | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift IntSet | Since: containers-0.6.6 |
| type Item IntSet | |
Defined in Data.IntSet.Internal | |
General-purpose finite sequences.
Instances
| MonadZip Seq |
Since: containers-0.5.10.1 |
| Eq1 Seq | Since: containers-0.5.9 |
| Ord1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
| Read1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
| Show1 Seq | Since: containers-0.5.9 |
| UnzipWith Seq | |
Defined in Data.Sequence.Internal Methods unzipWith' :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b) | |
| Alternative Seq | Since: containers-0.5.4 |
| Applicative Seq | Since: containers-0.5.4 |
| Functor Seq | |
| Monad Seq | |
| MonadPlus Seq | |
| MonadFix Seq | Since: containers-0.5.11 |
Defined in Data.Sequence.Internal | |
| Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldMap' :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
| Traversable Seq | |
| Hashable1 Seq | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Lift a => Lift (Seq a :: Type) | Since: containers-0.6.6 |
| NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
| Monoid (Seq a) | |
| Semigroup (Seq a) | Since: containers-0.5.7 |
| Data a => Data (Seq a) | |
Defined in Data.Sequence.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Seq a -> c (Seq a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Seq a) # dataTypeOf :: Seq a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Seq a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Seq a)) # gmapT :: (forall b. Data b => b -> b) -> Seq a -> Seq a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQ :: (forall d. Data d => d -> u) -> Seq a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Seq a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # | |
| a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
| IsList (Seq a) | |
| Read a => Read (Seq a) | |
| Show a => Show (Seq a) | |
| Eq a => Eq (Seq a) | |
| Ord a => Ord (Seq a) | |
| Hashable v => Hashable (Seq v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| type Item (Seq a) | |
Defined in Data.Sequence.Internal | |
Instances
| MonadZip Vector | |
| Eq1 Vector | |
| Ord1 Vector | |
Defined in Data.Vector | |
| Read1 Vector | |
Defined in Data.Vector | |
| Show1 Vector | |
| NFData1 Vector | |
Defined in Data.Vector | |
| Alternative Vector | |
| Applicative Vector | |
| Functor Vector | |
| Monad Vector | |
| MonadPlus Vector | |
| MonadFail Vector | |
Defined in Data.Vector | |
| MonadFix Vector | |
Defined in Data.Vector | |
| Foldable Vector | |
Defined in Data.Vector Methods fold :: Monoid m => Vector m -> m # foldMap :: Monoid m => (a -> m) -> Vector a -> m # foldMap' :: Monoid m => (a -> m) -> Vector a -> m # foldr :: (a -> b -> b) -> b -> Vector a -> b # foldr' :: (a -> b -> b) -> b -> Vector a -> b # foldl :: (b -> a -> b) -> b -> Vector a -> b # foldl' :: (b -> a -> b) -> b -> Vector a -> b # foldr1 :: (a -> a -> a) -> Vector a -> a # foldl1 :: (a -> a -> a) -> Vector a -> a # elem :: Eq a => a -> Vector a -> Bool # maximum :: Ord a => Vector a -> a # minimum :: Ord a => Vector a -> a # | |
| Traversable Vector | |
| Vector Vector a | |
Defined in Data.Vector Methods basicUnsafeFreeze :: Mutable Vector s a -> ST s (Vector a) basicUnsafeThaw :: Vector a -> ST s (Mutable Vector s a) basicLength :: Vector a -> Int basicUnsafeSlice :: Int -> Int -> Vector a -> Vector a basicUnsafeIndexM :: Vector a -> Int -> Box a basicUnsafeCopy :: Mutable Vector s a -> Vector a -> ST s () | |
| NFData a => NFData (Vector a) | |
Defined in Data.Vector | |
| Monoid (Vector a) | |
| Semigroup (Vector a) | |
| Data a => Data (Vector a) | |
Defined in Data.Vector Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Vector a -> c (Vector a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Vector a) # toConstr :: Vector a -> Constr # dataTypeOf :: Vector a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Vector a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Vector a)) # gmapT :: (forall b. Data b => b -> b) -> Vector a -> Vector a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Vector a -> r # gmapQ :: (forall d. Data d => d -> u) -> Vector a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Vector a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Vector a -> m (Vector a) # | |
| IsList (Vector a) | |
| Read a => Read (Vector a) | |
| Show a => Show (Vector a) | |
| Eq a => Eq (Vector a) | |
| Ord a => Ord (Vector a) | |
Defined in Data.Vector | |
| type Mutable Vector | |
Defined in Data.Vector type Mutable Vector = MVector | |
| type Item (Vector a) | |
Defined in Data.Vector | |
class (Vector Vector a, MVector MVector a) => Unbox a #
Instances
| Unbox All | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Any | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Int16 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Int32 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Int64 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Int8 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Word16 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Word32 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Word64 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Word8 | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox () | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Bool | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Char | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Double | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Float | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Int | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox Word | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Complex a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (First a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Last a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Max a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Min a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (WrappedMonoid a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Identity a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Down a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Dual a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Product a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Sum a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox (DoNotUnboxLazy a) | |
Defined in Data.Vector.Unboxed.Base | |
| NFData a => Unbox (DoNotUnboxNormalForm a) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox (DoNotUnboxStrict a) | |
Defined in Data.Vector.Unboxed.Base | |
| (Unbox a, Unbox b) => Unbox (Arg a b) | |
Defined in Data.Vector.Unboxed.Base | |
| (Unbox a, Unbox b) => Unbox (a, b) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox a => Unbox (Const a b) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox (f a) => Unbox (Alt f a) | |
Defined in Data.Vector.Unboxed.Base | |
| (Unbox a, Unbox b, Unbox c) => Unbox (a, b, c) | |
Defined in Data.Vector.Unboxed.Base | |
| (Unbox a, Unbox b, Unbox c, Unbox d) => Unbox (a, b, c, d) | |
Defined in Data.Vector.Unboxed.Base | |
| Unbox (f (g a)) => Unbox (Compose f g a) | |
Defined in Data.Vector.Unboxed.Base | |
| (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Unbox (a, b, c, d, e) | |
Defined in Data.Vector.Unboxed.Base | |
| (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Unbox (a, b, c, d, e, f) | |
Defined in Data.Vector.Unboxed.Base | |
The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.
Memory addresses are represented as values of type , for some
Ptr aa which is an instance of class Storable. The type argument to
Ptr helps provide some valuable type safety in FFI code (you can't
mix pointers of different types without an explicit cast), while
helping the Haskell type system figure out which marshalling method is
needed for a given pointer.
All marshalling between Haskell and a foreign language ultimately
boils down to translating Haskell data structures into the binary
representation of a corresponding data structure of the foreign
language and vice versa. To code this marshalling in Haskell, it is
necessary to manipulate primitive data types stored in unstructured
memory blocks. The class Storable facilitates this manipulation on
all types for which it is instantiated, which are the standard basic
types of Haskell, the fixed size Int types (Int8, Int16,
Int32, Int64), the fixed size Word types (Word8, Word16,
Word32, Word64), StablePtr, all types from Foreign.C.Types,
as well as Ptr.
Minimal complete definition
sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)
Instances
| Storable Fingerprint | @since base-4.4.0.0 |
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Fingerprint -> Int # alignment :: Fingerprint -> Int # peekElemOff :: Ptr Fingerprint -> Int -> IO Fingerprint # pokeElemOff :: Ptr Fingerprint -> Int -> Fingerprint -> IO () # peekByteOff :: Ptr b -> Int -> IO Fingerprint # pokeByteOff :: Ptr b -> Int -> Fingerprint -> IO () # peek :: Ptr Fingerprint -> IO Fingerprint # poke :: Ptr Fingerprint -> Fingerprint -> IO () # | |
| Storable CBool | |
| Storable CChar | |
| Storable CClock | |
| Storable CDouble | |
| Storable CFloat | |
| Storable CInt | |
Defined in GHC.Internal.Foreign.C.Types | |
| Storable CIntMax | |
| Storable CIntPtr | |
| Storable CLLong | |
| Storable CLong | |
| Storable CPtrdiff | |
Defined in GHC.Internal.Foreign.C.Types | |
| Storable CSChar | |
| Storable CSUSeconds | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CSUSeconds -> Int # alignment :: CSUSeconds -> Int # peekElemOff :: Ptr CSUSeconds -> Int -> IO CSUSeconds # pokeElemOff :: Ptr CSUSeconds -> Int -> CSUSeconds -> IO () # peekByteOff :: Ptr b -> Int -> IO CSUSeconds # pokeByteOff :: Ptr b -> Int -> CSUSeconds -> IO () # peek :: Ptr CSUSeconds -> IO CSUSeconds # poke :: Ptr CSUSeconds -> CSUSeconds -> IO () # | |
| Storable CShort | |
| Storable CSigAtomic | |
Defined in GHC.Internal.Foreign.C.Types Methods sizeOf :: CSigAtomic -> Int # alignment :: CSigAtomic -> Int # peekElemOff :: Ptr CSigAtomic -> Int -> IO CSigAtomic # pokeElemOff :: Ptr CSigAtomic -> Int -> CSigAtomic -> IO () # peekByteOff :: Ptr b -> Int -> IO CSigAtomic # pokeByteOff :: Ptr b -> Int -> CSigAtomic -> IO () # peek :: Ptr CSigAtomic -> IO CSigAtomic # poke :: Ptr CSigAtomic -> CSigAtomic -> IO () # | |
| Storable CSize | |
| Storable CTime | |
| Storable CUChar | |
| Storable CUInt | |
| Storable CUIntMax | |
Defined in GHC.Internal.Foreign.C.Types | |
| Storable CUIntPtr | |
Defined in GHC.Internal.Foreign.C.Types | |
| Storable CULLong | |
| Storable CULong | |
| Storable CUSeconds | |
Defined in GHC.Internal.Foreign.C.Types | |
| Storable CUShort | |
| Storable CWchar | |
| Storable Int16 | @since base-2.01 |
| Storable Int32 | @since base-2.01 |
| Storable Int64 | @since base-2.01 |
| Storable Int8 | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable Word16 | @since base-2.01 |
| Storable Word32 | @since base-2.01 |
| Storable Word64 | @since base-2.01 |
| Storable Word8 | @since base-2.01 |
| Storable () | @since base-4.9.0.0 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable Bool | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable Char | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable Double | @since base-2.01 |
| Storable Float | @since base-2.01 |
| Storable Int | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable Word | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable a => Storable (Complex a) | Since: base-4.8.0.0 |
Defined in Data.Complex | |
| Storable a => Storable (Down a) | @since base-4.14.0.0 |
| Storable (ConstPtr a) | |
Defined in GHC.Internal.Foreign.Storable Methods alignment :: ConstPtr a -> Int # peekElemOff :: Ptr (ConstPtr a) -> Int -> IO (ConstPtr a) # pokeElemOff :: Ptr (ConstPtr a) -> Int -> ConstPtr a -> IO () # peekByteOff :: Ptr b -> Int -> IO (ConstPtr a) # pokeByteOff :: Ptr b -> Int -> ConstPtr a -> IO () # | |
| Storable (FunPtr a) | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable | |
| Storable (Ptr a) | @since base-2.01 |
| (Storable a, Integral a) => Storable (Ratio a) | @since base-4.8.0.0 |
| Storable (StablePtr a) | @since base-2.01 |
Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: StablePtr a -> Int # alignment :: StablePtr a -> Int # peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) # pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () # peekByteOff :: Ptr b -> Int -> IO (StablePtr a) # pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () # | |
The class of types that can be converted to a hash value.
Minimal implementation: hashWithSalt.
Hashable is intended exclusively for use in in-memory data structures.
.
Hashable does not have a fixed standard.
This allows it to improve over time.
.
Because it does not have a fixed standard, different computers or computers on different versions of the code will observe different hash values.
As such, Hashable is not recommended for use other than in-memory datastructures.
Specifically, Hashable is not intended for network use or in applications which persist hashed values.
For stable hashing use named hashes: sha256, crc32, xxhash etc.
If you are looking for Hashable instance in time package,
check time-compat
Instances
| Hashable ByteArray | This instance was available since 1.4.1.0 only for GHC-9.4+ Since: hashable-1.4.2.0 |
Defined in Data.Hashable.Class | |
| Hashable ByteString | |
Defined in Data.Hashable.Class | |
| Hashable ByteString | |
Defined in Data.Hashable.Class | |
| Hashable ShortByteString | |
Defined in Data.Hashable.Class | |
| Hashable IntSet | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Hashable BigNat | |
Defined in Data.Hashable.Class | |
| Hashable Void | |
Defined in Data.Hashable.Class | |
| Hashable ThreadId | |
Defined in Data.Hashable.Class | |
| Hashable SomeTypeRep | |
Defined in Data.Hashable.Class | |
| Hashable Unique | |
Defined in Data.Hashable.Class | |
| Hashable Version | |
Defined in Data.Hashable.Class | |
| Hashable Fingerprint | Since: hashable-1.3.0.0 |
Defined in Data.Hashable.Class | |
| Hashable IntPtr | |
Defined in Data.Hashable.Class | |
| Hashable WordPtr | |
Defined in Data.Hashable.Class | |
| Hashable Int16 | |
Defined in Data.Hashable.Class | |
| Hashable Int32 | |
Defined in Data.Hashable.Class | |
| Hashable Int64 | |
Defined in Data.Hashable.Class | |
| Hashable Int8 | |
Defined in Data.Hashable.Class | |
| Hashable Word16 | |
Defined in Data.Hashable.Class | |
| Hashable Word32 | |
Defined in Data.Hashable.Class | |
| Hashable Word64 | |
Defined in Data.Hashable.Class | |
| Hashable Word8 | |
Defined in Data.Hashable.Class | |
| Hashable Ordering | |
Defined in Data.Hashable.Class | |
| Hashable OsString | Since: hashable-1.4.2.0 |
Defined in Data.Hashable.Class | |
| Hashable PosixString | Since: hashable-1.4.2.0 |
Defined in Data.Hashable.Class | |
| Hashable WindowsString | Since: hashable-1.4.2.0 |
Defined in Data.Hashable.Class | |
| Hashable Text | |
Defined in Data.Hashable.Class | |
| Hashable Text | |
Defined in Data.Hashable.Class | |
| Hashable Integer | |
Defined in Data.Hashable.Class | |
| Hashable Natural | |
Defined in Data.Hashable.Class | |
| Hashable () | |
Defined in Data.Hashable.Class | |
| Hashable Bool | |
Defined in Data.Hashable.Class | |
| Hashable Char | |
Defined in Data.Hashable.Class | |
| Hashable Double | Note: prior to The Since: hashable-1.3.0.0 |
Defined in Data.Hashable.Class | |
| Hashable Float | Note: prior to The Since: hashable-1.3.0.0 |
Defined in Data.Hashable.Class | |
| Hashable Int | |
Defined in Data.Hashable.Class | |
| Hashable Word | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Complex a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (First a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Last a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Max a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Min a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (WrappedMonoid a) | |
Defined in Data.Hashable.Class | |
| Hashable v => Hashable (IntMap v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Hashable v => Hashable (Seq v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Hashable v => Hashable (Set v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Hashable v => Hashable (Tree v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (NonEmpty a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Identity a) | |
Defined in Data.Hashable.Class | |
| Hashable (FunPtr a) | |
Defined in Data.Hashable.Class | |
| Hashable (Ptr a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Ratio a) | |
Defined in Data.Hashable.Class | |
| Hashable (StableName a) | |
Defined in Data.Hashable.Class | |
| Eq a => Hashable (Hashed a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (HashSet a) | |
Defined in Data.HashSet.Internal | |
| Hashable a => Hashable (Maybe a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Solo a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable [a] | |
Defined in Data.Hashable.Class | |
| Hashable (Fixed a) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Arg a b) | Note: Prior to Since Since: hashable-1.3.0.0 |
Defined in Data.Hashable.Class | |
| (Hashable k, Hashable v) => Hashable (Map k v) | Since: hashable-1.3.4.0 |
Defined in Data.Hashable.Class | |
| (Hashable a, Hashable b) => Hashable (Either a b) | |
Defined in Data.Hashable.Class | |
| Hashable (Proxy a) | |
Defined in Data.Hashable.Class | |
| Hashable (TypeRep a) | |
Defined in Data.Hashable.Class | |
| (Hashable k, Hashable v) => Hashable (HashMap k v) | |
Defined in Data.HashMap.Internal | |
| (Hashable a1, Hashable a2) => Hashable (a1, a2) | |
Defined in Data.Hashable.Class | |
| Hashable a => Hashable (Const a b) | |
Defined in Data.Hashable.Class | |
| (Hashable a1, Hashable a2, Hashable a3) => Hashable (a1, a2, a3) | |
Defined in Data.Hashable.Class | |
| (Hashable (f a), Hashable (g a)) => Hashable (Product f g a) | |
Defined in Data.Hashable.Class | |
| (Hashable (f a), Hashable (g a)) => Hashable (Sum f g a) | |
Defined in Data.Hashable.Class | |
| (Hashable a1, Hashable a2, Hashable a3, Hashable a4) => Hashable (a1, a2, a3, a4) | |
Defined in Data.Hashable.Class | |
| Hashable (f (g a)) => Hashable (Compose f g a) | |
Defined in Data.Hashable.Class | |
| (Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5) => Hashable (a1, a2, a3, a4, a5) | |
Defined in Data.Hashable.Class | |
| (Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5, Hashable a6) => Hashable (a1, a2, a3, a4, a5, a6) | |
Defined in Data.Hashable.Class | |
| (Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5, Hashable a6, Hashable a7) => Hashable (a1, a2, a3, a4, a5, a6, a7) | |
Defined in Data.Hashable.Class | |
Numbers
Instances
| PrintfArg Word | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Bounded Word | @since base-2.01 | ||||
| Enum Word | @since base-2.01 | ||||
| Storable Word | @since base-2.01 | ||||
Defined in GHC.Internal.Foreign.Storable | |||||
| Num Word | @since base-2.01 | ||||
| Read Word | @since base-4.5.0.0 | ||||
| Integral Word | @since base-2.01 | ||||
| Real Word | @since base-2.01 | ||||
Defined in GHC.Internal.Real Methods toRational :: Word -> Rational # | |||||
| Show Word | @since base-2.01 | ||||
| Eq Word | |||||
| Ord Word | |||||
| Hashable Word | |||||
Defined in Data.Hashable.Class | |||||
| Unbox Word | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| Vector Vector Word | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Word -> ST s (Vector Word) basicUnsafeThaw :: Vector Word -> ST s (Mutable Vector s Word) basicLength :: Vector Word -> Int basicUnsafeSlice :: Int -> Int -> Vector Word -> Vector Word basicUnsafeIndexM :: Vector Word -> Int -> Box Word basicUnsafeCopy :: Mutable Vector s Word -> Vector Word -> ST s () | |||||
| MVector MVector Word | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Word -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word -> MVector s Word basicOverlaps :: MVector s Word -> MVector s Word -> Bool basicUnsafeNew :: Int -> ST s (MVector s Word) basicInitialize :: MVector s Word -> ST s () basicUnsafeReplicate :: Int -> Word -> ST s (MVector s Word) basicUnsafeRead :: MVector s Word -> Int -> ST s Word basicUnsafeWrite :: MVector s Word -> Int -> Word -> ST s () basicClear :: MVector s Word -> ST s () basicSet :: MVector s Word -> Word -> ST s () basicUnsafeCopy :: MVector s Word -> MVector s Word -> ST s () basicUnsafeMove :: MVector s Word -> MVector s Word -> ST s () basicUnsafeGrow :: MVector s Word -> Int -> ST s (MVector s Word) | |||||
| Generic1 (URec Word :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UWord :: Type -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UWord m -> m # foldMap :: Monoid m => (a -> m) -> UWord a -> m # foldMap' :: Monoid m => (a -> m) -> UWord a -> m # foldr :: (a -> b -> b) -> b -> UWord a -> b # foldr' :: (a -> b -> b) -> b -> UWord a -> b # foldl :: (b -> a -> b) -> b -> UWord a -> b # foldl' :: (b -> a -> b) -> b -> UWord a -> b # foldr1 :: (a -> a -> a) -> UWord a -> a # foldl1 :: (a -> a -> a) -> UWord a -> a # elem :: Eq a => a -> UWord a -> Bool # maximum :: Ord a => UWord a -> a # minimum :: Ord a => UWord a -> a # | |||||
| Traversable (UWord :: Type -> Type) | @since base-4.9.0.0 | ||||
| Functor (URec Word :: Type -> Type) | @since base-4.9.0.0 | ||||
| Generic (URec Word p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Show (URec Word p) | @since base-4.9.0.0 | ||||
| Eq (URec Word p) | @since base-4.9.0.0 | ||||
| Ord (URec Word p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| newtype Vector Word | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| data URec Word (p :: k) | Used for marking occurrences of @since base-4.9.0.0 | ||||
| newtype MVector s Word | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep1 (URec Word :: k -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep (URec Word p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
8-bit unsigned integer type
Instances
| PrintfArg Word8 | Since: base-2.1 |
Defined in Text.Printf | |
| Bits Word8 | @since base-2.01 |
Defined in GHC.Internal.Word Methods (.&.) :: Word8 -> Word8 -> Word8 # (.|.) :: Word8 -> Word8 -> Word8 # xor :: Word8 -> Word8 -> Word8 # complement :: Word8 -> Word8 # shift :: Word8 -> Int -> Word8 # rotate :: Word8 -> Int -> Word8 # setBit :: Word8 -> Int -> Word8 # clearBit :: Word8 -> Int -> Word8 # complementBit :: Word8 -> Int -> Word8 # testBit :: Word8 -> Int -> Bool # bitSizeMaybe :: Word8 -> Maybe Int # shiftL :: Word8 -> Int -> Word8 # unsafeShiftL :: Word8 -> Int -> Word8 # shiftR :: Word8 -> Int -> Word8 # unsafeShiftR :: Word8 -> Int -> Word8 # rotateL :: Word8 -> Int -> Word8 # | |
| FiniteBits Word8 | @since base-4.6.0.0 |
Defined in GHC.Internal.Word Methods finiteBitSize :: Word8 -> Int # countLeadingZeros :: Word8 -> Int # countTrailingZeros :: Word8 -> Int # | |
| Bounded Word8 | @since base-2.01 |
| Enum Word8 | @since base-2.01 |
Defined in GHC.Internal.Word | |
| Storable Word8 | @since base-2.01 |
| Ix Word8 | @since base-2.01 |
| Num Word8 | @since base-2.01 |
| Read Word8 | @since base-2.01 |
| Integral Word8 | @since base-2.01 |
| Real Word8 | @since base-2.01 |
Defined in GHC.Internal.Word Methods toRational :: Word8 -> Rational # | |
| Show Word8 | @since base-2.01 |
| Eq Word8 | @since base-2.01 |
| Ord Word8 | @since base-2.01 |
| Hashable Word8 | |
Defined in Data.Hashable.Class | |
| Unbox Word8 | |
Defined in Data.Vector.Unboxed.Base | |
| Vector Vector Word8 | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Word8 -> ST s (Vector Word8) basicUnsafeThaw :: Vector Word8 -> ST s (Mutable Vector s Word8) basicLength :: Vector Word8 -> Int basicUnsafeSlice :: Int -> Int -> Vector Word8 -> Vector Word8 basicUnsafeIndexM :: Vector Word8 -> Int -> Box Word8 basicUnsafeCopy :: Mutable Vector s Word8 -> Vector Word8 -> ST s () | |
| MVector MVector Word8 | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Word8 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word8 -> MVector s Word8 basicOverlaps :: MVector s Word8 -> MVector s Word8 -> Bool basicUnsafeNew :: Int -> ST s (MVector s Word8) basicInitialize :: MVector s Word8 -> ST s () basicUnsafeReplicate :: Int -> Word8 -> ST s (MVector s Word8) basicUnsafeRead :: MVector s Word8 -> Int -> ST s Word8 basicUnsafeWrite :: MVector s Word8 -> Int -> Word8 -> ST s () basicClear :: MVector s Word8 -> ST s () basicSet :: MVector s Word8 -> Word8 -> ST s () basicUnsafeCopy :: MVector s Word8 -> MVector s Word8 -> ST s () basicUnsafeMove :: MVector s Word8 -> MVector s Word8 -> ST s () basicUnsafeGrow :: MVector s Word8 -> Int -> ST s (MVector s Word8) | |
| newtype Vector Word8 | |
Defined in Data.Vector.Unboxed.Base | |
| newtype MVector s Word8 | |
Defined in Data.Vector.Unboxed.Base | |
32-bit unsigned integer type
Instances
| PrintfArg Word32 | Since: base-2.1 |
Defined in Text.Printf | |
| Bits Word32 | @since base-2.01 |
Defined in GHC.Internal.Word Methods (.&.) :: Word32 -> Word32 -> Word32 # (.|.) :: Word32 -> Word32 -> Word32 # xor :: Word32 -> Word32 -> Word32 # complement :: Word32 -> Word32 # shift :: Word32 -> Int -> Word32 # rotate :: Word32 -> Int -> Word32 # setBit :: Word32 -> Int -> Word32 # clearBit :: Word32 -> Int -> Word32 # complementBit :: Word32 -> Int -> Word32 # testBit :: Word32 -> Int -> Bool # bitSizeMaybe :: Word32 -> Maybe Int # shiftL :: Word32 -> Int -> Word32 # unsafeShiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 # unsafeShiftR :: Word32 -> Int -> Word32 # rotateL :: Word32 -> Int -> Word32 # | |
| FiniteBits Word32 | @since base-4.6.0.0 |
Defined in GHC.Internal.Word Methods finiteBitSize :: Word32 -> Int # countLeadingZeros :: Word32 -> Int # countTrailingZeros :: Word32 -> Int # | |
| Bounded Word32 | @since base-2.01 |
| Enum Word32 | @since base-2.01 |
Defined in GHC.Internal.Word | |
| Storable Word32 | @since base-2.01 |
| Ix Word32 | @since base-2.01 |
| Num Word32 | @since base-2.01 |
| Read Word32 | @since base-2.01 |
| Integral Word32 | @since base-2.01 |
Defined in GHC.Internal.Word | |
| Real Word32 | @since base-2.01 |
Defined in GHC.Internal.Word Methods toRational :: Word32 -> Rational # | |
| Show Word32 | @since base-2.01 |
| Eq Word32 | @since base-2.01 |
| Ord Word32 | @since base-2.01 |
| Hashable Word32 | |
Defined in Data.Hashable.Class | |
| Unbox Word32 | |
Defined in Data.Vector.Unboxed.Base | |
| Vector Vector Word32 | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Word32 -> ST s (Vector Word32) basicUnsafeThaw :: Vector Word32 -> ST s (Mutable Vector s Word32) basicLength :: Vector Word32 -> Int basicUnsafeSlice :: Int -> Int -> Vector Word32 -> Vector Word32 basicUnsafeIndexM :: Vector Word32 -> Int -> Box Word32 basicUnsafeCopy :: Mutable Vector s Word32 -> Vector Word32 -> ST s () | |
| MVector MVector Word32 | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Word32 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word32 -> MVector s Word32 basicOverlaps :: MVector s Word32 -> MVector s Word32 -> Bool basicUnsafeNew :: Int -> ST s (MVector s Word32) basicInitialize :: MVector s Word32 -> ST s () basicUnsafeReplicate :: Int -> Word32 -> ST s (MVector s Word32) basicUnsafeRead :: MVector s Word32 -> Int -> ST s Word32 basicUnsafeWrite :: MVector s Word32 -> Int -> Word32 -> ST s () basicClear :: MVector s Word32 -> ST s () basicSet :: MVector s Word32 -> Word32 -> ST s () basicUnsafeCopy :: MVector s Word32 -> MVector s Word32 -> ST s () basicUnsafeMove :: MVector s Word32 -> MVector s Word32 -> ST s () basicUnsafeGrow :: MVector s Word32 -> Int -> ST s (MVector s Word32) | |
| newtype Vector Word32 | |
Defined in Data.Vector.Unboxed.Base | |
| newtype MVector s Word32 | |
Defined in Data.Vector.Unboxed.Base | |
64-bit unsigned integer type
Instances
| PrintfArg Word64 | Since: base-2.1 |
Defined in Text.Printf | |
| Bits Word64 | @since base-2.01 |
Defined in GHC.Internal.Word Methods (.&.) :: Word64 -> Word64 -> Word64 # (.|.) :: Word64 -> Word64 -> Word64 # xor :: Word64 -> Word64 -> Word64 # complement :: Word64 -> Word64 # shift :: Word64 -> Int -> Word64 # rotate :: Word64 -> Int -> Word64 # setBit :: Word64 -> Int -> Word64 # clearBit :: Word64 -> Int -> Word64 # complementBit :: Word64 -> Int -> Word64 # testBit :: Word64 -> Int -> Bool # bitSizeMaybe :: Word64 -> Maybe Int # shiftL :: Word64 -> Int -> Word64 # unsafeShiftL :: Word64 -> Int -> Word64 # shiftR :: Word64 -> Int -> Word64 # unsafeShiftR :: Word64 -> Int -> Word64 # rotateL :: Word64 -> Int -> Word64 # | |
| FiniteBits Word64 | @since base-4.6.0.0 |
Defined in GHC.Internal.Word Methods finiteBitSize :: Word64 -> Int # countLeadingZeros :: Word64 -> Int # countTrailingZeros :: Word64 -> Int # | |
| Bounded Word64 | @since base-2.01 |
| Enum Word64 | @since base-2.01 |
Defined in GHC.Internal.Word | |
| Storable Word64 | @since base-2.01 |
| Ix Word64 | @since base-2.01 |
| Num Word64 | @since base-2.01 |
| Read Word64 | @since base-2.01 |
| Integral Word64 | @since base-2.01 |
Defined in GHC.Internal.Word | |
| Real Word64 | @since base-2.01 |
Defined in GHC.Internal.Word Methods toRational :: Word64 -> Rational # | |
| Show Word64 | @since base-2.01 |
| Eq Word64 | @since base-2.01 |
| Ord Word64 | @since base-2.01 |
| Hashable Word64 | |
Defined in Data.Hashable.Class | |
| Unbox Word64 | |
Defined in Data.Vector.Unboxed.Base | |
| Vector Vector Word64 | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Word64 -> ST s (Vector Word64) basicUnsafeThaw :: Vector Word64 -> ST s (Mutable Vector s Word64) basicLength :: Vector Word64 -> Int basicUnsafeSlice :: Int -> Int -> Vector Word64 -> Vector Word64 basicUnsafeIndexM :: Vector Word64 -> Int -> Box Word64 basicUnsafeCopy :: Mutable Vector s Word64 -> Vector Word64 -> ST s () | |
| MVector MVector Word64 | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Word64 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word64 -> MVector s Word64 basicOverlaps :: MVector s Word64 -> MVector s Word64 -> Bool basicUnsafeNew :: Int -> ST s (MVector s Word64) basicInitialize :: MVector s Word64 -> ST s () basicUnsafeReplicate :: Int -> Word64 -> ST s (MVector s Word64) basicUnsafeRead :: MVector s Word64 -> Int -> ST s Word64 basicUnsafeWrite :: MVector s Word64 -> Int -> Word64 -> ST s () basicClear :: MVector s Word64 -> ST s () basicSet :: MVector s Word64 -> Word64 -> ST s () basicUnsafeCopy :: MVector s Word64 -> MVector s Word64 -> ST s () basicUnsafeMove :: MVector s Word64 -> MVector s Word64 -> ST s () basicUnsafeGrow :: MVector s Word64 -> Int -> ST s (MVector s Word64) | |
| newtype Vector Word64 | |
Defined in Data.Vector.Unboxed.Base | |
| newtype MVector s Word64 | |
Defined in Data.Vector.Unboxed.Base | |
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
| PrintfArg Int | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Bounded Int | @since base-2.01 | ||||
| Enum Int | @since base-2.01 | ||||
| Storable Int | @since base-2.01 | ||||
Defined in GHC.Internal.Foreign.Storable | |||||
| Num Int | @since base-2.01 | ||||
| Read Int | @since base-2.01 | ||||
| Integral Int | @since base-2.0.1 | ||||
| Real Int | @since base-2.0.1 | ||||
Defined in GHC.Internal.Real Methods toRational :: Int -> Rational # | |||||
| Show Int | @since base-2.01 | ||||
| Eq Int | |||||
| Ord Int | |||||
| Hashable Int | |||||
Defined in Data.Hashable.Class | |||||
| Unbox Int | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| Vector Vector Int | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Int -> ST s (Vector Int) basicUnsafeThaw :: Vector Int -> ST s (Mutable Vector s Int) basicLength :: Vector Int -> Int basicUnsafeSlice :: Int -> Int -> Vector Int -> Vector Int basicUnsafeIndexM :: Vector Int -> Int -> Box Int basicUnsafeCopy :: Mutable Vector s Int -> Vector Int -> ST s () | |||||
| MVector MVector Int | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Int -> Int basicUnsafeSlice :: Int -> Int -> MVector s Int -> MVector s Int basicOverlaps :: MVector s Int -> MVector s Int -> Bool basicUnsafeNew :: Int -> ST s (MVector s Int) basicInitialize :: MVector s Int -> ST s () basicUnsafeReplicate :: Int -> Int -> ST s (MVector s Int) basicUnsafeRead :: MVector s Int -> Int -> ST s Int basicUnsafeWrite :: MVector s Int -> Int -> Int -> ST s () basicClear :: MVector s Int -> ST s () basicSet :: MVector s Int -> Int -> ST s () basicUnsafeCopy :: MVector s Int -> MVector s Int -> ST s () basicUnsafeMove :: MVector s Int -> MVector s Int -> ST s () basicUnsafeGrow :: MVector s Int -> Int -> ST s (MVector s Int) | |||||
| Generic1 (URec Int :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UInt :: Type -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UInt m -> m # foldMap :: Monoid m => (a -> m) -> UInt a -> m # foldMap' :: Monoid m => (a -> m) -> UInt a -> m # foldr :: (a -> b -> b) -> b -> UInt a -> b # foldr' :: (a -> b -> b) -> b -> UInt a -> b # foldl :: (b -> a -> b) -> b -> UInt a -> b # foldl' :: (b -> a -> b) -> b -> UInt a -> b # foldr1 :: (a -> a -> a) -> UInt a -> a # foldl1 :: (a -> a -> a) -> UInt a -> a # elem :: Eq a => a -> UInt a -> Bool # maximum :: Ord a => UInt a -> a # | |||||
| Traversable (UInt :: Type -> Type) | @since base-4.9.0.0 | ||||
| Functor (URec Int :: Type -> Type) | @since base-4.9.0.0 | ||||
| Generic (URec Int p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Show (URec Int p) | @since base-4.9.0.0 | ||||
| Eq (URec Int p) | @since base-4.9.0.0 | ||||
| Ord (URec Int p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| newtype Vector Int | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| data URec Int (p :: k) | Used for marking occurrences of @since base-4.9.0.0 | ||||
| newtype MVector s Int | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep1 (URec Int :: k -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep (URec Int p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
32-bit signed integer type
Instances
| PrintfArg Int32 | Since: base-2.1 |
Defined in Text.Printf | |
| Bits Int32 | @since base-2.01 |
Defined in GHC.Internal.Int Methods (.&.) :: Int32 -> Int32 -> Int32 # (.|.) :: Int32 -> Int32 -> Int32 # xor :: Int32 -> Int32 -> Int32 # complement :: Int32 -> Int32 # shift :: Int32 -> Int -> Int32 # rotate :: Int32 -> Int -> Int32 # setBit :: Int32 -> Int -> Int32 # clearBit :: Int32 -> Int -> Int32 # complementBit :: Int32 -> Int -> Int32 # testBit :: Int32 -> Int -> Bool # bitSizeMaybe :: Int32 -> Maybe Int # shiftL :: Int32 -> Int -> Int32 # unsafeShiftL :: Int32 -> Int -> Int32 # shiftR :: Int32 -> Int -> Int32 # unsafeShiftR :: Int32 -> Int -> Int32 # rotateL :: Int32 -> Int -> Int32 # | |
| FiniteBits Int32 | @since base-4.6.0.0 |
Defined in GHC.Internal.Int Methods finiteBitSize :: Int32 -> Int # countLeadingZeros :: Int32 -> Int # countTrailingZeros :: Int32 -> Int # | |
| Bounded Int32 | @since base-2.01 |
| Enum Int32 | @since base-2.01 |
Defined in GHC.Internal.Int | |
| Storable Int32 | @since base-2.01 |
| Ix Int32 | @since base-2.01 |
| Num Int32 | @since base-2.01 |
| Read Int32 | @since base-2.01 |
| Integral Int32 | @since base-2.01 |
| Real Int32 | @since base-2.01 |
Defined in GHC.Internal.Int Methods toRational :: Int32 -> Rational # | |
| Show Int32 | @since base-2.01 |
| Eq Int32 | @since base-2.01 |
| Ord Int32 | @since base-2.01 |
| Hashable Int32 | |
Defined in Data.Hashable.Class | |
| Unbox Int32 | |
Defined in Data.Vector.Unboxed.Base | |
| Vector Vector Int32 | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Int32 -> ST s (Vector Int32) basicUnsafeThaw :: Vector Int32 -> ST s (Mutable Vector s Int32) basicLength :: Vector Int32 -> Int basicUnsafeSlice :: Int -> Int -> Vector Int32 -> Vector Int32 basicUnsafeIndexM :: Vector Int32 -> Int -> Box Int32 basicUnsafeCopy :: Mutable Vector s Int32 -> Vector Int32 -> ST s () | |
| MVector MVector Int32 | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Int32 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Int32 -> MVector s Int32 basicOverlaps :: MVector s Int32 -> MVector s Int32 -> Bool basicUnsafeNew :: Int -> ST s (MVector s Int32) basicInitialize :: MVector s Int32 -> ST s () basicUnsafeReplicate :: Int -> Int32 -> ST s (MVector s Int32) basicUnsafeRead :: MVector s Int32 -> Int -> ST s Int32 basicUnsafeWrite :: MVector s Int32 -> Int -> Int32 -> ST s () basicClear :: MVector s Int32 -> ST s () basicSet :: MVector s Int32 -> Int32 -> ST s () basicUnsafeCopy :: MVector s Int32 -> MVector s Int32 -> ST s () basicUnsafeMove :: MVector s Int32 -> MVector s Int32 -> ST s () basicUnsafeGrow :: MVector s Int32 -> Int -> ST s (MVector s Int32) | |
| newtype Vector Int32 | |
Defined in Data.Vector.Unboxed.Base | |
| newtype MVector s Int32 | |
Defined in Data.Vector.Unboxed.Base | |
64-bit signed integer type
Instances
| PrintfArg Int64 | Since: base-2.1 |
Defined in Text.Printf | |
| Bits Int64 | @since base-2.01 |
Defined in GHC.Internal.Int Methods (.&.) :: Int64 -> Int64 -> Int64 # (.|.) :: Int64 -> Int64 -> Int64 # xor :: Int64 -> Int64 -> Int64 # complement :: Int64 -> Int64 # shift :: Int64 -> Int -> Int64 # rotate :: Int64 -> Int -> Int64 # setBit :: Int64 -> Int -> Int64 # clearBit :: Int64 -> Int -> Int64 # complementBit :: Int64 -> Int -> Int64 # testBit :: Int64 -> Int -> Bool # bitSizeMaybe :: Int64 -> Maybe Int # shiftL :: Int64 -> Int -> Int64 # unsafeShiftL :: Int64 -> Int -> Int64 # shiftR :: Int64 -> Int -> Int64 # unsafeShiftR :: Int64 -> Int -> Int64 # rotateL :: Int64 -> Int -> Int64 # | |
| FiniteBits Int64 | @since base-4.6.0.0 |
Defined in GHC.Internal.Int Methods finiteBitSize :: Int64 -> Int # countLeadingZeros :: Int64 -> Int # countTrailingZeros :: Int64 -> Int # | |
| Bounded Int64 | @since base-2.01 |
| Enum Int64 | @since base-2.01 |
Defined in GHC.Internal.Int | |
| Storable Int64 | @since base-2.01 |
| Ix Int64 | @since base-2.01 |
| Num Int64 | @since base-2.01 |
| Read Int64 | @since base-2.01 |
| Integral Int64 | @since base-2.01 |
| Real Int64 | @since base-2.01 |
Defined in GHC.Internal.Int Methods toRational :: Int64 -> Rational # | |
| Show Int64 | @since base-2.01 |
| Eq Int64 | @since base-2.01 |
| Ord Int64 | @since base-2.01 |
| Hashable Int64 | |
Defined in Data.Hashable.Class | |
| Unbox Int64 | |
Defined in Data.Vector.Unboxed.Base | |
| Vector Vector Int64 | |
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Int64 -> ST s (Vector Int64) basicUnsafeThaw :: Vector Int64 -> ST s (Mutable Vector s Int64) basicLength :: Vector Int64 -> Int basicUnsafeSlice :: Int -> Int -> Vector Int64 -> Vector Int64 basicUnsafeIndexM :: Vector Int64 -> Int -> Box Int64 basicUnsafeCopy :: Mutable Vector s Int64 -> Vector Int64 -> ST s () | |
| MVector MVector Int64 | |
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Int64 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Int64 -> MVector s Int64 basicOverlaps :: MVector s Int64 -> MVector s Int64 -> Bool basicUnsafeNew :: Int -> ST s (MVector s Int64) basicInitialize :: MVector s Int64 -> ST s () basicUnsafeReplicate :: Int -> Int64 -> ST s (MVector s Int64) basicUnsafeRead :: MVector s Int64 -> Int -> ST s Int64 basicUnsafeWrite :: MVector s Int64 -> Int -> Int64 -> ST s () basicClear :: MVector s Int64 -> ST s () basicSet :: MVector s Int64 -> Int64 -> ST s () basicUnsafeCopy :: MVector s Int64 -> MVector s Int64 -> ST s () basicUnsafeMove :: MVector s Int64 -> MVector s Int64 -> ST s () basicUnsafeGrow :: MVector s Int64 -> Int -> ST s (MVector s Int64) | |
| newtype Vector Int64 | |
Defined in Data.Vector.Unboxed.Base | |
| newtype MVector s Int64 | |
Defined in Data.Vector.Unboxed.Base | |
Arbitrary precision integers. In contrast with fixed-size integral types
such as Int, the Integer type represents the entire infinite range of
integers.
Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
If the value is small (i.e., fits into an Int), the IS constructor is
used. Otherwise IP and IN constructors are used to store a BigNat
representing the positive or the negative value magnitude, respectively.
Invariant: IP and IN are used iff the value does not fit in IS.
Instances
| PrintfArg Integer | Since: base-2.1 |
Defined in Text.Printf | |
| Enum Integer | @since base-2.01 |
| Num Integer | @since base-2.01 |
| Read Integer | @since base-2.01 |
| Integral Integer | @since base-2.0.1 |
Defined in GHC.Internal.Real | |
| Real Integer | @since base-2.0.1 |
Defined in GHC.Internal.Real Methods toRational :: Integer -> Rational # | |
| Show Integer | @since base-2.01 |
| Eq Integer | |
| Ord Integer | |
| Hashable Integer | |
Defined in Data.Hashable.Class | |
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
| PrintfArg Float | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Floating Float | @since base-2.01 | ||||
| RealFloat Float | @since base-2.01 | ||||
Defined in GHC.Internal.Float Methods floatRadix :: Float -> Integer # floatDigits :: Float -> Int # floatRange :: Float -> (Int, Int) # decodeFloat :: Float -> (Integer, Int) # encodeFloat :: Integer -> Int -> Float # significand :: Float -> Float # scaleFloat :: Int -> Float -> Float # isInfinite :: Float -> Bool # isDenormalized :: Float -> Bool # isNegativeZero :: Float -> Bool # | |||||
| Storable Float | @since base-2.01 | ||||
| Read Float | @since base-2.01 | ||||
| Eq Float | Note that due to the presence of
Also note that
| ||||
| Ord Float | See | ||||
| Hashable Float | Note: prior to The Since: hashable-1.3.0.0 | ||||
Defined in Data.Hashable.Class | |||||
| Unbox Float | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| Vector Vector Float | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Float -> ST s (Vector Float) basicUnsafeThaw :: Vector Float -> ST s (Mutable Vector s Float) basicLength :: Vector Float -> Int basicUnsafeSlice :: Int -> Int -> Vector Float -> Vector Float basicUnsafeIndexM :: Vector Float -> Int -> Box Float basicUnsafeCopy :: Mutable Vector s Float -> Vector Float -> ST s () | |||||
| MVector MVector Float | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Float -> Int basicUnsafeSlice :: Int -> Int -> MVector s Float -> MVector s Float basicOverlaps :: MVector s Float -> MVector s Float -> Bool basicUnsafeNew :: Int -> ST s (MVector s Float) basicInitialize :: MVector s Float -> ST s () basicUnsafeReplicate :: Int -> Float -> ST s (MVector s Float) basicUnsafeRead :: MVector s Float -> Int -> ST s Float basicUnsafeWrite :: MVector s Float -> Int -> Float -> ST s () basicClear :: MVector s Float -> ST s () basicSet :: MVector s Float -> Float -> ST s () basicUnsafeCopy :: MVector s Float -> MVector s Float -> ST s () basicUnsafeMove :: MVector s Float -> MVector s Float -> ST s () basicUnsafeGrow :: MVector s Float -> Int -> ST s (MVector s Float) | |||||
| Generic1 (URec Float :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UFloat :: Type -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UFloat m -> m # foldMap :: Monoid m => (a -> m) -> UFloat a -> m # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m # foldr :: (a -> b -> b) -> b -> UFloat a -> b # foldr' :: (a -> b -> b) -> b -> UFloat a -> b # foldl :: (b -> a -> b) -> b -> UFloat a -> b # foldl' :: (b -> a -> b) -> b -> UFloat a -> b # foldr1 :: (a -> a -> a) -> UFloat a -> a # foldl1 :: (a -> a -> a) -> UFloat a -> a # elem :: Eq a => a -> UFloat a -> Bool # maximum :: Ord a => UFloat a -> a # minimum :: Ord a => UFloat a -> a # | |||||
| Traversable (UFloat :: Type -> Type) | @since base-4.9.0.0 | ||||
| Functor (URec Float :: Type -> Type) | @since base-4.9.0.0 | ||||
| Generic (URec Float p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Show (URec Float p) | |||||
| Eq (URec Float p) | |||||
| Ord (URec Float p) | |||||
Defined in GHC.Internal.Generics | |||||
| newtype Vector Float | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| data URec Float (p :: k) | Used for marking occurrences of @since base-4.9.0.0 | ||||
| newtype MVector s Float | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep1 (URec Float :: k -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep (URec Float p) | |||||
Defined in GHC.Internal.Generics | |||||
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
| PrintfArg Double | Since: base-2.1 | ||||
Defined in Text.Printf | |||||
| Floating Double | @since base-2.01 | ||||
| RealFloat Double | @since base-2.01 | ||||
Defined in GHC.Internal.Float Methods floatRadix :: Double -> Integer # floatDigits :: Double -> Int # floatRange :: Double -> (Int, Int) # decodeFloat :: Double -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double # significand :: Double -> Double # scaleFloat :: Int -> Double -> Double # isInfinite :: Double -> Bool # isDenormalized :: Double -> Bool # isNegativeZero :: Double -> Bool # | |||||
| Storable Double | @since base-2.01 | ||||
| Read Double | @since base-2.01 | ||||
| Eq Double | Note that due to the presence of
Also note that
| ||||
| Ord Double | IEEE 754 IEEE 754-2008, section 5.11 requires that if at least one of arguments of
IEEE 754-2008, section 5.10 defines Thus, users must be extremely cautious when using Moving further, the behaviour of IEEE 754-2008 compliant | ||||
| Hashable Double | Note: prior to The Since: hashable-1.3.0.0 | ||||
Defined in Data.Hashable.Class | |||||
| Unbox Double | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| Vector Vector Double | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s Double -> ST s (Vector Double) basicUnsafeThaw :: Vector Double -> ST s (Mutable Vector s Double) basicLength :: Vector Double -> Int basicUnsafeSlice :: Int -> Int -> Vector Double -> Vector Double basicUnsafeIndexM :: Vector Double -> Int -> Box Double basicUnsafeCopy :: Mutable Vector s Double -> Vector Double -> ST s () | |||||
| MVector MVector Double | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s Double -> Int basicUnsafeSlice :: Int -> Int -> MVector s Double -> MVector s Double basicOverlaps :: MVector s Double -> MVector s Double -> Bool basicUnsafeNew :: Int -> ST s (MVector s Double) basicInitialize :: MVector s Double -> ST s () basicUnsafeReplicate :: Int -> Double -> ST s (MVector s Double) basicUnsafeRead :: MVector s Double -> Int -> ST s Double basicUnsafeWrite :: MVector s Double -> Int -> Double -> ST s () basicClear :: MVector s Double -> ST s () basicSet :: MVector s Double -> Double -> ST s () basicUnsafeCopy :: MVector s Double -> MVector s Double -> ST s () basicUnsafeMove :: MVector s Double -> MVector s Double -> ST s () basicUnsafeGrow :: MVector s Double -> Int -> ST s (MVector s Double) | |||||
| Generic1 (URec Double :: k -> Type) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Foldable (UDouble :: Type -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |||||
| Traversable (UDouble :: Type -> Type) | @since base-4.9.0.0 | ||||
| Functor (URec Double :: Type -> Type) | @since base-4.9.0.0 | ||||
| Generic (URec Double p) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Show (URec Double p) | @since base-4.9.0.0 | ||||
| Eq (URec Double p) | @since base-4.9.0.0 | ||||
| Ord (URec Double p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics Methods compare :: URec Double p -> URec Double p -> Ordering # (<) :: URec Double p -> URec Double p -> Bool # (<=) :: URec Double p -> URec Double p -> Bool # (>) :: URec Double p -> URec Double p -> Bool # (>=) :: URec Double p -> URec Double p -> Bool # | |||||
| newtype Vector Double | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| data URec Double (p :: k) | Used for marking occurrences of @since base-4.9.0.0 | ||||
| newtype MVector s Double | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep1 (URec Double :: k -> Type) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| type Rep (URec Double p) | @since base-4.9.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
Numeric functions
(^^) :: (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.
WARNING: This function performs silent truncation if the result type is not at least as big as the argument's type.
realToFrac :: (Real a, Fractional b) => a -> b #
General coercion to Fractional types.
WARNING: This function goes through the Rational type, which does not have values for NaN for example.
This means it does not round-trip.
For Double it also behaves differently with or without -O0:
Prelude> realToFrac nan -- With -O0 -Infinity Prelude> realToFrac nan NaN
Monoids
class Semigroup a => Monoid a where #
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following:
- Right identity
x<>mempty= x- Left identity
mempty<>x = x- Associativity
x(<>(y<>z) = (x<>y)<>zSemigrouplaw)- Concatenation
mconcat=foldr(<>)mempty
You can alternatively define mconcat instead of mempty, in which case the
laws are:
- Unit
mconcat(purex) = x- Multiplication
mconcat(joinxss) =mconcat(fmapmconcatxss)- Subclass
mconcat(toListxs) =sconcatxs
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.
NOTE: Semigroup is a superclass of Monoid since base-4.11.0.0.
Methods
Identity of mappend
Examples
>>>"Hello world" <> mempty"Hello world"
>>>mempty <> [1, 2, 3][1,2,3]
An associative operation
NOTE: This method is redundant and has the default
implementation since base-4.11.0.0.
Should it be implemented manually, since mappend = (<>)mappend is a synonym for
(<>), it is expected that the two functions are defined the same
way. In a future GHC release mappend will be removed from Monoid.
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.
>>>mconcat ["Hello", " ", "Haskell", "!"]"Hello Haskell!"
Instances
| Monoid ByteArray | Since: base-4.17.0.0 |
| Monoid Builder | |
| Monoid ByteString | |
Defined in Data.ByteString.Internal.Type Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
| Monoid ByteString | |
Defined in Data.ByteString.Lazy.Internal Methods mempty :: ByteString # mappend :: ByteString -> ByteString -> ByteString # mconcat :: [ByteString] -> ByteString # | |
| Monoid ShortByteString | |
Defined in Data.ByteString.Short.Internal Methods mappend :: ShortByteString -> ShortByteString -> ShortByteString # mconcat :: [ShortByteString] -> ShortByteString # | |
| Monoid IntSet | |
| Monoid Ordering | @since base-2.01 |
| Monoid OsString | "String-Concatenation" for |
| Monoid PosixString | |
Defined in System.OsString.Internal.Types Methods mempty :: PosixString # mappend :: PosixString -> PosixString -> PosixString # mconcat :: [PosixString] -> PosixString # | |
| Monoid WindowsString | |
Defined in System.OsString.Internal.Types Methods mempty :: WindowsString # mappend :: WindowsString -> WindowsString -> WindowsString # mconcat :: [WindowsString] -> WindowsString # | |
| Monoid Doc | |
| Monoid Builder | |
| Monoid StrictBuilder | |
Defined in Data.Text.Internal.StrictBuilder Methods mempty :: StrictBuilder # mappend :: StrictBuilder -> StrictBuilder -> StrictBuilder # mconcat :: [StrictBuilder] -> StrictBuilder # | |
| Monoid () | @since base-2.01 |
| Monoid (Comparison a) |
mempty :: Comparison a mempty = Comparison _ _ -> EQ |
Defined in Data.Functor.Contravariant Methods mempty :: Comparison a # mappend :: Comparison a -> Comparison a -> Comparison a # mconcat :: [Comparison a] -> Comparison a # | |
| Monoid (Equivalence a) |
mempty :: Equivalence a mempty = Equivalence _ _ -> True |
Defined in Data.Functor.Contravariant Methods mempty :: Equivalence a # mappend :: Equivalence a -> Equivalence a -> Equivalence a # mconcat :: [Equivalence a] -> Equivalence a # | |
| Monoid (Predicate a) |
mempty :: Predicate a mempty = _ -> True |
| (Ord a, Bounded a) => Monoid (Max a) | Since: base-4.9.0.0 |
| (Ord a, Bounded a) => Monoid (Min a) | Since: base-4.9.0.0 |
| Monoid m => Monoid (WrappedMonoid m) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods mempty :: WrappedMonoid m # mappend :: WrappedMonoid m -> WrappedMonoid m -> WrappedMonoid m # mconcat :: [WrappedMonoid m] -> WrappedMonoid m # | |
| Monoid (IntMap a) | |
| Monoid (Seq a) | |
| Monoid (MergeSet a) | |
| Ord a => Monoid (Set a) | |
| Monoid a => Monoid (Down a) | @since base-4.11.0.0 |
| (Generic a, Monoid (Rep a ())) => Monoid (Generically a) | @since base-4.17.0.0 |
Defined in GHC.Internal.Generics Methods mempty :: Generically a # mappend :: Generically a -> Generically a -> Generically a # mconcat :: [Generically a] -> Generically a # | |
| Monoid p => Monoid (Par1 p) | @since base-4.12.0.0 |
| Monoid a => Monoid (IO a) | @since base-4.9.0.0 |
| Monoid (Doc a) | |
| Monoid (Array a) | |
| Monoid (PrimArray a) | Since: primitive-0.6.4.0 |
| Monoid (SmallArray a) | |
Defined in Data.Primitive.SmallArray Methods mempty :: SmallArray a # mappend :: SmallArray a -> SmallArray a -> SmallArray a # mconcat :: [SmallArray a] -> SmallArray a # | |
| Monoid (Validity k) | |
| (Hashable a, Eq a) => Monoid (HashSet a) | \(O(n+m)\) To obtain good performance, the smaller set must be presented as the first argument. Examples
|
| Monoid (Vector a) | |
| Prim a => Monoid (Vector a) | |
| Storable a => Monoid (Vector a) | |
| Monoid (Vector a) | |
| Semigroup a => Monoid (Maybe a) | Lift a semigroup into Since 4.11.0: constraint on inner @since base-2.01 |
| Monoid a => Monoid (Solo a) | @since base-4.15 |
| Monoid [a] | @since base-2.01 |
| Monoid a => Monoid (Op a b) |
mempty :: Op a b mempty = Op _ -> mempty |
| Ord k => Monoid (Map k v) | |
| Monoid (U1 p) | @since base-4.12.0.0 |
| (Eq k, Hashable k) => Monoid (HashMap k v) | If a key occurs in both maps, the mapping from the first will be the mapping in the result. Examples
|
| (Monoid a, Monoid b) => Monoid (a, b) | @since base-2.01 |
| Monoid b => Monoid (a -> b) | @since base-2.01 |
| Monoid (f p) => Monoid (Rec1 f p) | @since base-4.12.0.0 |
| Monoid a => Monoid (Constant a b) | |
| (Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) | @since base-2.01 |
| (Monoid (f a), Monoid (g a)) => Monoid (Product f g a) | Since: base-4.16.0.0 |
| (Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | @since base-4.12.0.0 |
| Monoid c => Monoid (K1 i c p) | @since base-4.12.0.0 |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) | @since base-2.01 |
| Monoid (f (g a)) => Monoid (Compose f g a) | Since: base-4.16.0.0 |
| Monoid (f (g p)) => Monoid ((f :.: g) p) | @since base-4.12.0.0 |
| Monoid (f p) => Monoid (M1 i c f p) | @since base-4.12.0.0 |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) | @since base-2.01 |
(<>) :: Semigroup a => a -> a -> a infixr 6 #
An associative operation.
Examples
>>>[1,2,3] <> [4,5,6][1,2,3,4,5,6]
>>>Just [1, 2, 3] <> Just [4, 5, 6]Just [1,2,3,4,5,6]
>>>putStr "Hello, " <> putStrLn "World!"Hello, World!
Folds and traversals
class Foldable (t :: Type -> Type) #
The Foldable class represents data structures that can be reduced to a summary value one element at a time. Strict left-associative folds are a good fit for space-efficient reduction, while lazy right-associative folds are a good fit for corecursive iteration, or for folds that short-circuit after processing an initial subsequence of the structure's elements.
Instances can be derived automatically by enabling the DeriveFoldable
extension. For example, a derived instance for a binary tree might be:
{-# LANGUAGE DeriveFoldable #-}
data Tree a = Empty
| Leaf a
| Node (Tree a) a (Tree a)
deriving FoldableA more detailed description can be found in the Overview section of Data.Foldable.
For the class laws see the Laws section of Data.Foldable.
Instances
| Foldable Complex | Since: base-4.9.0.0 |
Defined in Data.Complex Methods fold :: Monoid m => Complex m -> m # foldMap :: Monoid m => (a -> m) -> Complex a -> 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 # elem :: Eq a => a -> Complex a -> Bool # maximum :: Ord a => Complex a -> a # minimum :: Ord a => Complex a -> a # | |
| Foldable First | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => First m -> m # foldMap :: Monoid m => (a -> m) -> First a -> 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 # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # | |
| Foldable Last | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Last m -> m # foldMap :: Monoid m => (a -> m) -> Last a -> 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 # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # | |
| Foldable Max | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Max m -> m # foldMap :: Monoid m => (a -> m) -> Max a -> 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 # elem :: Eq a => a -> Max a -> Bool # maximum :: Ord a => Max a -> a # | |
| Foldable Min | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Min m -> m # foldMap :: Monoid m => (a -> m) -> Min a -> 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 # elem :: Eq a => a -> Min a -> Bool # maximum :: Ord a => Min a -> a # | |
| Foldable SCC | Since: containers-0.5.9 |
Defined in Data.Graph Methods fold :: Monoid m => SCC m -> m # foldMap :: Monoid m => (a -> m) -> SCC a -> m # foldMap' :: Monoid m => (a -> m) -> SCC a -> m # foldr :: (a -> b -> b) -> b -> SCC a -> b # foldr' :: (a -> b -> b) -> b -> SCC a -> b # foldl :: (b -> a -> b) -> b -> SCC a -> b # foldl' :: (b -> a -> b) -> b -> SCC a -> b # foldr1 :: (a -> a -> a) -> SCC a -> a # foldl1 :: (a -> a -> a) -> SCC a -> a # elem :: Eq a => a -> SCC a -> Bool # maximum :: Ord a => SCC a -> a # | |
| Foldable IntMap | Folds in order of increasing key. |
Defined in Data.IntMap.Internal Methods fold :: Monoid m => IntMap m -> m # foldMap :: Monoid m => (a -> m) -> IntMap a -> m # foldMap' :: Monoid m => (a -> m) -> IntMap a -> m # foldr :: (a -> b -> b) -> b -> IntMap a -> b # foldr' :: (a -> b -> b) -> b -> IntMap a -> b # foldl :: (b -> a -> b) -> b -> IntMap a -> b # foldl' :: (b -> a -> b) -> b -> IntMap a -> b # foldr1 :: (a -> a -> a) -> IntMap a -> a # foldl1 :: (a -> a -> a) -> IntMap a -> a # elem :: Eq a => a -> IntMap a -> Bool # maximum :: Ord a => IntMap a -> a # minimum :: Ord a => IntMap a -> a # | |
| Foldable Digit | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Digit m -> m # foldMap :: Monoid m => (a -> m) -> Digit a -> m # foldMap' :: Monoid m => (a -> m) -> Digit a -> m # foldr :: (a -> b -> b) -> b -> Digit a -> b # foldr' :: (a -> b -> b) -> b -> Digit a -> b # foldl :: (b -> a -> b) -> b -> Digit a -> b # foldl' :: (b -> a -> b) -> b -> Digit a -> b # foldr1 :: (a -> a -> a) -> Digit a -> a # foldl1 :: (a -> a -> a) -> Digit a -> a # elem :: Eq a => a -> Digit a -> Bool # maximum :: Ord a => Digit a -> a # minimum :: Ord a => Digit a -> a # | |
| Foldable Elem | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Elem m -> m # foldMap :: Monoid m => (a -> m) -> Elem a -> m # foldMap' :: Monoid m => (a -> m) -> Elem a -> m # foldr :: (a -> b -> b) -> b -> Elem a -> b # foldr' :: (a -> b -> b) -> b -> Elem a -> b # foldl :: (b -> a -> b) -> b -> Elem a -> b # foldl' :: (b -> a -> b) -> b -> Elem a -> b # foldr1 :: (a -> a -> a) -> Elem a -> a # foldl1 :: (a -> a -> a) -> Elem a -> a # elem :: Eq a => a -> Elem a -> Bool # maximum :: Ord a => Elem a -> a # | |
| Foldable FingerTree | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => FingerTree m -> m # foldMap :: Monoid m => (a -> m) -> FingerTree a -> m # foldMap' :: Monoid m => (a -> m) -> FingerTree a -> m # foldr :: (a -> b -> b) -> b -> FingerTree a -> b # foldr' :: (a -> b -> b) -> b -> FingerTree a -> b # foldl :: (b -> a -> b) -> b -> FingerTree a -> b # foldl' :: (b -> a -> b) -> b -> FingerTree a -> b # foldr1 :: (a -> a -> a) -> FingerTree a -> a # foldl1 :: (a -> a -> a) -> FingerTree a -> a # toList :: FingerTree a -> [a] # null :: FingerTree a -> Bool # length :: FingerTree a -> Int # elem :: Eq a => a -> FingerTree a -> Bool # maximum :: Ord a => FingerTree a -> a # minimum :: Ord a => FingerTree a -> a # sum :: Num a => FingerTree a -> a # product :: Num a => FingerTree a -> a # | |
| Foldable Node | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Node m -> m # foldMap :: Monoid m => (a -> m) -> Node a -> m # foldMap' :: Monoid m => (a -> m) -> Node a -> m # foldr :: (a -> b -> b) -> b -> Node a -> b # foldr' :: (a -> b -> b) -> b -> Node a -> b # foldl :: (b -> a -> b) -> b -> Node a -> b # foldl' :: (b -> a -> b) -> b -> Node a -> b # foldr1 :: (a -> a -> a) -> Node a -> a # foldl1 :: (a -> a -> a) -> Node a -> a # elem :: Eq a => a -> Node a -> Bool # maximum :: Ord a => Node a -> a # | |
| Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldMap' :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
| Foldable ViewL | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => ViewL m -> m # foldMap :: Monoid m => (a -> m) -> ViewL a -> m # foldMap' :: Monoid m => (a -> m) -> ViewL a -> m # foldr :: (a -> b -> b) -> b -> ViewL a -> b # foldr' :: (a -> b -> b) -> b -> ViewL a -> b # foldl :: (b -> a -> b) -> b -> ViewL a -> b # foldl' :: (b -> a -> b) -> b -> ViewL a -> b # foldr1 :: (a -> a -> a) -> ViewL a -> a # foldl1 :: (a -> a -> a) -> ViewL a -> a # elem :: Eq a => a -> ViewL a -> Bool # maximum :: Ord a => ViewL a -> a # minimum :: Ord a => ViewL a -> a # | |
| Foldable ViewR | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => ViewR m -> m # foldMap :: Monoid m => (a -> m) -> ViewR a -> m # foldMap' :: Monoid m => (a -> m) -> ViewR a -> m # foldr :: (a -> b -> b) -> b -> ViewR a -> b # foldr' :: (a -> b -> b) -> b -> ViewR a -> b # foldl :: (b -> a -> b) -> b -> ViewR a -> b # foldl' :: (b -> a -> b) -> b -> ViewR a -> b # foldr1 :: (a -> a -> a) -> ViewR a -> a # foldl1 :: (a -> a -> a) -> ViewR a -> a # elem :: Eq a => a -> ViewR a -> Bool # maximum :: Ord a => ViewR a -> a # minimum :: Ord a => ViewR a -> a # | |
| Foldable Set | Folds in order of increasing key. |
Defined in Data.Set.Internal Methods fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldMap' :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # | |
| Foldable Tree | Folds in preorder |
Defined in Data.Tree Methods fold :: Monoid m => Tree m -> m # foldMap :: Monoid m => (a -> m) -> Tree a -> m # foldMap' :: Monoid m => (a -> m) -> Tree a -> m # foldr :: (a -> b -> b) -> b -> Tree a -> b # foldr' :: (a -> b -> b) -> b -> Tree a -> b # foldl :: (b -> a -> b) -> b -> Tree a -> b # foldl' :: (b -> a -> b) -> b -> Tree a -> b # foldr1 :: (a -> a -> a) -> Tree a -> a # foldl1 :: (a -> a -> a) -> Tree a -> a # elem :: Eq a => a -> Tree a -> Bool # maximum :: Ord a => Tree a -> a # | |
| Foldable NonEmpty | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => NonEmpty m -> m # foldMap :: Monoid m => (a -> m) -> NonEmpty a -> 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 # elem :: Eq a => a -> NonEmpty a -> Bool # maximum :: Ord a => NonEmpty a -> a # minimum :: Ord a => NonEmpty a -> a # | |
| Foldable First | @since base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => First m -> m # foldMap :: Monoid m => (a -> m) -> First a -> 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 # elem :: Eq a => a -> First a -> Bool # maximum :: Ord a => First a -> a # minimum :: Ord a => First a -> a # | |
| Foldable Last | @since base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Last m -> m # foldMap :: Monoid m => (a -> m) -> Last a -> 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 # elem :: Eq a => a -> Last a -> Bool # maximum :: Ord a => Last a -> a # | |
| Foldable Down | @since base-4.12.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Down m -> m # foldMap :: Monoid m => (a -> m) -> Down a -> m # foldMap' :: Monoid m => (a -> m) -> Down a -> m # foldr :: (a -> b -> b) -> b -> Down a -> b # foldr' :: (a -> b -> b) -> b -> Down a -> b # foldl :: (b -> a -> b) -> b -> Down a -> b # foldl' :: (b -> a -> b) -> b -> Down a -> b # foldr1 :: (a -> a -> a) -> Down a -> a # foldl1 :: (a -> a -> a) -> Down a -> a # elem :: Eq a => a -> Down a -> Bool # maximum :: Ord a => Down a -> a # | |
| Foldable Dual | @since base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Dual m -> m # foldMap :: Monoid m => (a -> m) -> Dual a -> 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 # elem :: Eq a => a -> Dual a -> Bool # maximum :: Ord a => Dual a -> a # | |
| Foldable Product | @since base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Product m -> m # foldMap :: Monoid m => (a -> m) -> Product a -> 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 # elem :: Eq a => a -> Product a -> Bool # maximum :: Ord a => Product a -> a # minimum :: Ord a => Product a -> a # | |
| Foldable Sum | @since base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Sum m -> m # foldMap :: Monoid m => (a -> m) -> Sum a -> 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 # elem :: Eq a => a -> Sum a -> Bool # maximum :: Ord a => Sum a -> a # | |
| Foldable Par1 | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Par1 m -> m # foldMap :: Monoid m => (a -> m) -> Par1 a -> m # foldMap' :: Monoid m => (a -> m) -> Par1 a -> m # foldr :: (a -> b -> b) -> b -> Par1 a -> b # foldr' :: (a -> b -> b) -> b -> Par1 a -> b # foldl :: (b -> a -> b) -> b -> Par1 a -> b # foldl' :: (b -> a -> b) -> b -> Par1 a -> b # foldr1 :: (a -> a -> a) -> Par1 a -> a # foldl1 :: (a -> a -> a) -> Par1 a -> a # elem :: Eq a => a -> Par1 a -> Bool # maximum :: Ord a => Par1 a -> a # | |
| Foldable Hashed | |
Defined in Data.Hashable.Class Methods fold :: Monoid m => Hashed m -> m # foldMap :: Monoid m => (a -> m) -> Hashed a -> m # foldMap' :: Monoid m => (a -> m) -> Hashed a -> m # foldr :: (a -> b -> b) -> b -> Hashed a -> b # foldr' :: (a -> b -> b) -> b -> Hashed a -> b # foldl :: (b -> a -> b) -> b -> Hashed a -> b # foldl' :: (b -> a -> b) -> b -> Hashed a -> b # foldr1 :: (a -> a -> a) -> Hashed a -> a # foldl1 :: (a -> a -> a) -> Hashed a -> a # elem :: Eq a => a -> Hashed a -> Bool # maximum :: Ord a => Hashed a -> a # minimum :: Ord a => Hashed a -> a # | |
| Foldable Array | |
Defined in Data.Primitive.Array Methods fold :: Monoid m => Array m -> m # foldMap :: Monoid m => (a -> m) -> Array a -> m # foldMap' :: Monoid m => (a -> m) -> Array a -> m # foldr :: (a -> b -> b) -> b -> Array a -> b # foldr' :: (a -> b -> b) -> b -> Array a -> b # foldl :: (b -> a -> b) -> b -> Array a -> b # foldl' :: (b -> a -> b) -> b -> Array a -> b # foldr1 :: (a -> a -> a) -> Array a -> a # foldl1 :: (a -> a -> a) -> Array a -> a # elem :: Eq a => a -> Array a -> Bool # maximum :: Ord a => Array a -> a # minimum :: Ord a => Array a -> a # | |
| Foldable SmallArray | |
Defined in Data.Primitive.SmallArray Methods fold :: Monoid m => SmallArray m -> m # foldMap :: Monoid m => (a -> m) -> SmallArray a -> m # foldMap' :: Monoid m => (a -> m) -> SmallArray a -> m # foldr :: (a -> b -> b) -> b -> SmallArray a -> b # foldr' :: (a -> b -> b) -> b -> SmallArray a -> b # foldl :: (b -> a -> b) -> b -> SmallArray a -> b # foldl' :: (b -> a -> b) -> b -> SmallArray a -> b # foldr1 :: (a -> a -> a) -> SmallArray a -> a # foldl1 :: (a -> a -> a) -> SmallArray a -> a # toList :: SmallArray a -> [a] # null :: SmallArray a -> Bool # length :: SmallArray a -> Int # elem :: Eq a => a -> SmallArray a -> Bool # maximum :: Ord a => SmallArray a -> a # minimum :: Ord a => SmallArray a -> a # sum :: Num a => SmallArray a -> a # product :: Num a => SmallArray a -> a # | |
| Foldable HashSet | |
Defined in Data.HashSet.Internal Methods fold :: Monoid m => HashSet m -> m # foldMap :: Monoid m => (a -> m) -> HashSet a -> m # foldMap' :: Monoid m => (a -> m) -> HashSet a -> m # foldr :: (a -> b -> b) -> b -> HashSet a -> b # foldr' :: (a -> b -> b) -> b -> HashSet a -> b # foldl :: (b -> a -> b) -> b -> HashSet a -> b # foldl' :: (b -> a -> b) -> b -> HashSet a -> b # foldr1 :: (a -> a -> a) -> HashSet a -> a # foldl1 :: (a -> a -> a) -> HashSet a -> a # elem :: Eq a => a -> HashSet a -> Bool # maximum :: Ord a => HashSet a -> a # minimum :: Ord a => HashSet a -> a # | |
| Foldable Vector | |
Defined in Data.Vector Methods fold :: Monoid m => Vector m -> m # foldMap :: Monoid m => (a -> m) -> Vector a -> m # foldMap' :: Monoid m => (a -> m) -> Vector a -> m # foldr :: (a -> b -> b) -> b -> Vector a -> b # foldr' :: (a -> b -> b) -> b -> Vector a -> b # foldl :: (b -> a -> b) -> b -> Vector a -> b # foldl' :: (b -> a -> b) -> b -> Vector a -> b # foldr1 :: (a -> a -> a) -> Vector a -> a # foldl1 :: (a -> a -> a) -> Vector a -> a # elem :: Eq a => a -> Vector a -> Bool # maximum :: Ord a => Vector a -> a # minimum :: Ord a => Vector a -> a # | |
| Foldable Vector | |
Defined in Data.Vector.Strict Methods fold :: Monoid m => Vector m -> m # foldMap :: Monoid m => (a -> m) -> Vector a -> m # foldMap' :: Monoid m => (a -> m) -> Vector a -> m # foldr :: (a -> b -> b) -> b -> Vector a -> b # foldr' :: (a -> b -> b) -> b -> Vector a -> b # foldl :: (b -> a -> b) -> b -> Vector a -> b # foldl' :: (b -> a -> b) -> b -> Vector a -> b # foldr1 :: (a -> a -> a) -> Vector a -> a # foldl1 :: (a -> a -> a) -> Vector a -> a # elem :: Eq a => a -> Vector a -> Bool # maximum :: Ord a => Vector a -> a # minimum :: Ord a => Vector a -> a # | |
| Foldable Maybe | @since base-2.01 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Maybe m -> m # foldMap :: Monoid m => (a -> m) -> Maybe a -> 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 # elem :: Eq a => a -> Maybe a -> Bool # maximum :: Ord a => Maybe a -> a # minimum :: Ord a => Maybe a -> a # | |
| Foldable Solo | @since base-4.15 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Solo m -> m # foldMap :: Monoid m => (a -> m) -> Solo a -> m # foldMap' :: Monoid m => (a -> m) -> Solo a -> m # foldr :: (a -> b -> b) -> b -> Solo a -> b # foldr' :: (a -> b -> b) -> b -> Solo a -> b # foldl :: (b -> a -> b) -> b -> Solo a -> b # foldl' :: (b -> a -> b) -> b -> Solo a -> b # foldr1 :: (a -> a -> a) -> Solo a -> a # foldl1 :: (a -> a -> a) -> Solo a -> a # elem :: Eq a => a -> Solo a -> Bool # maximum :: Ord a => Solo a -> a # | |
| Foldable [] | @since base-2.01 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => [m] -> m # foldMap :: Monoid m => (a -> m) -> [a] -> 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 # elem :: Eq a => a -> [a] -> Bool # maximum :: Ord a => [a] -> a # | |
| Foldable (Arg a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup Methods fold :: Monoid m => Arg a m -> m # foldMap :: Monoid m => (a0 -> m) -> Arg a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Arg a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Arg a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Arg a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Arg a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Arg a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 # elem :: Eq a0 => a0 -> Arg a a0 -> Bool # maximum :: Ord a0 => Arg a a0 -> a0 # minimum :: Ord a0 => Arg a a0 -> a0 # | |
| Foldable (Map k) | Folds in order of increasing key. |
Defined in Data.Map.Internal Methods fold :: Monoid m => Map k m -> m # foldMap :: Monoid m => (a -> m) -> Map k a -> m # foldMap' :: Monoid m => (a -> m) -> Map k a -> m # foldr :: (a -> b -> b) -> b -> Map k a -> b # foldr' :: (a -> b -> b) -> b -> Map k a -> b # foldl :: (b -> a -> b) -> b -> Map k a -> b # foldl' :: (b -> a -> b) -> b -> Map k a -> b # foldr1 :: (a -> a -> a) -> Map k a -> a # foldl1 :: (a -> a -> a) -> Map k a -> a # elem :: Eq a => a -> Map k a -> Bool # maximum :: Ord a => Map k a -> a # minimum :: Ord a => Map k a -> a # | |
| Foldable (Array i) | @since base-4.8.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Array i m -> m # foldMap :: Monoid m => (a -> m) -> Array i a -> m # foldMap' :: Monoid m => (a -> m) -> Array i a -> m # foldr :: (a -> b -> b) -> b -> Array i a -> b # foldr' :: (a -> b -> b) -> b -> Array i a -> b # foldl :: (b -> a -> b) -> b -> Array i a -> b # foldl' :: (b -> a -> b) -> b -> Array i a -> b # foldr1 :: (a -> a -> a) -> Array i a -> a # foldl1 :: (a -> a -> a) -> Array i a -> a # elem :: Eq a => a -> Array i a -> Bool # maximum :: Ord a => Array i a -> a # minimum :: Ord a => Array i a -> a # | |
| Foldable (Either a) | @since base-4.7.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Either a m -> m # foldMap :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Either a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Either a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Either a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Either a a0 -> a0 # toList :: Either a a0 -> [a0] # length :: Either a a0 -> Int # elem :: Eq a0 => a0 -> Either a a0 -> Bool # maximum :: Ord a0 => Either a a0 -> a0 # minimum :: Ord a0 => Either a a0 -> a0 # | |
| Foldable (Proxy :: Type -> Type) | @since base-4.7.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Proxy m -> m # foldMap :: Monoid m => (a -> m) -> Proxy a -> m # foldMap' :: Monoid m => (a -> m) -> Proxy a -> m # foldr :: (a -> b -> b) -> b -> Proxy a -> b # foldr' :: (a -> b -> b) -> b -> Proxy a -> b # foldl :: (b -> a -> b) -> b -> Proxy a -> b # foldl' :: (b -> a -> b) -> b -> Proxy a -> b # foldr1 :: (a -> a -> a) -> Proxy a -> a # foldl1 :: (a -> a -> a) -> Proxy a -> a # elem :: Eq a => a -> Proxy a -> Bool # maximum :: Ord a => Proxy a -> a # minimum :: Ord a => Proxy a -> a # | |
| Foldable (U1 :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => U1 m -> m # foldMap :: Monoid m => (a -> m) -> U1 a -> m # foldMap' :: Monoid m => (a -> m) -> U1 a -> m # foldr :: (a -> b -> b) -> b -> U1 a -> b # foldr' :: (a -> b -> b) -> b -> U1 a -> b # foldl :: (b -> a -> b) -> b -> U1 a -> b # foldl' :: (b -> a -> b) -> b -> U1 a -> b # foldr1 :: (a -> a -> a) -> U1 a -> a # foldl1 :: (a -> a -> a) -> U1 a -> a # elem :: Eq a => a -> U1 a -> Bool # maximum :: Ord a => U1 a -> a # | |
| Foldable (UAddr :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UAddr m -> m # foldMap :: Monoid m => (a -> m) -> UAddr a -> m # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m # foldr :: (a -> b -> b) -> b -> UAddr a -> b # foldr' :: (a -> b -> b) -> b -> UAddr a -> b # foldl :: (b -> a -> b) -> b -> UAddr a -> b # foldl' :: (b -> a -> b) -> b -> UAddr a -> b # foldr1 :: (a -> a -> a) -> UAddr a -> a # foldl1 :: (a -> a -> a) -> UAddr a -> a # elem :: Eq a => a -> UAddr a -> Bool # maximum :: Ord a => UAddr a -> a # minimum :: Ord a => UAddr a -> a # | |
| Foldable (UChar :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |
| Foldable (UDouble :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |
| Foldable (UFloat :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UFloat m -> m # foldMap :: Monoid m => (a -> m) -> UFloat a -> m # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m # foldr :: (a -> b -> b) -> b -> UFloat a -> b # foldr' :: (a -> b -> b) -> b -> UFloat a -> b # foldl :: (b -> a -> b) -> b -> UFloat a -> b # foldl' :: (b -> a -> b) -> b -> UFloat a -> b # foldr1 :: (a -> a -> a) -> UFloat a -> a # foldl1 :: (a -> a -> a) -> UFloat a -> a # elem :: Eq a => a -> UFloat a -> Bool # maximum :: Ord a => UFloat a -> a # minimum :: Ord a => UFloat a -> a # | |
| Foldable (UInt :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UInt m -> m # foldMap :: Monoid m => (a -> m) -> UInt a -> m # foldMap' :: Monoid m => (a -> m) -> UInt a -> m # foldr :: (a -> b -> b) -> b -> UInt a -> b # foldr' :: (a -> b -> b) -> b -> UInt a -> b # foldl :: (b -> a -> b) -> b -> UInt a -> b # foldl' :: (b -> a -> b) -> b -> UInt a -> b # foldr1 :: (a -> a -> a) -> UInt a -> a # foldl1 :: (a -> a -> a) -> UInt a -> a # elem :: Eq a => a -> UInt a -> Bool # maximum :: Ord a => UInt a -> a # | |
| Foldable (UWord :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UWord m -> m # foldMap :: Monoid m => (a -> m) -> UWord a -> m # foldMap' :: Monoid m => (a -> m) -> UWord a -> m # foldr :: (a -> b -> b) -> b -> UWord a -> b # foldr' :: (a -> b -> b) -> b -> UWord a -> b # foldl :: (b -> a -> b) -> b -> UWord a -> b # foldl' :: (b -> a -> b) -> b -> UWord a -> b # foldr1 :: (a -> a -> a) -> UWord a -> a # foldl1 :: (a -> a -> a) -> UWord a -> a # elem :: Eq a => a -> UWord a -> Bool # maximum :: Ord a => UWord a -> a # minimum :: Ord a => UWord a -> a # | |
| Foldable (V1 :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => V1 m -> m # foldMap :: Monoid m => (a -> m) -> V1 a -> m # foldMap' :: Monoid m => (a -> m) -> V1 a -> m # foldr :: (a -> b -> b) -> b -> V1 a -> b # foldr' :: (a -> b -> b) -> b -> V1 a -> b # foldl :: (b -> a -> b) -> b -> V1 a -> b # foldl' :: (b -> a -> b) -> b -> V1 a -> b # foldr1 :: (a -> a -> a) -> V1 a -> a # foldl1 :: (a -> a -> a) -> V1 a -> a # elem :: Eq a => a -> V1 a -> Bool # maximum :: Ord a => V1 a -> a # | |
| Foldable f => Foldable (Lift f) | |
Defined in Control.Applicative.Lift Methods fold :: Monoid m => Lift f m -> m # foldMap :: Monoid m => (a -> m) -> Lift f a -> m # foldMap' :: Monoid m => (a -> m) -> Lift f a -> m # foldr :: (a -> b -> b) -> b -> Lift f a -> b # foldr' :: (a -> b -> b) -> b -> Lift f a -> b # foldl :: (b -> a -> b) -> b -> Lift f a -> b # foldl' :: (b -> a -> b) -> b -> Lift f a -> b # foldr1 :: (a -> a -> a) -> Lift f a -> a # foldl1 :: (a -> a -> a) -> Lift f a -> a # elem :: Eq a => a -> Lift f a -> Bool # maximum :: Ord a => Lift f a -> a # minimum :: Ord a => Lift f a -> a # | |
| Foldable f => Foldable (MaybeT f) | |
Defined in Control.Monad.Trans.Maybe Methods fold :: Monoid m => MaybeT f m -> m # foldMap :: Monoid m => (a -> m) -> MaybeT f a -> m # foldMap' :: Monoid m => (a -> m) -> MaybeT f a -> m # foldr :: (a -> b -> b) -> b -> MaybeT f a -> b # foldr' :: (a -> b -> b) -> b -> MaybeT f a -> b # foldl :: (b -> a -> b) -> b -> MaybeT f a -> b # foldl' :: (b -> a -> b) -> b -> MaybeT f a -> b # foldr1 :: (a -> a -> a) -> MaybeT f a -> a # foldl1 :: (a -> a -> a) -> MaybeT f a -> a # elem :: Eq a => a -> MaybeT f a -> Bool # maximum :: Ord a => MaybeT f a -> a # minimum :: Ord a => MaybeT f a -> a # | |
| Foldable (HashMap k) | |
Defined in Data.HashMap.Internal Methods fold :: Monoid m => HashMap k m -> m # foldMap :: Monoid m => (a -> m) -> HashMap k a -> m # foldMap' :: Monoid m => (a -> m) -> HashMap k a -> m # foldr :: (a -> b -> b) -> b -> HashMap k a -> b # foldr' :: (a -> b -> b) -> b -> HashMap k a -> b # foldl :: (b -> a -> b) -> b -> HashMap k a -> b # foldl' :: (b -> a -> b) -> b -> HashMap k a -> b # foldr1 :: (a -> a -> a) -> HashMap k a -> a # foldl1 :: (a -> a -> a) -> HashMap k a -> a # toList :: HashMap k a -> [a] # length :: HashMap k a -> Int # elem :: Eq a => a -> HashMap k a -> Bool # maximum :: Ord a => HashMap k a -> a # minimum :: Ord a => HashMap k a -> a # | |
| Foldable ((,) a) | @since base-4.7.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => (a, m) -> m # foldMap :: Monoid m => (a0 -> m) -> (a, a0) -> m # foldMap' :: Monoid m => (a0 -> m) -> (a, a0) -> m # foldr :: (a0 -> b -> b) -> b -> (a, a0) -> b # foldr' :: (a0 -> b -> b) -> b -> (a, a0) -> b # foldl :: (b -> a0 -> b) -> b -> (a, a0) -> b # foldl' :: (b -> a0 -> b) -> b -> (a, a0) -> b # foldr1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 # foldl1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 # elem :: Eq a0 => a0 -> (a, a0) -> Bool # maximum :: Ord a0 => (a, a0) -> a0 # minimum :: Ord a0 => (a, a0) -> a0 # | |
| Foldable f => Foldable (Ap f) | @since base-4.12.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Ap f m -> m # foldMap :: Monoid m => (a -> m) -> Ap f a -> m # foldMap' :: Monoid m => (a -> m) -> Ap f a -> m # foldr :: (a -> b -> b) -> b -> Ap f a -> b # foldr' :: (a -> b -> b) -> b -> Ap f a -> b # foldl :: (b -> a -> b) -> b -> Ap f a -> b # foldl' :: (b -> a -> b) -> b -> Ap f a -> b # foldr1 :: (a -> a -> a) -> Ap f a -> a # foldl1 :: (a -> a -> a) -> Ap f a -> a # elem :: Eq a => a -> Ap f a -> Bool # maximum :: Ord a => Ap f a -> a # | |
| Foldable f => Foldable (Alt f) | @since base-4.12.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Alt f m -> m # foldMap :: Monoid m => (a -> m) -> Alt f a -> m # foldMap' :: Monoid m => (a -> m) -> Alt f a -> m # foldr :: (a -> b -> b) -> b -> Alt f a -> b # foldr' :: (a -> b -> b) -> b -> Alt f a -> b # foldl :: (b -> a -> b) -> b -> Alt f a -> b # foldl' :: (b -> a -> b) -> b -> Alt f a -> b # foldr1 :: (a -> a -> a) -> Alt f a -> a # foldl1 :: (a -> a -> a) -> Alt f a -> a # elem :: Eq a => a -> Alt f a -> Bool # maximum :: Ord a => Alt f a -> a # minimum :: Ord a => Alt f a -> a # | |
| Foldable f => Foldable (Rec1 f) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Rec1 f m -> m # foldMap :: Monoid m => (a -> m) -> Rec1 f a -> m # foldMap' :: Monoid m => (a -> m) -> Rec1 f a -> m # foldr :: (a -> b -> b) -> b -> Rec1 f a -> b # foldr' :: (a -> b -> b) -> b -> Rec1 f a -> b # foldl :: (b -> a -> b) -> b -> Rec1 f a -> b # foldl' :: (b -> a -> b) -> b -> Rec1 f a -> b # foldr1 :: (a -> a -> a) -> Rec1 f a -> a # foldl1 :: (a -> a -> a) -> Rec1 f a -> a # elem :: Eq a => a -> Rec1 f a -> Bool # maximum :: Ord a => Rec1 f a -> a # minimum :: Ord a => Rec1 f a -> a # | |
| Foldable f => Foldable (Backwards f) | Derived instance. |
Defined in Control.Applicative.Backwards Methods fold :: Monoid m => Backwards f m -> m # foldMap :: Monoid m => (a -> m) -> Backwards f a -> m # foldMap' :: Monoid m => (a -> m) -> Backwards f a -> m # foldr :: (a -> b -> b) -> b -> Backwards f a -> b # foldr' :: (a -> b -> b) -> b -> Backwards f a -> b # foldl :: (b -> a -> b) -> b -> Backwards f a -> b # foldl' :: (b -> a -> b) -> b -> Backwards f a -> b # foldr1 :: (a -> a -> a) -> Backwards f a -> a # foldl1 :: (a -> a -> a) -> Backwards f a -> a # toList :: Backwards f a -> [a] # null :: Backwards f a -> Bool # length :: Backwards f a -> Int # elem :: Eq a => a -> Backwards f a -> Bool # maximum :: Ord a => Backwards f a -> a # minimum :: Ord a => Backwards f a -> a # | |
| Foldable f => Foldable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except Methods fold :: Monoid m => ExceptT e f m -> m # foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m # foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b # foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b # foldr1 :: (a -> a -> a) -> ExceptT e f a -> a # foldl1 :: (a -> a -> a) -> ExceptT e f a -> a # toList :: ExceptT e f a -> [a] # null :: ExceptT e f a -> Bool # length :: ExceptT e f a -> Int # elem :: Eq a => a -> ExceptT e f a -> Bool # maximum :: Ord a => ExceptT e f a -> a # minimum :: Ord a => ExceptT e f a -> a # | |
| Foldable f => Foldable (IdentityT f) | |
Defined in Control.Monad.Trans.Identity Methods fold :: Monoid m => IdentityT f m -> m # foldMap :: Monoid m => (a -> m) -> IdentityT f a -> m # foldMap' :: Monoid m => (a -> m) -> IdentityT f a -> m # foldr :: (a -> b -> b) -> b -> IdentityT f a -> b # foldr' :: (a -> b -> b) -> b -> IdentityT f a -> b # foldl :: (b -> a -> b) -> b -> IdentityT f a -> b # foldl' :: (b -> a -> b) -> b -> IdentityT f a -> b # foldr1 :: (a -> a -> a) -> IdentityT f a -> a # foldl1 :: (a -> a -> a) -> IdentityT f a -> a # toList :: IdentityT f a -> [a] # null :: IdentityT f a -> Bool # length :: IdentityT f a -> Int # elem :: Eq a => a -> IdentityT f a -> Bool # maximum :: Ord a => IdentityT f a -> a # minimum :: Ord a => IdentityT f a -> a # | |
| Foldable f => Foldable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Lazy Methods fold :: Monoid m => WriterT w f m -> m # foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m # foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m # foldr :: (a -> b -> b) -> b -> WriterT w f a -> b # foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b # foldl :: (b -> a -> b) -> b -> WriterT w f a -> b # foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b # foldr1 :: (a -> a -> a) -> WriterT w f a -> a # foldl1 :: (a -> a -> a) -> WriterT w f a -> a # toList :: WriterT w f a -> [a] # null :: WriterT w f a -> Bool # length :: WriterT w f a -> Int # elem :: Eq a => a -> WriterT w f a -> Bool # maximum :: Ord a => WriterT w f a -> a # minimum :: Ord a => WriterT w f a -> a # | |
| Foldable f => Foldable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Strict Methods fold :: Monoid m => WriterT w f m -> m # foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m # foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m # foldr :: (a -> b -> b) -> b -> WriterT w f a -> b # foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b # foldl :: (b -> a -> b) -> b -> WriterT w f a -> b # foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b # foldr1 :: (a -> a -> a) -> WriterT w f a -> a # foldl1 :: (a -> a -> a) -> WriterT w f a -> a # toList :: WriterT w f a -> [a] # null :: WriterT w f a -> Bool # length :: WriterT w f a -> Int # elem :: Eq a => a -> WriterT w f a -> Bool # maximum :: Ord a => WriterT w f a -> a # minimum :: Ord a => WriterT w f a -> a # | |
| Foldable (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant Methods fold :: Monoid m => Constant a m -> m # foldMap :: Monoid m => (a0 -> m) -> Constant a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Constant a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Constant a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Constant a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Constant a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Constant a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 # toList :: Constant a a0 -> [a0] # null :: Constant a a0 -> Bool # length :: Constant a a0 -> Int # elem :: Eq a0 => a0 -> Constant a a0 -> Bool # maximum :: Ord a0 => Constant a a0 -> a0 # minimum :: Ord a0 => Constant a a0 -> a0 # | |
| Foldable f => Foldable (Reverse f) | Fold from right to left. |
Defined in Data.Functor.Reverse Methods fold :: Monoid m => Reverse f m -> m # foldMap :: Monoid m => (a -> m) -> Reverse f a -> m # foldMap' :: Monoid m => (a -> m) -> Reverse f a -> m # foldr :: (a -> b -> b) -> b -> Reverse f a -> b # foldr' :: (a -> b -> b) -> b -> Reverse f a -> b # foldl :: (b -> a -> b) -> b -> Reverse f a -> b # foldl' :: (b -> a -> b) -> b -> Reverse f a -> b # foldr1 :: (a -> a -> a) -> Reverse f a -> a # foldl1 :: (a -> a -> a) -> Reverse f a -> a # toList :: Reverse f a -> [a] # length :: Reverse f a -> Int # elem :: Eq a => a -> Reverse f a -> Bool # maximum :: Ord a => Reverse f a -> a # minimum :: Ord a => Reverse f a -> a # | |
| (Foldable f, Foldable g) => Foldable (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product Methods fold :: Monoid m => Product f g m -> m # foldMap :: Monoid m => (a -> m) -> Product f g a -> m # foldMap' :: Monoid m => (a -> m) -> Product f g a -> m # foldr :: (a -> b -> b) -> b -> Product f g a -> b # foldr' :: (a -> b -> b) -> b -> Product f g a -> b # foldl :: (b -> a -> b) -> b -> Product f g a -> b # foldl' :: (b -> a -> b) -> b -> Product f g a -> b # foldr1 :: (a -> a -> a) -> Product f g a -> a # foldl1 :: (a -> a -> a) -> Product f g a -> a # toList :: Product f g a -> [a] # null :: Product f g a -> Bool # length :: Product f g a -> Int # elem :: Eq a => a -> Product f g a -> Bool # maximum :: Ord a => Product f g a -> a # minimum :: Ord a => Product f g a -> a # | |
| (Foldable f, Foldable g) => Foldable (Sum f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Sum Methods fold :: Monoid m => Sum f g m -> m # foldMap :: Monoid m => (a -> m) -> Sum f g a -> m # foldMap' :: Monoid m => (a -> m) -> Sum f g a -> m # foldr :: (a -> b -> b) -> b -> Sum f g a -> b # foldr' :: (a -> b -> b) -> b -> Sum f g a -> b # foldl :: (b -> a -> b) -> b -> Sum f g a -> b # foldl' :: (b -> a -> b) -> b -> Sum f g a -> b # foldr1 :: (a -> a -> a) -> Sum f g a -> a # foldl1 :: (a -> a -> a) -> Sum f g a -> a # elem :: Eq a => a -> Sum f g a -> Bool # maximum :: Ord a => Sum f g a -> a # minimum :: Ord a => Sum f g a -> a # | |
| (Foldable f, Foldable g) => Foldable (f :*: g) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
| (Foldable f, Foldable g) => Foldable (f :+: g) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => (f :+: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldr1 :: (a -> a -> a) -> (f :+: g) a -> a # foldl1 :: (a -> a -> a) -> (f :+: g) a -> a # toList :: (f :+: g) a -> [a] # length :: (f :+: g) a -> Int # elem :: Eq a => a -> (f :+: g) a -> Bool # maximum :: Ord a => (f :+: g) a -> a # minimum :: Ord a => (f :+: g) a -> a # | |
| Foldable (K1 i c :: Type -> Type) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => K1 i c m -> m # foldMap :: Monoid m => (a -> m) -> K1 i c a -> m # foldMap' :: Monoid m => (a -> m) -> K1 i c a -> m # foldr :: (a -> b -> b) -> b -> K1 i c a -> b # foldr' :: (a -> b -> b) -> b -> K1 i c a -> b # foldl :: (b -> a -> b) -> b -> K1 i c a -> b # foldl' :: (b -> a -> b) -> b -> K1 i c a -> b # foldr1 :: (a -> a -> a) -> K1 i c a -> a # foldl1 :: (a -> a -> a) -> K1 i c a -> a # elem :: Eq a => a -> K1 i c a -> Bool # maximum :: Ord a => K1 i c a -> a # minimum :: Ord a => K1 i c a -> a # | |
| (Foldable f, Foldable g) => Foldable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose Methods fold :: Monoid m => Compose f g m -> m # foldMap :: Monoid m => (a -> m) -> Compose f g a -> m # foldMap' :: Monoid m => (a -> m) -> Compose f g a -> m # foldr :: (a -> b -> b) -> b -> Compose f g a -> b # foldr' :: (a -> b -> b) -> b -> Compose f g a -> b # foldl :: (b -> a -> b) -> b -> Compose f g a -> b # foldl' :: (b -> a -> b) -> b -> Compose f g a -> b # foldr1 :: (a -> a -> a) -> Compose f g a -> a # foldl1 :: (a -> a -> a) -> Compose f g a -> a # toList :: Compose f g a -> [a] # null :: Compose f g a -> Bool # length :: Compose f g a -> Int # elem :: Eq a => a -> Compose f g a -> Bool # maximum :: Ord a => Compose f g a -> a # minimum :: Ord a => Compose f g a -> a # | |
| (Foldable f, Foldable g) => Foldable (f :.: g) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => (f :.: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :.: g) a -> m # foldMap' :: Monoid m => (a -> m) -> (f :.: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :.: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :.: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :.: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :.: g) a -> b # foldr1 :: (a -> a -> a) -> (f :.: g) a -> a # foldl1 :: (a -> a -> a) -> (f :.: g) a -> a # toList :: (f :.: g) a -> [a] # length :: (f :.: g) a -> Int # elem :: Eq a => a -> (f :.: g) a -> Bool # maximum :: Ord a => (f :.: g) a -> a # minimum :: Ord a => (f :.: g) a -> a # | |
| Foldable f => Foldable (M1 i c f) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => M1 i c f m -> m # foldMap :: Monoid m => (a -> m) -> M1 i c f a -> m # foldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m # foldr :: (a -> b -> b) -> b -> M1 i c f a -> b # foldr' :: (a -> b -> b) -> b -> M1 i c f a -> b # foldl :: (b -> a -> b) -> b -> M1 i c f a -> b # foldl' :: (b -> a -> b) -> b -> M1 i c f a -> b # foldr1 :: (a -> a -> a) -> M1 i c f a -> a # foldl1 :: (a -> a -> a) -> M1 i c f a -> a # elem :: Eq a => a -> M1 i c f a -> Bool # maximum :: Ord a => M1 i c f a -> a # minimum :: Ord a => M1 i c f a -> a # | |
asum :: (Foldable t, Alternative f) => t (f a) -> f a #
The sum of a collection of actions using (<|>), generalizing concat.
asum is just like msum, but generalised to Alternative.
Examples
Basic usage:
>>>asum [Just "Hello", Nothing, Just "World"]Just "Hello"
class (Functor t, Foldable t) => Traversable (t :: Type -> Type) #
Functors representing data structures that can be transformed to
structures of the same shape by performing an Applicative (or,
therefore, Monad) action on each element from left to right.
A more detailed description of what same shape means, the various methods, how traversals are constructed, and example advanced use-cases can be found in the Overview section of Data.Traversable.
For the class laws see the Laws section of Data.Traversable.
Instances
| Traversable Complex | Since: base-4.9.0.0 |
| Traversable First | Since: base-4.9.0.0 |
| Traversable Last | Since: base-4.9.0.0 |
| Traversable Max | Since: base-4.9.0.0 |
| Traversable Min | Since: base-4.9.0.0 |
| Traversable SCC | Since: containers-0.5.9 |
| Traversable IntMap | Traverses in order of increasing key. |
| Traversable Digit | |
| Traversable Elem | |
| Traversable FingerTree | |
Defined in Data.Sequence.Internal Methods traverse :: Applicative f => (a -> f b) -> FingerTree a -> f (FingerTree b) # sequenceA :: Applicative f => FingerTree (f a) -> f (FingerTree a) # mapM :: Monad m => (a -> m b) -> FingerTree a -> m (FingerTree b) # sequence :: Monad m => FingerTree (m a) -> m (FingerTree a) # | |
| Traversable Node | |
| Traversable Seq | |
| Traversable ViewL | |
| Traversable ViewR | |
| Traversable Tree | |
| Traversable NonEmpty | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable Identity | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable First | @since base-4.8.0.0 |
| Traversable Last | @since base-4.8.0.0 |
| Traversable Down | @since base-4.12.0.0 |
| Traversable Dual | @since base-4.8.0.0 |
| Traversable Product | @since base-4.8.0.0 |
| Traversable Sum | @since base-4.8.0.0 |
| Traversable Par1 | @since base-4.9.0.0 |
| Traversable Array | |
| Traversable SmallArray | |
Defined in Data.Primitive.SmallArray Methods traverse :: Applicative f => (a -> f b) -> SmallArray a -> f (SmallArray b) # sequenceA :: Applicative f => SmallArray (f a) -> f (SmallArray a) # mapM :: Monad m => (a -> m b) -> SmallArray a -> m (SmallArray b) # sequence :: Monad m => SmallArray (m a) -> m (SmallArray a) # | |
| Traversable Vector | |
| Traversable Vector | |
Defined in Data.Vector.Strict | |
| Traversable Maybe | @since base-2.01 |
| Traversable Solo | @since base-4.15 |
| Traversable [] | @since base-2.01 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (Arg a) | Since: base-4.9.0.0 |
| Traversable (Map k) | Traverses in order of increasing key. |
| Ix i => Traversable (Array i) | @since base-2.01 |
| Traversable (Either a) | @since base-4.7.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (Proxy :: Type -> Type) | @since base-4.7.0.0 |
| Traversable (U1 :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (UAddr :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (UChar :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (UDouble :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (UFloat :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (UInt :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (UWord :: Type -> Type) | @since base-4.9.0.0 |
| Traversable (V1 :: Type -> Type) | @since base-4.9.0.0 |
| Traversable f => Traversable (Lift f) | |
| Traversable f => Traversable (MaybeT f) | |
Defined in Control.Monad.Trans.Maybe | |
| Traversable (HashMap k) | |
Defined in Data.HashMap.Internal | |
| Traversable ((,) a) | @since base-4.7.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (Const m :: Type -> Type) | @since base-4.7.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable f => Traversable (Ap f) | @since base-4.12.0.0 |
| Traversable f => Traversable (Alt f) | @since base-4.12.0.0 |
| Traversable f => Traversable (Rec1 f) | @since base-4.9.0.0 |
| Traversable f => Traversable (Backwards f) | Derived instance. |
Defined in Control.Applicative.Backwards | |
| Traversable f => Traversable (ExceptT e f) | |
Defined in Control.Monad.Trans.Except | |
| Traversable f => Traversable (IdentityT f) | |
Defined in Control.Monad.Trans.Identity | |
| Traversable f => Traversable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Lazy | |
| Traversable f => Traversable (WriterT w f) | |
Defined in Control.Monad.Trans.Writer.Strict | |
| Traversable (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
| Traversable f => Traversable (Reverse f) | Traverse from right to left. |
Defined in Data.Functor.Reverse | |
| (Traversable f, Traversable g) => Traversable (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product | |
| (Traversable f, Traversable g) => Traversable (Sum f g) | Since: base-4.9.0.0 |
| (Traversable f, Traversable g) => Traversable (f :*: g) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| (Traversable f, Traversable g) => Traversable (f :+: g) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable (K1 i c :: Type -> Type) | @since base-4.9.0.0 |
| (Traversable f, Traversable g) => Traversable (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
| (Traversable f, Traversable g) => Traversable (f :.: g) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
| Traversable f => Traversable (M1 i c f) | @since base-4.9.0.0 |
Defined in GHC.Internal.Data.Traversable | |
arrow
first :: Arrow a => a b c -> a (b, d) (c, d) #
Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.
second :: Arrow a => a b c -> a (d, b) (d, c) #
A mirror image of first.
The default definition may be overridden with a more efficient version if desired.
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c') infixr 3 #
Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 #
Fanout: send the input to both argument arrows and combine their output.
The default definition may be overridden with a more efficient version if desired.
Bool
Case analysis for the Bool type. evaluates to bool f t pf
when p is False, and evaluates to t when p is True.
This is equivalent to if p then t else f; that is, one can
think of it as an if-then-else construct with its arguments
reordered.
@since base-4.7.0.0
Examples
Basic usage:
>>>bool "foo" "bar" True"bar">>>bool "foo" "bar" False"foo"
Confirm that and bool f t pif p then t else f are
equivalent:
>>>let p = True; f = "bar"; t = "foo">>>bool f t p == if p then t else fTrue>>>let p = False>>>bool f t p == if p then t else fTrue
Maybe
mapMaybe :: (a -> Maybe b) -> [a] -> [b] #
The mapMaybe function is a version of map which can throw
out elements. In particular, the functional argument returns
something of type . If this is Maybe bNothing, no element
is added on to the result list. If it is , then Just bb is
included in the result list.
Examples
Using is a shortcut for mapMaybe f x
in most cases:catMaybes $ map f x
>>>import GHC.Internal.Text.Read ( readMaybe )>>>let readMaybeInt = readMaybe :: String -> Maybe Int>>>mapMaybe readMaybeInt ["1", "Foo", "3"][1,3]>>>catMaybes $ map readMaybeInt ["1", "Foo", "3"][1,3]
If we map the Just constructor, the entire list should be returned:
>>>mapMaybe Just [1,2,3][1,2,3]
catMaybes :: [Maybe a] -> [a] #
The catMaybes function takes a list of Maybes and returns
a list of all the Just values.
Examples
Basic usage:
>>>catMaybes [Just 1, Nothing, Just 3][1,3]
When constructing a list of Maybe values, catMaybes can be used
to return all of the "success" results (if the list is the result
of a map, then mapMaybe would be more appropriate):
>>>import GHC.Internal.Text.Read ( readMaybe )>>>[readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ][Just 1,Nothing,Just 3]>>>catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ][1,3]
fromMaybe :: a -> Maybe a -> a #
The fromMaybe function takes a default value and a Maybe
value. If the Maybe is Nothing, it returns the default value;
otherwise, it returns the value contained in the Maybe.
Examples
Basic usage:
>>>fromMaybe "" (Just "Hello, World!")"Hello, World!"
>>>fromMaybe "" Nothing""
Read an integer from a string using readMaybe. If we fail to
parse an integer, we want to return 0 by default:
>>>import GHC.Internal.Text.Read ( readMaybe )>>>fromMaybe 0 (readMaybe "5")5>>>fromMaybe 0 (readMaybe "")0
listToMaybe :: [a] -> Maybe a #
The listToMaybe function returns Nothing on an empty list
or where Just aa is the first element of the list.
Examples
Basic usage:
>>>listToMaybe []Nothing
>>>listToMaybe [9]Just 9
>>>listToMaybe [1,2,3]Just 1
Composing maybeToList with listToMaybe should be the identity
on singleton/empty lists:
>>>maybeToList $ listToMaybe [5][5]>>>maybeToList $ listToMaybe [][]
But not on lists with more than one element:
>>>maybeToList $ listToMaybe [1,2,3][1]
maybeToList :: Maybe a -> [a] #
The maybeToList function returns an empty list when given
Nothing or a singleton list when given Just.
Examples
Basic usage:
>>>maybeToList (Just 7)[7]
>>>maybeToList Nothing[]
One can use maybeToList to avoid pattern matching when combined
with a function that (safely) works on lists:
>>>import GHC.Internal.Text.Read ( readMaybe )>>>sum $ maybeToList (readMaybe "3")3>>>sum $ maybeToList (readMaybe "")0
Either
partitionEithers :: [Either a b] -> ([a], [b]) #
Partitions a list of Either into two lists.
All the Left elements are extracted, in order, to the first
component of the output. Similarly the Right elements are extracted
to the second component of the output.
Examples
Basic usage:
>>>let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]>>>partitionEithers list(["foo","bar","baz"],[3,7])
The pair returned by should be the same
pair as partitionEithers x(:lefts x, rights x)
>>>let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]>>>partitionEithers list == (lefts list, rights list)True
Ord
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 #
runs the binary function on b u x yb on the results of applying
unary function u to two arguments x and y. From the opposite
perspective, it transforms two inputs and combines the outputs.
(op `on` f) x y = f x `op` f y
Examples
>>>sortBy (compare `on` length) [[0, 1, 2], [0, 1], [], [0]][[],[0],[0,1],[0,1,2]]
>>>((+) `on` length) [1, 2, 3] [-1]4
>>>((,) `on` (*2)) 2 3(4,6)
Algebraic properties
comparing :: Ord a => (b -> a) -> b -> b -> Ordering #
comparing p x y = compare (p x) (p y)
Useful combinator for use in conjunction with the xxxBy family
of functions from Data.List, for example:
... sortBy (comparing fst) ...
The Down type allows you to reverse sort order conveniently. A value of type
contains a value of type Down aa (represented as ).Down a
If a has an instance associated with it then comparing two
values thus wrapped will give you the opposite of their normal sort order.
This is particularly useful when sorting in generalised list comprehensions,
as in: Ordthen sortWith by .Down x
>>>compare True FalseGT
>>>compare (Down True) (Down False)LT
If a has a instance then the wrapped instance also respects
the reversed ordering by exchanging the values of Bounded and
minBound.maxBound
>>>minBound :: Int-9223372036854775808
>>>minBound :: Down IntDown 9223372036854775807
All other instances of behave as they do for Down aa.
@since base-4.6.0.0
Instances
| MonadZip Down | Since: base-4.12.0.0 | ||||
| Foldable1 Down | Since: base-4.18.0.0 | ||||
Defined in Data.Foldable1 Methods fold1 :: Semigroup m => Down m -> m # foldMap1 :: Semigroup m => (a -> m) -> Down a -> m # foldMap1' :: Semigroup m => (a -> m) -> Down a -> m # toNonEmpty :: Down a -> NonEmpty a # maximum :: Ord a => Down a -> a # minimum :: Ord a => Down a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> Down a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> Down a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> Down a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> Down a -> b # | |||||
| Eq1 Down | Since: base-4.12.0.0 | ||||
| Ord1 Down | Since: base-4.12.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Read1 Down | Since: base-4.12.0.0 | ||||
Defined in Data.Functor.Classes | |||||
| Show1 Down | Since: base-4.12.0.0 | ||||
| Applicative Down | @since base-4.11.0.0 | ||||
| Functor Down | @since base-4.11.0.0 | ||||
| Monad Down | @since base-4.11.0.0 | ||||
| Foldable Down | @since base-4.12.0.0 | ||||
Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => Down m -> m # foldMap :: Monoid m => (a -> m) -> Down a -> m # foldMap' :: Monoid m => (a -> m) -> Down a -> m # foldr :: (a -> b -> b) -> b -> Down a -> b # foldr' :: (a -> b -> b) -> b -> Down a -> b # foldl :: (b -> a -> b) -> b -> Down a -> b # foldl' :: (b -> a -> b) -> b -> Down a -> b # foldr1 :: (a -> a -> a) -> Down a -> a # foldl1 :: (a -> a -> a) -> Down a -> a # elem :: Eq a => a -> Down a -> Bool # maximum :: Ord a => Down a -> a # | |||||
| Traversable Down | @since base-4.12.0.0 | ||||
| Generic1 Down | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Unbox a => Vector Vector (Down a) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicUnsafeFreeze :: Mutable Vector s (Down a) -> ST s (Vector (Down a)) basicUnsafeThaw :: Vector (Down a) -> ST s (Mutable Vector s (Down a)) basicLength :: Vector (Down a) -> Int basicUnsafeSlice :: Int -> Int -> Vector (Down a) -> Vector (Down a) basicUnsafeIndexM :: Vector (Down a) -> Int -> Box (Down a) basicUnsafeCopy :: Mutable Vector s (Down a) -> Vector (Down a) -> ST s () | |||||
| Unbox a => MVector MVector (Down a) | |||||
Defined in Data.Vector.Unboxed.Base Methods basicLength :: MVector s (Down a) -> Int basicUnsafeSlice :: Int -> Int -> MVector s (Down a) -> MVector s (Down a) basicOverlaps :: MVector s (Down a) -> MVector s (Down a) -> Bool basicUnsafeNew :: Int -> ST s (MVector s (Down a)) basicInitialize :: MVector s (Down a) -> ST s () basicUnsafeReplicate :: Int -> Down a -> ST s (MVector s (Down a)) basicUnsafeRead :: MVector s (Down a) -> Int -> ST s (Down a) basicUnsafeWrite :: MVector s (Down a) -> Int -> Down a -> ST s () basicClear :: MVector s (Down a) -> ST s () basicSet :: MVector s (Down a) -> Down a -> ST s () basicUnsafeCopy :: MVector s (Down a) -> MVector s (Down a) -> ST s () basicUnsafeMove :: MVector s (Down a) -> MVector s (Down a) -> ST s () basicUnsafeGrow :: MVector s (Down a) -> Int -> ST s (MVector s (Down a)) | |||||
| Monoid a => Monoid (Down a) | @since base-4.11.0.0 | ||||
| Semigroup a => Semigroup (Down a) | @since base-4.11.0.0 | ||||
| Bits a => Bits (Down a) | @since base-4.14.0.0 | ||||
Defined in GHC.Internal.Data.Ord Methods (.&.) :: Down a -> Down a -> Down a # (.|.) :: Down a -> Down a -> Down a # xor :: Down a -> Down a -> Down a # complement :: Down a -> Down a # shift :: Down a -> Int -> Down a # rotate :: Down a -> Int -> Down a # setBit :: Down a -> Int -> Down a # clearBit :: Down a -> Int -> Down a # complementBit :: Down a -> Int -> Down a # testBit :: Down a -> Int -> Bool # bitSizeMaybe :: Down a -> Maybe Int # shiftL :: Down a -> Int -> Down a # unsafeShiftL :: Down a -> Int -> Down a # shiftR :: Down a -> Int -> Down a # unsafeShiftR :: Down a -> Int -> Down a # rotateL :: Down a -> Int -> Down a # | |||||
| FiniteBits a => FiniteBits (Down a) | @since base-4.14.0.0 | ||||
Defined in GHC.Internal.Data.Ord Methods finiteBitSize :: Down a -> Int # countLeadingZeros :: Down a -> Int # countTrailingZeros :: Down a -> Int # | |||||
| Bounded a => Bounded (Down a) | Swaps @since base-4.14.0.0 | ||||
| (Enum a, Bounded a, Eq a) => Enum (Down a) | Swaps @since base-4.18.0.0 | ||||
Defined in GHC.Internal.Data.Ord | |||||
| Floating a => Floating (Down a) | @since base-4.14.0.0 | ||||
| RealFloat a => RealFloat (Down a) | @since base-4.14.0.0 | ||||
Defined in GHC.Internal.Data.Ord Methods floatRadix :: Down a -> Integer # floatDigits :: Down a -> Int # floatRange :: Down a -> (Int, Int) # decodeFloat :: Down a -> (Integer, Int) # encodeFloat :: Integer -> Int -> Down a # significand :: Down a -> Down a # scaleFloat :: Int -> Down a -> Down a # isInfinite :: Down a -> Bool # isDenormalized :: Down a -> Bool # isNegativeZero :: Down a -> Bool # | |||||
| Storable a => Storable (Down a) | @since base-4.14.0.0 | ||||
| Generic (Down a) | |||||
Defined in GHC.Internal.Generics Associated Types
| |||||
| Ix a => Ix (Down a) | @since base-4.14.0.0 | ||||
Defined in GHC.Internal.Data.Ord | |||||
| Num a => Num (Down a) | @since base-4.11.0.0 | ||||
| Read a => Read (Down a) | This instance would be equivalent to the derived instances of the
@since base-4.7.0.0 | ||||
| Fractional a => Fractional (Down a) | @since base-4.14.0.0 | ||||
| Real a => Real (Down a) | @since base-4.14.0.0 | ||||
Defined in GHC.Internal.Data.Ord Methods toRational :: Down a -> Rational # | |||||
| RealFrac a => RealFrac (Down a) | @since base-4.14.0.0 | ||||
| Show a => Show (Down a) | This instance would be equivalent to the derived instances of the
@since base-4.7.0.0 | ||||
| Eq a => Eq (Down a) | @since base-4.6.0.0 | ||||
| Ord a => Ord (Down a) | @since base-4.6.0.0 | ||||
| Unbox a => Unbox (Down a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep1 Down | @since base-4.12.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| newtype MVector s (Down a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
| type Rep (Down a) | @since base-4.12.0.0 | ||||
Defined in GHC.Internal.Generics | |||||
| newtype Vector (Down a) | |||||
Defined in Data.Vector.Unboxed.Base | |||||
Applicative
class Functor f => Applicative (f :: Type -> Type) where #
A functor with application, providing operations to
A minimal complete definition must include implementations of pure
and of either <*> or liftA2. If it defines both, then they must behave
the same as their default definitions:
(<*>) =liftA2id
liftA2f x y = f<$>x<*>y
Further, any definition must satisfy the following:
- Identity
pureid<*>v = v- Composition
pure(.)<*>u<*>v<*>w = u<*>(v<*>w)- Homomorphism
puref<*>purex =pure(f x)- Interchange
u
<*>purey =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
It may be useful to note that supposing
forall x y. p (q x y) = f x . g y
it follows from the above that
liftA2p (liftA2q u v) =liftA2f u .liftA2g v
If f is also a Monad, it should satisfy
(which implies that pure and <*> satisfy the applicative functor laws).
Methods
Lift a value into the Structure.
Examples
>>>pure 1 :: Maybe IntJust 1
>>>pure 'z' :: [Char]"z"
>>>pure (pure ":D") :: Maybe [String]Just [":D"]
(<*>) :: f (a -> b) -> f a -> f b infixl 4 #
Sequential application.
A few functors support an implementation of <*> that is more
efficient than the default one.
Example
Used in combination with , (<$>) can be used to build a record.(<*>)
>>>data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
>>>produceFoo :: Applicative f => f Foo>>>produceBar :: Applicative f => f Bar>>>produceBaz :: Applicative f => f Baz
>>>mkState :: Applicative f => f MyState>>>mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz
liftA2 :: (a -> b -> c) -> f a -> f b -> f c #
Lift a binary function to actions.
Some functors support an implementation of liftA2 that is more
efficient than the default one. In particular, if fmap is an
expensive operation, it is likely better to use liftA2 than to
fmap over the structure and then use <*>.
This became a typeclass method in 4.10.0.0. Prior to that, it was
a function defined in terms of <*> and fmap.
Example
>>>liftA2 (,) (Just 3) (Just 5)Just (3,5)
>>>liftA2 (+) [1, 2, 3] [4, 5, 6][5,6,7,6,7,8,7,8,9]
(*>) :: f a -> f b -> f b infixl 4 #
Sequence actions, discarding the value of the first argument.
Examples
If used in conjunction with the Applicative instance for Maybe,
you can chain Maybe computations, with a possible "early return"
in case of Nothing.
>>>Just 2 *> Just 3Just 3
>>>Nothing *> Just 3Nothing
Of course a more interesting use case would be to have effectful computations instead of just returning pure values.
>>>import Data.Char>>>import GHC.Internal.Text.ParserCombinators.ReadP>>>let p = string "my name is " *> munch1 isAlpha <* eof>>>readP_to_S p "my name is Simon"[("Simon","")]
(<*) :: f a -> f b -> f a infixl 4 #
Sequence actions, discarding the value of the second argument.
Instances
| Applicative Complex | Since: base-4.9.0.0 |
| Applicative First | Since: base-4.9.0.0 |
| Applicative Last | Since: base-4.9.0.0 |
| Applicative Max | Since: base-4.9.0.0 |
| Applicative Min | Since: base-4.9.0.0 |
| Applicative Put | |
| Applicative Seq | Since: containers-0.5.4 |
| Applicative Tree | |
| Applicative NonEmpty | @since base-4.9.0.0 |
| Applicative Down | @since base-4.11.0.0 |
| Applicative Par1 | @since base-4.9.0.0 |
| Applicative P | @since base-4.5.0.0 |
| Applicative ReadP | @since base-4.6.0.0 |
| Applicative IO | @since base-2.01 |
| Applicative Array | |
| Applicative SmallArray | |
Defined in Data.Primitive.SmallArray Methods pure :: a -> SmallArray a # (<*>) :: SmallArray (a -> b) -> SmallArray a -> SmallArray b # liftA2 :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c # (*>) :: SmallArray a -> SmallArray b -> SmallArray b # (<*) :: SmallArray a -> SmallArray b -> SmallArray a # | |
| Applicative Vector | |
| Applicative Id | |
| Applicative Vector | |
| Applicative Maybe | @since base-2.01 |
| Applicative Solo | @since base-4.15 |
| Applicative [] | @since base-2.01 |
| Monad m => Applicative (WrappedMonad m) | Since: base-2.1 |
Defined in Control.Applicative Methods pure :: a -> WrappedMonad m a # (<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b # liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c # (*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # (<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a # | |
| Applicative (SetM s) | |
| Arrow a => Applicative (ArrowMonad a) | @since base-4.6.0.0 |
Defined in GHC.Internal.Control.Arrow Methods pure :: a0 -> ArrowMonad a a0 # (<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c # (*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b # (<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 # | |
| Applicative (Either e) | @since base-3.0 |
| Applicative (U1 :: Type -> Type) | @since base-4.9.0.0 |
| Applicative (IParser t) | |
| Applicative f => Applicative (Lift f) | A combination is |
| (Functor m, Monad m) => Applicative (MaybeT m) | |
| Monoid a => Applicative ((,) a) | For tuples, the ("hello ", (+15)) <*> ("world!", 2002)
("hello world!",2017)@since base-2.01 |
| Arrow a => Applicative (WrappedArrow a b) | Since: base-2.1 |
Defined in Control.Applicative Methods pure :: a0 -> WrappedArrow a b a0 # (<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c # (*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 # (<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 # | |
| (Applicative f, Monad f) => Applicative (WhenMissing f x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMissing f x a # (<*>) :: WhenMissing f x (a -> b) -> WhenMissing f x a -> WhenMissing f x b # liftA2 :: (a -> b -> c) -> WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x c # (*>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b # (<*) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x a # | |
| Applicative m => Applicative (Kleisli m a) | @since base-4.14.0.0 |
Defined in GHC.Internal.Control.Arrow | |
| (Generic1 f, Applicative (Rep1 f)) => Applicative (Generically1 f) | @since base-4.17.0.0 |
Defined in GHC.Internal.Generics Methods pure :: a -> Generically1 f a # (<*>) :: Generically1 f (a -> b) -> Generically1 f a -> Generically1 f b # liftA2 :: (a -> b -> c) -> Generically1 f a -> Generically1 f b -> Generically1 f c # (*>) :: Generically1 f a -> Generically1 f b -> Generically1 f b # (<*) :: Generically1 f a -> Generically1 f b -> Generically1 f a # | |
| Applicative f => Applicative (Rec1 f) | @since base-4.9.0.0 |
| Applicative f => Applicative (Backwards f) | Apply |
Defined in Control.Applicative.Backwards | |
| (Monoid w, Functor m, Monad m) => Applicative (AccumT w m) | |
Defined in Control.Monad.Trans.Accum | |
| (Functor m, Monad m) => Applicative (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| Applicative m => Applicative (IdentityT m) | |
Defined in Control.Monad.Trans.Identity | |
| Applicative m => Applicative (ReaderT r m) | |
Defined in Control.Monad.Trans.Reader | |
| (Functor m, Monad m) => Applicative (SelectT r m) | |
Defined in Control.Monad.Trans.Select | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| (Functor m, Monad m) => Applicative (StateT s m) | |
Defined in Control.Monad.Trans.State.Strict | |
| (Functor m, Monad m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.CPS | |
| (Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Lazy | |
| (Monoid w, Applicative m) => Applicative (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Strict | |
| Monoid a => Applicative (Constant a :: Type -> Type) | |
Defined in Data.Functor.Constant | |
| Applicative f => Applicative (Reverse f) | Derived instance. |
| (Monoid a, Monoid b) => Applicative ((,,) a b) | @since base-4.14.0.0 |
| (Applicative f, Applicative g) => Applicative (Product f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Product | |
| (Monad f, Applicative f) => Applicative (WhenMatched f x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.IntMap.Internal Methods pure :: a -> WhenMatched f x y a # (<*>) :: WhenMatched f x y (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b # liftA2 :: (a -> b -> c) -> WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y c # (*>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b # (<*) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y a # | |
| (Applicative f, Monad f) => Applicative (WhenMissing f k x) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods pure :: a -> WhenMissing f k x a # (<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b # liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c # (*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b # (<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a # | |
| (Applicative f, Applicative g) => Applicative (f :*: g) | @since base-4.9.0.0 |
| Monoid c => Applicative (K1 i c :: Type -> Type) | @since base-4.12.0.0 |
| Applicative (ContT r m) | |
Defined in Control.Monad.Trans.Cont | |
| (Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) | @since base-4.14.0.0 |
Defined in GHC.Internal.Base | |
| Applicative ((->) r) | @since base-2.01 |
| (Applicative f, Applicative g) => Applicative (Compose f g) | Since: base-4.9.0.0 |
Defined in Data.Functor.Compose | |
| (Monad f, Applicative f) => Applicative (WhenMatched f k x y) | Equivalent to Since: containers-0.5.9 |
Defined in Data.Map.Internal Methods pure :: a -> WhenMatched f k x y a # (<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b # liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c # (*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b # (<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a # | |
| (Applicative f, Applicative g) => Applicative (f :.: g) | @since base-4.9.0.0 |
| Applicative f => Applicative (M1 i c f) | @since base-4.9.0.0 |
| (Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.CPS | |
| (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Lazy | |
| (Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Strict | |
(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #
An infix synonym for fmap.
The name of this operator is an allusion to $.
Note the similarities between their types:
($) :: (a -> b) -> a -> b (<$>) :: Functor f => (a -> b) -> f a -> f b
Whereas $ is function application, <$> is function
application lifted over a Functor.
Examples
Convert from a to a Maybe Int using Maybe
Stringshow:
>>>show <$> NothingNothing
>>>show <$> Just 3Just "3"
Convert from an to an
Either Int IntEither IntString using show:
>>>show <$> Left 17Left 17
>>>show <$> Right 17Right "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)
(<|>) :: Alternative f => f a -> f a -> f a infixl 3 #
An associative binary operation
Monad
Transformers
lift :: (MonadTrans t, Monad m) => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.
class Monad m => MonadIO (m :: Type -> Type) #
Monads in which IO computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Minimal complete definition
Instances
| MonadIO IO | Since: base-4.9.0.0 |
Defined in Control.Monad.IO.Class | |
| MonadIO m => MonadIO (MaybeT m) | |
Defined in Control.Monad.Trans.Maybe | |
| (Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) | |
Defined in Control.Monad.Trans.Accum | |
| MonadIO m => MonadIO (ExceptT e m) | |
Defined in Control.Monad.Trans.Except | |
| MonadIO m => MonadIO (IdentityT m) | |
Defined in Control.Monad.Trans.Identity | |
| MonadIO m => MonadIO (ReaderT r m) | |
Defined in Control.Monad.Trans.Reader | |
| MonadIO m => MonadIO (SelectT r m) | |
Defined in Control.Monad.Trans.Select | |
| MonadIO m => MonadIO (StateT s m) | |
Defined in Control.Monad.Trans.State.Lazy | |
| MonadIO m => MonadIO (StateT s m) | |
Defined in Control.Monad.Trans.State.Strict | |
| MonadIO m => MonadIO (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.CPS | |
| (Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Lazy | |
| (Monoid w, MonadIO m) => MonadIO (WriterT w m) | |
Defined in Control.Monad.Trans.Writer.Strict | |
| MonadIO m => MonadIO (ContT r m) | |
Defined in Control.Monad.Trans.Cont | |
| MonadIO m => MonadIO (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.CPS | |
| (Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Lazy | |
| (Monoid w, MonadIO m) => MonadIO (RWST r w s m) | |
Defined in Control.Monad.Trans.RWS.Strict | |
liftIO :: MonadIO m => IO a -> m a #
Lift a computation from the IO monad.
This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations
(i.e. IO is the base monad for the stack).
Example
import Control.Monad.Trans.State -- from the "transformers" library printState :: Show s => StateT s IO () printState = do state <- get liftIO $ print state
Had we omitted , we would have ended up with this error:liftIO
• Couldn't match type ‘IO’ with ‘StateT s IO’ Expected type: StateT s IO () Actual type: IO ()
The important part here is the mismatch between StateT s IO () and .IO ()
Luckily, we know of a function that takes an and returns an IO a(m a): ,
enabling us to run the program and see the expected results:liftIO
> evalStateT printState "hello" "hello" > evalStateT printState 3 3
Exceptions
class (Typeable e, Show e) => Exception e where #
Any type that you wish to throw or catch as an exception must be an
instance of the Exception class. The simplest case is a new exception
type directly below the root:
data MyException = ThisException | ThatException
deriving Show
instance Exception MyExceptionThe default method definitions in the Exception class do what we need
in this case. You can now throw and catch ThisException and
ThatException as exceptions:
*Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
Caught ThisException
In more complicated examples, you may wish to define a whole hierarchy of exceptions:
---------------------------------------------------------------------
-- Make the root exception type for all the exceptions in a compiler
data SomeCompilerException = forall e . Exception e => SomeCompilerException e
instance Show SomeCompilerException where
show (SomeCompilerException e) = show e
instance Exception SomeCompilerException
compilerExceptionToException :: Exception e => e -> SomeException
compilerExceptionToException = toException . SomeCompilerException
compilerExceptionFromException :: Exception e => SomeException -> Maybe e
compilerExceptionFromException x = do
SomeCompilerException a <- fromException x
cast a
---------------------------------------------------------------------
-- Make a subhierarchy for exceptions in the frontend of the compiler
data SomeFrontendException = forall e . Exception e => SomeFrontendException e
instance Show SomeFrontendException where
show (SomeFrontendException e) = show e
instance Exception SomeFrontendException where
toException = compilerExceptionToException
fromException = compilerExceptionFromException
frontendExceptionToException :: Exception e => e -> SomeException
frontendExceptionToException = toException . SomeFrontendException
frontendExceptionFromException :: Exception e => SomeException -> Maybe e
frontendExceptionFromException x = do
SomeFrontendException a <- fromException x
cast a
---------------------------------------------------------------------
-- Make an exception type for a particular frontend compiler exception
data MismatchedParentheses = MismatchedParentheses
deriving Show
instance Exception MismatchedParentheses where
toException = frontendExceptionToException
fromException = frontendExceptionFromExceptionWe can now catch a MismatchedParentheses exception as
MismatchedParentheses, SomeFrontendException or
SomeCompilerException, but not other types, e.g. IOException:
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
Caught MismatchedParentheses
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
Caught MismatchedParentheses
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
Caught MismatchedParentheses
*Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
*** Exception: MismatchedParentheses
Minimal complete definition
Nothing
Methods
toException :: e -> SomeException #
toException should produce a SomeException with no attached ExceptionContext.
fromException :: SomeException -> Maybe e #
displayException :: e -> String #
Render this exception value in a human-friendly manner.
Default implementation: .show
@since base-4.8.0.0
backtraceDesired :: e -> Bool #
Instances
| Exception Timeout | Since: base-4.7.0.0 |
Defined in System.Timeout Methods toException :: Timeout -> SomeException # fromException :: SomeException -> Maybe Timeout # displayException :: Timeout -> String # backtraceDesired :: Timeout -> Bool # | |
| Exception SizeOverflowException | |
Defined in Data.ByteString.Internal.Type | |
| Exception Void | @since base-4.8.0.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # backtraceDesired :: Void -> Bool # | |
| Exception ArithException | @since base-4.0.0.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: ArithException -> SomeException # fromException :: SomeException -> Maybe ArithException # displayException :: ArithException -> String # backtraceDesired :: ArithException -> Bool # | |
| Exception SomeException | This drops any attached @since base-3.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # backtraceDesired :: SomeException -> Bool # | |
| Exception AllocationLimitExceeded | @since base-4.8.0.0 |
Defined in GHC.Internal.IO.Exception | |
| Exception ArrayException | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: ArrayException -> SomeException # fromException :: SomeException -> Maybe ArrayException # displayException :: ArrayException -> String # backtraceDesired :: ArrayException -> Bool # | |
| Exception AssertionFailed | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: AssertionFailed -> SomeException # fromException :: SomeException -> Maybe AssertionFailed # displayException :: AssertionFailed -> String # backtraceDesired :: AssertionFailed -> Bool # | |
| Exception AsyncException | @since base-4.7.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: AsyncException -> SomeException # fromException :: SomeException -> Maybe AsyncException # displayException :: AsyncException -> String # backtraceDesired :: AsyncException -> Bool # | |
| Exception BlockedIndefinitelyOnMVar | @since base-4.1.0.0 |
| Exception BlockedIndefinitelyOnSTM | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception | |
| Exception CompactionFailed | @since base-4.10.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: CompactionFailed -> SomeException # fromException :: SomeException -> Maybe CompactionFailed # | |
| Exception Deadlock | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: Deadlock -> SomeException # fromException :: SomeException -> Maybe Deadlock # displayException :: Deadlock -> String # backtraceDesired :: Deadlock -> Bool # | |
| Exception ExitCode | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # backtraceDesired :: ExitCode -> Bool # | |
| Exception FixIOException | @since base-4.11.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: FixIOException -> SomeException # fromException :: SomeException -> Maybe FixIOException # displayException :: FixIOException -> String # backtraceDesired :: FixIOException -> Bool # | |
| Exception IOException | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # backtraceDesired :: IOException -> Bool # | |
| Exception SomeAsyncException | @since base-4.7.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: SomeAsyncException -> SomeException # fromException :: SomeException -> Maybe SomeAsyncException # | |
| Exception UnicodeException | |
Defined in Data.Text.Encoding.Error Methods toException :: UnicodeException -> SomeException # fromException :: SomeException -> Maybe UnicodeException # | |
| Exception a => Exception (ExceptionWithContext a) | |
Defined in GHC.Internal.Exception.Type Methods toException :: ExceptionWithContext a -> SomeException # fromException :: SomeException -> Maybe (ExceptionWithContext a) # displayException :: ExceptionWithContext a -> String # backtraceDesired :: ExceptionWithContext a -> Bool # | |
| Exception e => Exception (NoBacktrace e) | |
Defined in GHC.Internal.Exception.Type Methods toException :: NoBacktrace e -> SomeException # fromException :: SomeException -> Maybe (NoBacktrace e) # displayException :: NoBacktrace e -> String # backtraceDesired :: NoBacktrace e -> Bool # | |
The class Typeable allows a concrete representation of a type to
be calculated.
Minimal complete definition
typeRep#
data SomeException #
The SomeException type is the root of the exception type hierarchy.
When an exception of type e is thrown, behind the scenes it is
encapsulated in a SomeException.
Instances
| Exception SomeException | This drops any attached @since base-3.0 |
Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # backtraceDesired :: SomeException -> Bool # | |
| Show SomeException | Since: ghc-internal-3.0 |
Defined in GHC.Internal.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS # show :: SomeException -> String # showList :: [SomeException] -> ShowS # | |
data IOException #
Exceptions that occur in the IO monad.
An IOException records a more specific error type, a descriptive
string and maybe the handle that was used when the error was
flagged.
Instances
| Exception IOException | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # backtraceDesired :: IOException -> Bool # | |
| Show IOException | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception Methods showsPrec :: Int -> IOException -> ShowS # show :: IOException -> String # showList :: [IOException] -> ShowS # | |
| Eq IOException | @since base-4.1.0.0 |
Defined in GHC.Internal.IO.Exception | |
module System.IO.Error
Files
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.
(</>) :: FilePath -> FilePath -> FilePath infixr 5 #
Combine two paths with a path separator.
If the second path starts with a path separator or a drive letter, then it returns the second.
The intention is that readFile (dir will access the same file as
</> file)setCurrentDirectory dir; readFile file.
Posix: "/directory" </> "file.ext" == "/directory/file.ext"
Windows: "/directory" </> "file.ext" == "/directory\\file.ext"
"directory" </> "/file.ext" == "/file.ext"
Valid x => (takeDirectory x </> takeFileName x) `equalFilePath` xCombined:
Posix: "/" </> "test" == "/test" Posix: "home" </> "bob" == "home/bob" Posix: "x:" </> "foo" == "x:/foo" Windows: "C:\\foo" </> "bar" == "C:\\foo\\bar" Windows: "home" </> "bob" == "home\\bob"
Not combined:
Posix: "home" </> "/bob" == "/bob" Windows: "home" </> "C:\\bob" == "C:\\bob"
Not combined (tricky):
On Windows, if a filepath starts with a single slash, it is relative to the
root of the current drive. In [1], this is (confusingly) referred to as an
absolute path.
The current behavior of </> is to never combine these forms.
Windows: "home" </> "/bob" == "/bob" Windows: "home" </> "\\bob" == "\\bob" Windows: "C:\\home" </> "\\bob" == "\\bob"
On Windows, from [1]: "If a file name begins with only a disk designator
but not the backslash after the colon, it is interpreted as a relative path
to the current directory on the drive with the specified letter."
The current behavior of </> is to never combine these forms.
Windows: "D:\\foo" </> "C:bar" == "C:bar" Windows: "C:\\foo" </> "C:bar" == "C:bar"
(<.>) :: FilePath -> String -> FilePath infixr 7 #
Add an extension, even if there is already one there, equivalent to addExtension.
"/directory/path" <.> "ext" == "/directory/path.ext" "/directory/path" <.> ".ext" == "/directory/path.ext"
Strings
String is an alias for a list of characters.
String constants in Haskell are values of type String.
That means if you write a string literal like "hello world",
it will have the type [Char], which is the same as String.
Note: You can ask the compiler to automatically infer different types
with the -XOverloadedStrings language extension, for example
"hello world" :: Text. See IsString for more information.
Because String is just a list of characters, you can use normal list functions
to do basic string manipulation. See Data.List for operations on lists.
Performance considerations
[Char] is a relatively memory-inefficient type.
It is a linked list of boxed word-size characters, internally it looks something like:
╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭────╮
│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ [] │
╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰────╯
v v v
'a' 'b' 'c'The String "abc" will use 5*3+1 = 16 (in general 5n+1)
words of space in memory.
Furthermore, operations like (++) (string concatenation) are O(n)
(in the left argument).
For historical reasons, the base library uses String in a lot of places
for the conceptual simplicity, but library code dealing with user-data
should use the text
package for Unicode text, or the the
bytestring package
for binary data.
Hashing
hash :: Hashable a => a -> Int #
Like hashWithSalt, but no salt is used. The default
implementation uses hashWithSalt with some default salt.
Instances might want to implement this method to provide a more
efficient implementation than the default implementation.
hashWithSalt :: Hashable a => Int -> a -> Int infixl 0 #
Return a hash value for the argument, using the given salt.
The general contract of hashWithSalt is:
- If two values are equal according to the
==method, then applying thehashWithSaltmethod on each of the two values must produce the same integer result if the same salt is used in each case. - It is not required that if two values are unequal
according to the
==method, then applying thehashWithSaltmethod on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures. - This method can be used to compute different hash values for
the same input by providing a different salt in each
application of the method. This implies that any instance
that defines
hashWithSaltmust make use of the salt in its implementation. hashWithSaltmay return negativeIntvalues.