xmonad-contrib-0.18.1: Community-maintained extensions for xmonad

Copyright | (c) 2021 Tony Zorman
License | BSD3-style (see LICENSE)
Maintainer | Tony Zorman <soliditsallgood@mailbox.org>
Safe Haskell | None
Language | Haskell2010

XMonad.Prelude

Contents

- Keys
- Infinite streams

Description

Utility functions and re-exports for a more ergonomic developing experience. Users themselves will not find much use here.

Synopsis

- module Control.Applicative
- module Control.Monad
- module Data.Bool
- module Data.Char
- module Data.Function
- module Data.Maybe
- module Data.Monoid
- module Data.Traversable
- data List a
- unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- transpose :: [[a]] -> [[a]]
- sortBy :: (a -> a -> Ordering) -> [a] -> [a]
- cycle :: HasCallStack => [a] -> [a]
- (++) :: [a] -> [a] -> [a]
- class Foldable (t :: Type -> Type) where
  - fold :: Monoid m => t m -> m
  - foldMap :: Monoid m => (a -> m) -> t a -> m
  - foldMap' :: Monoid m => (a -> m) -> t a -> m
  - foldr :: (a -> b -> b) -> b -> t a -> b
  - foldr' :: (a -> b -> b) -> b -> t a -> b
  - foldl :: (b -> a -> b) -> b -> t a -> b
  - foldl' :: (b -> a -> b) -> b -> t a -> b
  - foldr1 :: (a -> a -> a) -> t a -> a
  - foldl1 :: (a -> a -> a) -> t a -> a
  - null :: t a -> Bool
  - length :: t a -> Int
  - elem :: Eq a => a -> t a -> Bool
  - maximum :: Ord a => t a -> a
  - minimum :: Ord a => t a -> a
  - sum :: Num a => t a -> a
  - product :: Num a => t a -> a
- concat :: Foldable t => t [a] -> [a]
- filter :: (a -> Bool) -> [a] -> [a]
- zip :: [a] -> [b] -> [(a, b)]
- map :: (a -> b) -> [a] -> [b]
- head :: HasCallStack => [a] -> a
- uncons :: [a] -> Maybe (a, [a])
- unsnoc :: [a] -> Maybe ([a], a)
- tail :: HasCallStack => [a] -> [a]
- last :: HasCallStack => [a] -> a
- init :: HasCallStack => [a] -> [a]
- foldl1' :: HasCallStack => (a -> a -> a) -> [a] -> a
- scanl :: (b -> a -> b) -> b -> [a] -> [b]
- scanl1 :: (a -> a -> a) -> [a] -> [a]
- scanl' :: (b -> a -> b) -> b -> [a] -> [b]
- scanr :: (a -> b -> b) -> b -> [a] -> [b]
- scanr1 :: (a -> a -> a) -> [a] -> [a]
- iterate :: (a -> a) -> a -> [a]
- iterate' :: (a -> a) -> a -> [a]
- repeat :: a -> [a]
- replicate :: Int -> a -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- dropWhile :: (a -> Bool) -> [a] -> [a]
- take :: Int -> [a] -> [a]
- drop :: Int -> [a] -> [a]
- splitAt :: Int -> [a] -> ([a], [a])
- span :: (a -> Bool) -> [a] -> ([a], [a])
- break :: (a -> Bool) -> [a] -> ([a], [a])
- reverse :: [a] -> [a]
- and :: Foldable t => t Bool -> Bool
- or :: Foldable t => t Bool -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- all :: Foldable t => (a -> Bool) -> t a -> Bool
- notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- lookup :: Eq a => a -> [(a, b)] -> Maybe b
- concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- (!!) :: HasCallStack => [a] -> Int -> a
- zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- unzip :: [(a, b)] -> ([a], [b])
- unzip3 :: [(a, b, c)] -> ([a], [b], [c])
- (<&>) :: Functor f => f a -> (a -> b) -> f b
- ($>) :: Functor f => f a -> b -> f b
- foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
- foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
- maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- dropWhileEnd :: (a -> Bool) -> [a] -> [a]
- stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]
- elemIndex :: Eq a => a -> [a] -> Maybe Int
- elemIndices :: Eq a => a -> [a] -> [Int]
- findIndex :: (a -> Bool) -> [a] -> Maybe Int
- findIndices :: (a -> Bool) -> [a] -> [Int]
- isPrefixOf :: Eq a => [a] -> [a] -> Bool
- isSuffixOf :: Eq a => [a] -> [a] -> Bool
- isInfixOf :: Eq a => [a] -> [a] -> Bool
- nub :: Eq a => [a] -> [a]
- nubBy :: (a -> a -> Bool) -> [a] -> [a]
- delete :: Eq a => a -> [a] -> [a]
- deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
- (\\) :: Eq a => [a] -> [a] -> [a]
- union :: Eq a => [a] -> [a] -> [a]
- unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
- intersect :: Eq a => [a] -> [a] -> [a]
- intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
- intersperse :: a -> [a] -> [a]
- intercalate :: [a] -> [[a]] -> [a]
- partition :: (a -> Bool) -> [a] -> ([a], [a])
- insert :: Ord a => a -> [a] -> [a]
- insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
- genericLength :: Num i => [a] -> i
- genericTake :: Integral i => i -> [a] -> [a]
- genericDrop :: Integral i => i -> [a] -> [a]
- genericSplitAt :: Integral i => i -> [a] -> ([a], [a])
- genericIndex :: Integral i => [a] -> i -> a
- genericReplicate :: Integral i => i -> a -> [a]
- zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]
- zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]
- zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)]
- zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)]
- zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]
- zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f]
- zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g]
- zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h]
- unzip4 :: [(a, b, c, d)] -> ([a], [b], [c], [d])
- unzip5 :: [(a, b, c, d, e)] -> ([a], [b], [c], [d], [e])
- unzip6 :: [(a, b, c, d, e, f)] -> ([a], [b], [c], [d], [e], [f])
- unzip7 :: [(a, b, c, d, e, f, g)] -> ([a], [b], [c], [d], [e], [f], [g])
- deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
- group :: Eq a => [a] -> [[a]]
- groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
- inits :: [a] -> [[a]]
- tails :: [a] -> [[a]]
- subsequences :: [a] -> [[a]]
- permutations :: [a] -> [[a]]
- sort :: Ord a => [a] -> [a]
- singleton :: a -> [a]
- lines :: String -> [String]
- unlines :: [String] -> String
- words :: String -> [String]
- unwords :: [String] -> String
- isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
- fi :: (Integral a, Num b) => a -> b
- chunksOf :: Int -> [a] -> [[a]]
- (.:) :: (a -> b) -> (c -> d -> a) -> c -> d -> b
- (!?) :: [a] -> Int -> Maybe a
- data NonEmpty a = a :| [a]
- notEmpty :: HasCallStack => [a] -> NonEmpty a
- safeGetWindowAttributes :: Window -> X (Maybe WindowAttributes)
- mkAbsolutePath :: MonadIO m => FilePath -> m FilePath
- findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)
- keyToString :: (KeyMask, KeySym) -> String
- keymaskToString :: KeyMask -> KeyMask -> String
- cleanKeyMask :: X (KeyMask -> KeyMask)
- regularKeys :: [(String, KeySym)]
- allSpecialKeys :: [(String, KeySym)]
- specialKeys :: [(String, KeySym)]
- multimediaKeys :: [(String, KeySym)]
- functionKeys :: [(String, KeySym)]
- type WindowScreen = Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail
- data Stream a = !a :~ (Stream a)
- (+~) :: [a] -> Stream a -> Stream a
- cycleS :: NonEmpty a -> Stream a
- takeS :: Int -> Stream a -> [a]
- toList :: IsList l => l -> [Item l]
- fromList :: IsList l => [Item l] -> l

# Documentation

module Control.Applicative

module Control.Monad

module Data.Bool

module Data.Char

module Data.Function

module Data.Maybe

module Data.Monoid

module Data.Traversable

data List a Source #

The builtin linked list type.

In Haskell, lists are one of the most important data types as they are often used analogous to loops in imperative programming languages. These lists are singly linked, which makes them unsuited for operations that require \(\mathcal{O}(1)\) access. Instead, they are intended to be traversed.

You can use `List a` or `[a]` in type signatures:

    length :: [a] -> Int

or

    length :: List a -> Int

They are fully equivalent, and `List a` will be normalised to `[a]`.

#### Usage

Lists are constructed recursively using the right-associative constructor operator (or cons) `(:) :: a -> [a] -> [a]`, which prepends an element to a list, and the empty list `[]`.

    (1 : 2 : 3 : []) == (1 : (2 : (3 : []))) == [1, 2, 3]

Lists can also be constructed using list literals of the form `[x_1, x_2, ..., x_n]` which are syntactic sugar and, unless `-XOverloadedLists` is enabled, are translated into uses of `(:)` and `[]`

`String` literals, like `"I 💜 hs"`, are translated into Lists of characters, `['I', ' ', '💜', ' ', 'h', 's']`.

#### Implementation

Expand

Internally and in memory, all the above are represented like this, with arrows being pointers to locations in memory.

    ╭───┬───┬──╮   ╭───┬───┬──╮   ╭───┬───┬──╮   ╭────╮
    │(:)│   │ ─┼──>│(:)│   │ ─┼──>│(:)│   │ ─┼──>│ [] │
    ╰───┴─┼─┴──╯   ╰───┴─┼─┴──╯   ╰───┴─┼─┴──╯   ╰────╯
          v              v              v
          1              2              3

#### Examples

Expand

    >>> ['H', 'a', 's', 'k', 'e', 'l', 'l']
    "Haskell"

    >>> 1 : [4, 1, 5, 9]
    [1,4,1,5,9]

    >>> [] : [] : []
    [[],[]]

Since: ghc-prim-0.10.0

#### Instances

Instances details

MonadZip [] | Since: base-4.3.1.0
Instance details Defined in Control.Monad.Zip Methods mzip :: [a] -> [b] -> [(a, b)] Source # mzipWith :: (a -> b -> c) -> [a] -> [b] -> [c] Source # munzip :: [(a, b)] -> ([a], [b]) Source #
Eq1 [] | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftEq :: (a -> b -> Bool) -> [a] -> [b] -> Bool Source #
Ord1 [] | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftCompare :: (a -> b -> Ordering) -> [a] -> [b] -> Ordering Source #
Read1 [] | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS [a] Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [[a]] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [a] Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [[a]] Source #
Show1 [] | Since: base-4.9.0.0
Instance details Defined in Data.Functor.Classes Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> [a] -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [[a]] -> ShowS Source #
NFData1 [] | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> [a] -> () Source #
Alternative [] | Combines lists by concatenation, starting from the empty list. Since: base-2.1
Instance details Defined in GHC.Internal.Base Methods empty :: [a] Source # (<|>) :: [a] -> [a] -> [a] Source # some :: [a] -> [[a]] Source # many :: [a] -> [[a]] Source #
Applicative [] | Since: base-2.1
Instance details Defined in GHC.Internal.Base Methods pure :: a -> [a] Source # (<*>) :: [a -> b] -> [a] -> [b] Source # liftA2 :: (a -> b -> c) -> [a] -> [b] -> [c] Source # (*>) :: [a] -> [b] -> [b] Source # (<*) :: [a] -> [b] -> [a] Source #
Functor [] | Since: base-2.1
Instance details Defined in GHC.Internal.Base Methods fmap :: (a -> b) -> [a] -> [b] Source # (<$) :: a -> [b] -> [a] Source #
Monad [] | Since: base-2.1
Instance details Defined in GHC.Internal.Base Methods (>>=) :: [a] -> (a -> [b]) -> [b] Source # (>>) :: [a] -> [b] -> [b] Source # return :: a -> [a] Source #
MonadPlus [] | Combines lists by concatenation, starting from the empty list. Since: base-2.1
Instance details Defined in GHC.Internal.Base Methods mzero :: [a] Source # mplus :: [a] -> [a] -> [a] Source #
MonadFail [] | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Control.Monad.Fail Methods fail :: String -> [a] Source #
Foldable [] | Since: base-2.1

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => [m] -> m Source #

foldMap :: Monoid m => (a -> m) -> [a] -> m Source #

foldMap' :: Monoid m => (a -> m) -> [a] -> m Source #

foldr :: (a -> b -> b) -> b -> [a] -> b Source #

foldr' :: (a -> b -> b) -> b -> [a] -> b Source #

foldl :: (b -> a -> b) -> b -> [a] -> b Source #

foldl' :: (b -> a -> b) -> b -> [a] -> b Source #

foldr1 :: (a -> a -> a) -> [a] -> a Source #

foldl1 :: (a -> a -> a) -> [a] -> a Source #

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

null :: [a] -> Bool Source #

length :: [a] -> Int Source #

elem :: Eq a => a -> [a] -> Bool Source #

maximum :: Ord a => [a] -> a Source #

minimum :: Ord a => [a] -> a Source #

sum :: Num a => [a] -> a Source #

product :: Num a => [a] -> a Source #

Traversable [] | Since: base-2.1
Instance details Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> [a] -> f [b] Source # sequenceA :: Applicative f => [f a] -> f [a] Source # mapM :: Monad m => (a -> m b) -> [a] -> m [b] Source # sequence :: Monad m => [m a] -> m [a] Source #
HasColorizer String Source # |
Instance details Defined in XMonad.Actions.GridSelect Methods defaultColorizer :: String -> Bool -> X (String, String) Source #
Generic1 [] |

Instance details

Defined in GHC.Internal.Generics

Associated Types

type Rep1 [] | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep1 [] = D1 ('MetaData "List" "GHC.Types" "ghc-prim" 'False) (C1 ('MetaCons "[]" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons ":" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))

Methods

from1 :: [a] -> Rep1 [] a Source #

to1 :: Rep1 [] a -> [a] Source #

Lift a => Lift ([a] :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => [a] -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => [a] -> Code m [a] Source #
IsChar c => PrintfArg [c] | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: [c] -> FieldFormatter Source # parseFormat :: [c] -> ModifierParser Source #
IsChar c => PrintfType [c] | Since: base-2.1
Instance details Defined in Text.Printf Methods spr :: String -> [UPrintf] -> [c]
Default [a] |
Instance details Defined in Data.Default.Internal Methods def :: [a] #
NFData a => NFData [a] |
Instance details Defined in Control.DeepSeq Methods rnf :: [a] -> () Source #
Monoid [a] | Since: base-2.1
Instance details Defined in GHC.Internal.Base Methods mempty :: [a] Source # mappend :: [a] -> [a] -> [a] Source # mconcat :: [[a]] -> [a] Source #
Semigroup [a] | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Base Methods (<>) :: [a] -> [a] -> [a] Source # sconcat :: NonEmpty [a] -> [a] Source # stimes :: Integral b => b -> [a] -> [a] Source #
a ~ Char => IsString [a] | `(a ~ Char)` context was introduced in `4.9.0.0` Since: base-2.1
Instance details Defined in GHC.Internal.Data.String Methods fromString :: String -> [a] Source #
Generic [a] |

Instance details

Defined in GHC.Internal.Generics

Associated Types

type Rep [a] | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep [a] = D1 ('MetaData "List" "GHC.Types" "ghc-prim" 'False) (C1 ('MetaCons "[]" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons ":" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))

Methods

from :: [a] -> Rep [a] x Source #

to :: Rep [a] x -> [a] Source #

IsList [a] | Since: base-4.7.0.0

Instance details

Defined in GHC.Internal.IsList

Associated Types

type Item [a] |
Instance details Defined in GHC.Internal.IsList type Item [a] = a

Methods

fromList :: [Item [a]] -> [a] Source #

fromListN :: Int -> [Item [a]] -> [a] Source #

toList :: [a] -> [Item [a]] Source #

Read a => Read [a] | Since: base-2.1
Instance details Defined in GHC.Internal.Read Methods readsPrec :: Int -> ReadS [a] Source # readList :: ReadS [[a]] Source # readPrec :: ReadPrec [a] Source # readListPrec :: ReadPrec [[a]] Source #
Show a => Show [a] | Since: base-2.1
Instance details Defined in GHC.Internal.Show Methods showsPrec :: Int -> [a] -> ShowS Source # show :: [a] -> String Source # showList :: [[a]] -> ShowS Source #
Eq a => Eq [a] |
Instance details Defined in GHC.Classes Methods (==) :: [a] -> [a] -> Bool Source # (/=) :: [a] -> [a] -> Bool Source #
Ord a => Ord [a] |
Instance details Defined in GHC.Classes Methods compare :: [a] -> [a] -> Ordering Source # (<) :: [a] -> [a] -> Bool Source # (<=) :: [a] -> [a] -> Bool Source # (>) :: [a] -> [a] -> Bool Source # (>=) :: [a] -> [a] -> Bool Source # max :: [a] -> [a] -> [a] Source # min :: [a] -> [a] -> [a] Source #
PPrint a => PPrint [a] Source # |
Instance details Defined in XMonad.Config.Dmwit Methods pprint :: Int -> [a] -> String Source #
HasName [Char] Source # |
Instance details Defined in XMonad.Util.NamedActions Methods showName :: [Char] -> [String] getAction :: [Char] -> X ()
UTF8Bytes [Word8] Int |
Instance details Defined in Codec.Binary.UTF8.Generic Methods bsplit :: Int -> [Word8] -> ([Word8], [Word8]) Source # bdrop :: Int -> [Word8] -> [Word8] Source # buncons :: [Word8] -> Maybe (Word8, [Word8]) Source # elemIndex :: Word8 -> [Word8] -> Maybe Int Source # empty :: [Word8] Source # null :: [Word8] -> Bool Source # pack :: [Word8] -> [Word8] Source # tail :: [Word8] -> [Word8] Source #
HasName (X (), String) Source # |
Instance details Defined in XMonad.Util.NamedActions Methods showName :: (X (), String) -> [String] getAction :: (X (), String) -> X ()
HasName (X (), [String]) Source # |
Instance details Defined in XMonad.Util.NamedActions Methods showName :: (X (), [String]) -> [String] getAction :: (X (), [String]) -> X ()
HasName (NamedAction, String) Source # |
Instance details Defined in XMonad.Util.NamedActions Methods showName :: (NamedAction, String) -> [String] getAction :: (NamedAction, String) -> X ()
type Rep1 [] | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep1 [] = D1 ('MetaData "List" "GHC.Types" "ghc-prim" 'False) (C1 ('MetaCons "[]" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons ":" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))

type Rep [a] | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep [a] = D1 ('MetaData "List" "GHC.Types" "ghc-prim" 'False) (C1 ('MetaCons "[]" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons ":" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))

type Item [a] |
Instance details Defined in GHC.Internal.IsList type Item [a] = a

unfoldr :: (b -> Maybe (a, b)) -> b -> [a] Source #

The `unfoldr` function is a `dual' to `foldr`: while `foldr` reduces a list to a summary value, `unfoldr` builds a list from a seed value. The function takes the element and returns `Nothing` if it is done producing the list or returns `Just` `(a,b)`, in which case, `a` is a prepended to the list and `b` is used as the next element in a recursive call. For example,

    iterate f == unfoldr (\x -> Just (x, f x))

In some cases, `unfoldr` can undo a `foldr` operation:

    unfoldr f' (foldr f z xs) == xs

if the following holds:

    f' (f x y) = Just (x,y)
    f' z       = Nothing

#### Laziness

Expand

    >>> take 1 (unfoldr (\x -> Just (x, undefined)) 'a')
    "a"

#### Examples

Expand

    >>> unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10
    [10,9,8,7,6,5,4,3,2,1]

    >>> take 10 $ unfoldr (\(x, y) -> Just (x, (y, x + y))) (0, 1)
    [0,1,1,2,3,5,8,13,21,54]

sortOn :: Ord b => (a -> b) -> [a] -> [a] Source #

Sort a list by comparing the results of a key function applied to each element. ``sortOn` f` is equivalent to ``sortBy` (`comparing` f)`, but has the performance advantage of only evaluating `f` once for each element in the input list. This is called the decorate-sort-undecorate paradigm, or Schwartzian transform.

Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.

The argument must be finite.

#### Examples

Expand

    >>> sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]

    >>> sortOn length ["jim", "creed", "pam", "michael", "dwight", "kevin"]
    ["jim","pam","creed","kevin","dwight","michael"]

#### Performance notes

Expand

This function minimises the projections performed, by materialising the projections in an intermediate list.

For trivial projections, you should prefer using `sortBy` with `comparing`, for example:

    >>> sortBy (comparing fst) [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]

Or, for the exact same API as `sortOn`, you can use `sortBy . comparing`:

    >>> (sortBy . comparing) fst [(3, 1), (2, 2), (1, 3)]
    [(1,3),(2,2),(3,1)]

Since: base-4.8.0.0

transpose :: [[a]] -> [[a]] Source #

The `transpose` function transposes the rows and columns of its argument.

#### Laziness

Expand

`transpose` is lazy in its elements

    >>> take 1 (transpose ['a' : undefined, 'b' : undefined])
    ["ab"]

#### Examples

Expand

    >>> transpose [[1,2,3],[4,5,6]]
    [[1,4],[2,5],[3,6]]

If some of the rows are shorter than the following rows, their elements are skipped:

    >>> transpose [[10,11],[20],[],[30,31,32]]
    [[10,20,30],[11,31],[32]]

For this reason the outer list must be finite; otherwise `transpose` hangs:

    >>> transpose (repeat [])
    * Hangs forever *

sortBy :: (a -> a -> Ordering) -> [a] -> [a] Source #

The `sortBy` function is the non-overloaded version of `sort`. The argument must be finite.

The supplied comparison relation is supposed to be reflexive and antisymmetric, otherwise, e. g., for `_ _ -> GT`, the ordered list simply does not exist. The relation is also expected to be transitive: if it is not then `sortBy` might fail to find an ordered permutation, even if it exists.

#### Examples

Expand

    >>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]
    [(1,"Hello"),(2,"world"),(4,"!")]

cycle :: HasCallStack => [a] -> [a] Source #

`cycle` ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists.

#### Examples

Expand

    >>> cycle []
    *** Exception: Prelude.cycle: empty list

    >>> take 10 (cycle [42])
    [42,42,42,42,42,42,42,42,42,42]

    >>> take 10 (cycle [2, 5, 7])
    [2,5,7,2,5,7,2,5,7,2]

    >>> take 1 (cycle (42 : undefined))
    [42]

(++) :: [a] -> [a] -> [a] infixr 5 Source #

`(++)` appends two lists, i.e.,

    [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
    [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]

If the first list is not finite, the result is the first list.

#### Performance considerations

Expand

This function takes linear time in the number of elements of the first list. Thus it is better to associate repeated applications of `(++)` to the right (which is the default behaviour): `xs ++ (ys ++ zs)` or simply `xs ++ ys ++ zs`, but not `(xs ++ ys) ++ zs`. For the same reason `concat` `=` `foldr` `(++)` `[]` has linear performance, while `foldl` `(++)` `[]` is prone to quadratic slowdown

#### Examples

Expand

    >>> [1, 2, 3] ++ [4, 5, 6]
    [1,2,3,4,5,6]

    >>> [] ++ [1, 2, 3]
    [1,2,3]

    >>> [3, 2, 1] ++ []
    [3,2,1]

class Foldable (t :: Type -> Type) where Source #

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 Foldable

A more detailed description can be found in the Overview section of Data.Foldable.

For the class laws see the Laws section of Data.Foldable.

Minimal complete definition

foldMap | foldr

Methods

fold :: Monoid m => t m -> m Source #

Given a structure with elements whose type is a `Monoid`, combine them via the monoid's `(`<>`)` operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use `foldMap'` instead, with `id` as the map.

#### Examples

Expand

Basic usage:

    >>> fold [[1, 2, 3], [4, 5], [6], []]
    [1,2,3,4,5,6]

    >>> fold $ Node (Leaf (Sum 1)) (Sum 3) (Leaf (Sum 5))
    Sum {getSum = 9}

Folds of unbounded structures do not terminate when the monoid's `(`<>`)` operator is strict:

    >>> fold (repeat Nothing)
    * Hangs forever *

Lazy corecursive folds of unbounded structures are fine:

    >>> take 12 $ fold $ map (\i -> [i..i+2]) [0..]
    [0,1,2,1,2,3,2,3,4,3,4,5]
    >>> sum $ take 4000000 $ fold $ map (\i -> [i..i+2]) [0..]
    2666668666666

foldMap :: Monoid m => (a -> m) -> t a -> m Source #

Map each element of the structure into a monoid, and combine the results with `(`<>`)`. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider `foldMap'` instead.

#### Examples

Expand

Basic usage:

    >>> foldMap Sum [1, 3, 5]
    Sum {getSum = 9}

    >>> foldMap Product [1, 3, 5]
    Product {getProduct = 15}

    >>> foldMap (replicate 3) [1, 2, 3]
    [1,1,1,2,2,2,3,3,3]

When a Monoid's `(`<>`)` is lazy in its second argument, `foldMap` can return a result even from an unbounded structure. For example, lazy accumulation enables Data.ByteString.Builder to efficiently serialise large data structures and produce the output incrementally:

    >>> import qualified Data.ByteString.Lazy as L
    >>> import qualified Data.ByteString.Builder as B
    >>> let bld :: Int -> B.Builder; bld i = B.intDec i <> B.word8 0x20
    >>> let lbs = B.toLazyByteString $ foldMap bld [0..]
    >>> L.take 64 lbs
    "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24"

foldMap' :: Monoid m => (a -> m) -> t a -> m Source #

A left-associative variant of `foldMap` that is strict in the accumulator. Use this method for strict reduction when partial results are merged via `(`<>`)`.

#### Examples

Expand

Define a `Monoid` over finite bit strings under `xor`. Use it to strictly compute the `xor` of a list of `Int` values.

    >>> :set -XGeneralizedNewtypeDeriving
    >>> import Data.Bits (Bits, FiniteBits, xor, zeroBits)
    >>> import Data.Foldable (foldMap')
    >>> import Numeric (showHex)
    >>>
    >>> newtype X a = X a deriving (Eq, Bounded, Enum, Bits, FiniteBits)
    >>> instance Bits a => Semigroup (X a) where X a <> X b = X (a `xor` b)
    >>> instance Bits a => Monoid    (X a) where mempty     = X zeroBits
    >>>
    >>> let bits :: [Int]; bits = [0xcafe, 0xfeed, 0xdeaf, 0xbeef, 0x5411]
    >>> (\ (X a) -> showString "0x" . showHex a $ "") $ foldMap' X bits
    "0x42"

Since: base-4.13.0.0

foldr :: (a -> b -> b) -> b -> t a -> b Source #

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, `foldr`, when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left:

    foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)

Note that since the head of the resulting expression is produced by an application of the operator to the first element of the list, given an operator lazy in its right argument, `foldr` can produce a terminating expression from an unbounded list.

For a general `Foldable` structure this should be semantically identical to,

    foldr f z = foldr f z . toList

#### Examples

Expand

Basic usage:

    >>> foldr (||) False [False, True, False]
    True

    >>> foldr (||) False []
    False

    >>> foldr (\c acc -> acc ++ [c]) "foo" ['a', 'b', 'c', 'd']
    "foodcba"

##### Infinite structures

⚠️ Applying `foldr` to infinite structures usually doesn't terminate.

It may still terminate under one of the following conditions:

- the folding function is short-circuiting
- the folding function is lazy on its second argument

###### Short-circuiting

`(`||`)` short-circuits on `True` values, so the following terminates because there is a `True` value finitely far from the left side:

    >>> foldr (||) False (True : repeat False)
    True

But the following doesn't terminate:

    >>> foldr (||) False (repeat False ++ [True])
    * Hangs forever *

###### Laziness in the second argument

Applying `foldr` to infinite structures terminates when the operator is lazy in its second argument (the initial accumulator is never used in this case, and so could be left `undefined`, but `[]` is more clear):

    >>> take 5 $ foldr (\i acc -> i : fmap (+3) acc) [] (repeat 1)
    [1,4,7,10,13]

foldr' :: (a -> b -> b) -> b -> t a -> b Source #

`foldr'` is a variant of `foldr` that performs strict reduction from right to left, i.e. starting with the right-most element. The input structure must be finite, otherwise `foldr'` runs out of space (diverges).

If you want a strict right fold in constant space, you need a structure that supports faster than O(n) access to the right-most element, such as `Seq` from the `containers` package.

This method does not run in constant space for structures such as lists that don't support efficient right-to-left iteration and so require O(n) space to perform right-to-left reduction. Use of this method with such a structure is a hint that the chosen structure may be a poor fit for the task at hand. If the order in which the elements are combined is not important, use `foldl'` instead.

Since: base-4.6.0.0

foldl :: (b -> a -> b) -> b -> t a -> b Source #

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, `foldl`, when applied to a binary operator, a starting value (typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

    foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn

Note that to produce the outermost application of the operator the entire input list must be traversed. Like all left-associative folds, `foldl` will diverge if given an infinite list.

If you want an efficient strict left-fold, you probably want to use `foldl'` instead of `foldl`. The reason for this is that the latter does not force the inner results (e.g. `z `f` x1` in the above example) before applying them to the operator (e.g. to `(`f` x2)`). This results in a thunk chain O(n) elements long, which then must be evaluated from the outside-in.

For a general `Foldable` structure this should be semantically identical to:

    foldl f z = foldl f z . toList

#### Examples

Expand

The first example is a strict fold, which in practice is best performed with `foldl'`.

    >>> foldl (+) 42 [1,2,3,4]
    52

Though the result below is lazy, the input is reversed before prepending it to the initial accumulator, so corecursion begins only after traversing the entire input string.

    >>> foldl (\acc c -> c : acc) "abcd" "efgh"
    "hgfeabcd"

A left fold of a structure that is infinite on the right cannot terminate, even when for any finite input the fold just returns the initial accumulator:

    >>> foldl (\a _ -> a) 0 $ repeat 1
    * Hangs forever *

WARNING: When it comes to lists, you always want to use either `foldl'` or `foldr` instead.

foldl' :: (b -> a -> b) -> b -> t a -> b Source #

Left-associative fold of a structure but with strict application of the operator.

This ensures that each step of the fold is forced to Weak Head Normal Form before being applied, avoiding the collection of thunks that would otherwise occur. This is often what you want to strictly reduce a finite structure to a single strict result (e.g. `sum`).

For a general `Foldable` structure this should be semantically identical to,

    foldl' f z = foldl' f z . toList

Since: base-4.6.0.0

foldr1 :: (a -> a -> a) -> t a -> a Source #

A variant of `foldr` that has no base case, and thus may only be applied to non-empty structures.

This function is non-total and will raise a runtime exception if the structure happens to be empty.

#### Examples

Expand

Basic usage:

    >>> foldr1 (+) [1..4]
    10

    >>> foldr1 (+) []
    Exception: Prelude.foldr1: empty list

    >>> foldr1 (+) Nothing
    *** Exception: foldr1: empty structure

    >>> foldr1 (-) [1..4]
    -2

    >>> foldr1 (&&) [True, False, True, True]
    False

    >>> foldr1 (||) [False, False, True, True]
    True

    >>> foldr1 (+) [1..]
    * Hangs forever *

foldl1 :: (a -> a -> a) -> t a -> a Source #

A variant of `foldl` that has no base case, and thus may only be applied to non-empty structures.

This function is non-total and will raise a runtime exception if the structure happens to be empty.

    foldl1 f = foldl1 f . toList

#### Examples

Expand

Basic usage:

    >>> foldl1 (+) [1..4]
    10

    >>> foldl1 (+) []
    *** Exception: Prelude.foldl1: empty list

    >>> foldl1 (+) Nothing
    *** Exception: foldl1: empty structure

    >>> foldl1 (-) [1..4]
    -8

    >>> foldl1 (&&) [True, False, True, True]
    False

    >>> foldl1 (||) [False, False, True, True]
    True

    >>> foldl1 (+) [1..]
    * Hangs forever *

null :: t a -> Bool Source #

Test whether the structure is empty. The default implementation is Left-associative and lazy in both the initial element and the accumulator. Thus optimised for structures where the first element can be accessed in constant time. Structures where this is not the case should have a non-default implementation.

#### Examples

Expand

Basic usage:

    >>> null []
    True

    >>> null [1]
    False

`null` is expected to terminate even for infinite structures. The default implementation terminates provided the structure is bounded on the left (there is a leftmost element).

    >>> null [1..]
    False

Since: base-4.8.0.0

length :: t a -> Int Source #

Returns the size/length of a finite structure as an `Int`. The default implementation just counts elements starting with the leftmost. Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

#### Examples

Expand

Basic usage:

    >>> length []
    0

    >>> length ['a', 'b', 'c']
    3
    >>> length [1..]
    * Hangs forever *

Since: base-4.8.0.0

elem :: Eq a => a -> t a -> Bool infix 4 Source #

Does the element occur in the structure?

Note: `elem` is often used in infix form.

#### Examples

Expand

Basic usage:

    >>> 3 `elem` []
    False

    >>> 3 `elem` [1,2]
    False

    >>> 3 `elem` [1,2,3,4,5]
    True

For infinite structures, the default implementation of `elem` terminates if the sought-after value exists at a finite distance from the left side of the structure:

    >>> 3 `elem` [1..]
    True

    >>> 3 `elem` ([4..] ++ [3])
    * Hangs forever *

Since: base-4.8.0.0

maximum :: Ord a => t a -> a Source #

The largest element of a non-empty structure.

This function is non-total and will raise a runtime exception if the structure happens to be empty. A structure that supports random access and maintains its elements in order should provide a specialised implementation to return the maximum in faster than linear time.

#### Examples

Expand

Basic usage:

    >>> maximum [1..10]
    10

    >>> maximum []
    *** Exception: Prelude.maximum: empty list

    >>> maximum Nothing
    *** Exception: maximum: empty structure

WARNING: This function is partial for possibly-empty structures like lists.

Since: base-4.8.0.0

minimum :: Ord a => t a -> a Source #

The least element of a non-empty structure.

This function is non-total and will raise a runtime exception if the structure happens to be empty. A structure that supports random access and maintains its elements in order should provide a specialised implementation to return the minimum in faster than linear time.

#### Examples

Expand

Basic usage:

    >>> minimum [1..10]
    1

    >>> minimum []
    *** Exception: Prelude.minimum: empty list

    >>> minimum Nothing
    *** Exception: minimum: empty structure

WARNING: This function is partial for possibly-empty structures like lists.

Since: base-4.8.0.0

sum :: Num a => t a -> a Source #

The `sum` function computes the sum of the numbers of a structure.

#### Examples

Expand

Basic usage:

    >>> sum []
    0

    >>> sum [42]
    42

    >>> sum [1..10]
    55

    >>> sum [4.1, 2.0, 1.7]
    7.8

    >>> sum [1..]
    * Hangs forever *

Since: base-4.8.0.0

product :: Num a => t a -> a Source #

The `product` function computes the product of the numbers of a structure.

#### Examples

Expand

Basic usage:

    >>> product []
    1

    >>> product [42]
    42

    >>> product [1..10]
    3628800

    >>> product [4.1, 2.0, 1.7]
    13.939999999999998

    >>> product [1..]
    * Hangs forever *

Since: base-4.8.0.0

#### Instances

Instances details

Foldable Complex | Since: base-4.9.0.0

Instance details

Defined in Data.Complex

Methods

fold :: Monoid m => Complex m -> m Source #

foldMap :: Monoid m => (a -> m) -> Complex a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Complex a -> m Source #

foldr :: (a -> b -> b) -> b -> Complex a -> b Source #

foldr' :: (a -> b -> b) -> b -> Complex a -> b Source #

foldl :: (b -> a -> b) -> b -> Complex a -> b Source #

foldl' :: (b -> a -> b) -> b -> Complex a -> b Source #

foldr1 :: (a -> a -> a) -> Complex a -> a Source #

foldl1 :: (a -> a -> a) -> Complex a -> a Source #

toList :: Complex a -> [a] Source #

null :: Complex a -> Bool Source #

length :: Complex a -> Int Source #

elem :: Eq a => a -> Complex a -> Bool Source #

maximum :: Ord a => Complex a -> a Source #

minimum :: Ord a => Complex a -> a Source #

sum :: Num a => Complex a -> a Source #

product :: Num a => Complex a -> a Source #

Foldable First | Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

fold :: Monoid m => First m -> m Source #

foldMap :: Monoid m => (a -> m) -> First a -> m Source #

foldMap' :: Monoid m => (a -> m) -> First a -> m Source #

foldr :: (a -> b -> b) -> b -> First a -> b Source #

foldr' :: (a -> b -> b) -> b -> First a -> b Source #

foldl :: (b -> a -> b) -> b -> First a -> b Source #

foldl' :: (b -> a -> b) -> b -> First a -> b Source #

foldr1 :: (a -> a -> a) -> First a -> a Source #

foldl1 :: (a -> a -> a) -> First a -> a Source #

toList :: First a -> [a] Source #

null :: First a -> Bool Source #

length :: First a -> Int Source #

elem :: Eq a => a -> First a -> Bool Source #

maximum :: Ord a => First a -> a Source #

minimum :: Ord a => First a -> a Source #

sum :: Num a => First a -> a Source #

product :: Num a => First a -> a Source #

Foldable Last | Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

fold :: Monoid m => Last m -> m Source #

foldMap :: Monoid m => (a -> m) -> Last a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Last a -> m Source #

foldr :: (a -> b -> b) -> b -> Last a -> b Source #

foldr' :: (a -> b -> b) -> b -> Last a -> b Source #

foldl :: (b -> a -> b) -> b -> Last a -> b Source #

foldl' :: (b -> a -> b) -> b -> Last a -> b Source #

foldr1 :: (a -> a -> a) -> Last a -> a Source #

foldl1 :: (a -> a -> a) -> Last a -> a Source #

toList :: Last a -> [a] Source #

null :: Last a -> Bool Source #

length :: Last a -> Int Source #

elem :: Eq a => a -> Last a -> Bool Source #

maximum :: Ord a => Last a -> a Source #

minimum :: Ord a => Last a -> a Source #

sum :: Num a => Last a -> a Source #

product :: Num a => Last a -> a Source #

Foldable Max | Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

fold :: Monoid m => Max m -> m Source #

foldMap :: Monoid m => (a -> m) -> Max a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Max a -> m Source #

foldr :: (a -> b -> b) -> b -> Max a -> b Source #

foldr' :: (a -> b -> b) -> b -> Max a -> b Source #

foldl :: (b -> a -> b) -> b -> Max a -> b Source #

foldl' :: (b -> a -> b) -> b -> Max a -> b Source #

foldr1 :: (a -> a -> a) -> Max a -> a Source #

foldl1 :: (a -> a -> a) -> Max a -> a Source #

toList :: Max a -> [a] Source #

null :: Max a -> Bool Source #

length :: Max a -> Int Source #

elem :: Eq a => a -> Max a -> Bool Source #

maximum :: Ord a => Max a -> a Source #

minimum :: Ord a => Max a -> a Source #

sum :: Num a => Max a -> a Source #

product :: Num a => Max a -> a Source #

Foldable Min | Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

fold :: Monoid m => Min m -> m Source #

foldMap :: Monoid m => (a -> m) -> Min a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Min a -> m Source #

foldr :: (a -> b -> b) -> b -> Min a -> b Source #

foldr' :: (a -> b -> b) -> b -> Min a -> b Source #

foldl :: (b -> a -> b) -> b -> Min a -> b Source #

foldl' :: (b -> a -> b) -> b -> Min a -> b Source #

foldr1 :: (a -> a -> a) -> Min a -> a Source #

foldl1 :: (a -> a -> a) -> Min a -> a Source #

toList :: Min a -> [a] Source #

null :: Min a -> Bool Source #

length :: Min a -> Int Source #

elem :: Eq a => a -> Min a -> Bool Source #

maximum :: Ord a => Min a -> a Source #

minimum :: Ord a => Min a -> a Source #

sum :: Num a => Min a -> a Source #

product :: Num a => Min a -> a Source #

Foldable SCC | Since: containers-0.5.9

Instance details

Defined in Data.Graph

Methods

fold :: Monoid m => SCC m -> m Source #

foldMap :: Monoid m => (a -> m) -> SCC a -> m Source #

foldMap' :: Monoid m => (a -> m) -> SCC a -> m Source #

foldr :: (a -> b -> b) -> b -> SCC a -> b Source #

foldr' :: (a -> b -> b) -> b -> SCC a -> b Source #

foldl :: (b -> a -> b) -> b -> SCC a -> b Source #

foldl' :: (b -> a -> b) -> b -> SCC a -> b Source #

foldr1 :: (a -> a -> a) -> SCC a -> a Source #

foldl1 :: (a -> a -> a) -> SCC a -> a Source #

toList :: SCC a -> [a] Source #

null :: SCC a -> Bool Source #

length :: SCC a -> Int Source #

elem :: Eq a => a -> SCC a -> Bool Source #

maximum :: Ord a => SCC a -> a Source #

minimum :: Ord a => SCC a -> a Source #

sum :: Num a => SCC a -> a Source #

product :: Num a => SCC a -> a Source #

Foldable IntMap | Folds in order of increasing key.

Instance details

Defined in Data.IntMap.Internal

Methods

fold :: Monoid m => IntMap m -> m Source #

foldMap :: Monoid m => (a -> m) -> IntMap a -> m Source #

foldMap' :: Monoid m => (a -> m) -> IntMap a -> m Source #

foldr :: (a -> b -> b) -> b -> IntMap a -> b Source #

foldr' :: (a -> b -> b) -> b -> IntMap a -> b Source #

foldl :: (b -> a -> b) -> b -> IntMap a -> b Source #

foldl' :: (b -> a -> b) -> b -> IntMap a -> b Source #

foldr1 :: (a -> a -> a) -> IntMap a -> a Source #

foldl1 :: (a -> a -> a) -> IntMap a -> a Source #

toList :: IntMap a -> [a] Source #

null :: IntMap a -> Bool Source #

length :: IntMap a -> Int Source #

elem :: Eq a => a -> IntMap a -> Bool Source #

maximum :: Ord a => IntMap a -> a Source #

minimum :: Ord a => IntMap a -> a Source #

sum :: Num a => IntMap a -> a Source #

product :: Num a => IntMap a -> a Source #

Foldable Digit |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => Digit m -> m Source #

foldMap :: Monoid m => (a -> m) -> Digit a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Digit a -> m Source #

foldr :: (a -> b -> b) -> b -> Digit a -> b Source #

foldr' :: (a -> b -> b) -> b -> Digit a -> b Source #

foldl :: (b -> a -> b) -> b -> Digit a -> b Source #

foldl' :: (b -> a -> b) -> b -> Digit a -> b Source #

foldr1 :: (a -> a -> a) -> Digit a -> a Source #

foldl1 :: (a -> a -> a) -> Digit a -> a Source #

toList :: Digit a -> [a] Source #

null :: Digit a -> Bool Source #

length :: Digit a -> Int Source #

elem :: Eq a => a -> Digit a -> Bool Source #

maximum :: Ord a => Digit a -> a Source #

minimum :: Ord a => Digit a -> a Source #

sum :: Num a => Digit a -> a Source #

product :: Num a => Digit a -> a Source #

Foldable Elem |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => Elem m -> m Source #

foldMap :: Monoid m => (a -> m) -> Elem a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Elem a -> m Source #

foldr :: (a -> b -> b) -> b -> Elem a -> b Source #

foldr' :: (a -> b -> b) -> b -> Elem a -> b Source #

foldl :: (b -> a -> b) -> b -> Elem a -> b Source #

foldl' :: (b -> a -> b) -> b -> Elem a -> b Source #

foldr1 :: (a -> a -> a) -> Elem a -> a Source #

foldl1 :: (a -> a -> a) -> Elem a -> a Source #

toList :: Elem a -> [a] Source #

null :: Elem a -> Bool Source #

length :: Elem a -> Int Source #

elem :: Eq a => a -> Elem a -> Bool Source #

maximum :: Ord a => Elem a -> a Source #

minimum :: Ord a => Elem a -> a Source #

sum :: Num a => Elem a -> a Source #

product :: Num a => Elem a -> a Source #

Foldable FingerTree |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => FingerTree m -> m Source #

foldMap :: Monoid m => (a -> m) -> FingerTree a -> m Source #

foldMap' :: Monoid m => (a -> m) -> FingerTree a -> m Source #

foldr :: (a -> b -> b) -> b -> FingerTree a -> b Source #

foldr' :: (a -> b -> b) -> b -> FingerTree a -> b Source #

foldl :: (b -> a -> b) -> b -> FingerTree a -> b Source #

foldl' :: (b -> a -> b) -> b -> FingerTree a -> b Source #

foldr1 :: (a -> a -> a) -> FingerTree a -> a Source #

foldl1 :: (a -> a -> a) -> FingerTree a -> a Source #

toList :: FingerTree a -> [a] Source #

null :: FingerTree a -> Bool Source #

length :: FingerTree a -> Int Source #

elem :: Eq a => a -> FingerTree a -> Bool Source #

maximum :: Ord a => FingerTree a -> a Source #

minimum :: Ord a => FingerTree a -> a Source #

sum :: Num a => FingerTree a -> a Source #

product :: Num a => FingerTree a -> a Source #

Foldable Node |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => Node m -> m Source #

foldMap :: Monoid m => (a -> m) -> Node a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Node a -> m Source #

foldr :: (a -> b -> b) -> b -> Node a -> b Source #

foldr' :: (a -> b -> b) -> b -> Node a -> b Source #

foldl :: (b -> a -> b) -> b -> Node a -> b Source #

foldl' :: (b -> a -> b) -> b -> Node a -> b Source #

foldr1 :: (a -> a -> a) -> Node a -> a Source #

foldl1 :: (a -> a -> a) -> Node a -> a Source #

toList :: Node a -> [a] Source #

null :: Node a -> Bool Source #

length :: Node a -> Int Source #

elem :: Eq a => a -> Node a -> Bool Source #

maximum :: Ord a => Node a -> a Source #

minimum :: Ord a => Node a -> a Source #

sum :: Num a => Node a -> a Source #

product :: Num a => Node a -> a Source #

Foldable Seq |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => Seq m -> m Source #

foldMap :: Monoid m => (a -> m) -> Seq a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Seq a -> m Source #

foldr :: (a -> b -> b) -> b -> Seq a -> b Source #

foldr' :: (a -> b -> b) -> b -> Seq a -> b Source #

foldl :: (b -> a -> b) -> b -> Seq a -> b Source #

foldl' :: (b -> a -> b) -> b -> Seq a -> b Source #

foldr1 :: (a -> a -> a) -> Seq a -> a Source #

foldl1 :: (a -> a -> a) -> Seq a -> a Source #

toList :: Seq a -> [a] Source #

null :: Seq a -> Bool Source #

length :: Seq a -> Int Source #

elem :: Eq a => a -> Seq a -> Bool Source #

maximum :: Ord a => Seq a -> a Source #

minimum :: Ord a => Seq a -> a Source #

sum :: Num a => Seq a -> a Source #

product :: Num a => Seq a -> a Source #

Foldable ViewL |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => ViewL m -> m Source #

foldMap :: Monoid m => (a -> m) -> ViewL a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ViewL a -> m Source #

foldr :: (a -> b -> b) -> b -> ViewL a -> b Source #

foldr' :: (a -> b -> b) -> b -> ViewL a -> b Source #

foldl :: (b -> a -> b) -> b -> ViewL a -> b Source #

foldl' :: (b -> a -> b) -> b -> ViewL a -> b Source #

foldr1 :: (a -> a -> a) -> ViewL a -> a Source #

foldl1 :: (a -> a -> a) -> ViewL a -> a Source #

toList :: ViewL a -> [a] Source #

null :: ViewL a -> Bool Source #

length :: ViewL a -> Int Source #

elem :: Eq a => a -> ViewL a -> Bool Source #

maximum :: Ord a => ViewL a -> a Source #

minimum :: Ord a => ViewL a -> a Source #

sum :: Num a => ViewL a -> a Source #

product :: Num a => ViewL a -> a Source #

Foldable ViewR |

Instance details

Defined in Data.Sequence.Internal

Methods

fold :: Monoid m => ViewR m -> m Source #

foldMap :: Monoid m => (a -> m) -> ViewR a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ViewR a -> m Source #

foldr :: (a -> b -> b) -> b -> ViewR a -> b Source #

foldr' :: (a -> b -> b) -> b -> ViewR a -> b Source #

foldl :: (b -> a -> b) -> b -> ViewR a -> b Source #

foldl' :: (b -> a -> b) -> b -> ViewR a -> b Source #

foldr1 :: (a -> a -> a) -> ViewR a -> a Source #

foldl1 :: (a -> a -> a) -> ViewR a -> a Source #

toList :: ViewR a -> [a] Source #

null :: ViewR a -> Bool Source #

length :: ViewR a -> Int Source #

elem :: Eq a => a -> ViewR a -> Bool Source #

maximum :: Ord a => ViewR a -> a Source #

minimum :: Ord a => ViewR a -> a Source #

sum :: Num a => ViewR a -> a Source #

product :: Num a => ViewR a -> a Source #

Foldable Set | Folds in order of increasing key.

Instance details

Defined in Data.Set.Internal

Methods

fold :: Monoid m => Set m -> m Source #

foldMap :: Monoid m => (a -> m) -> Set a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Set a -> m Source #

foldr :: (a -> b -> b) -> b -> Set a -> b Source #

foldr' :: (a -> b -> b) -> b -> Set a -> b Source #

foldl :: (b -> a -> b) -> b -> Set a -> b Source #

foldl' :: (b -> a -> b) -> b -> Set a -> b Source #

foldr1 :: (a -> a -> a) -> Set a -> a Source #

foldl1 :: (a -> a -> a) -> Set a -> a Source #

toList :: Set a -> [a] Source #

null :: Set a -> Bool Source #

length :: Set a -> Int Source #

elem :: Eq a => a -> Set a -> Bool Source #

maximum :: Ord a => Set a -> a Source #

minimum :: Ord a => Set a -> a Source #

sum :: Num a => Set a -> a Source #

product :: Num a => Set a -> a Source #

Foldable Tree | Folds in preorder

Instance details

Defined in Data.Tree

Methods

fold :: Monoid m => Tree m -> m Source #

foldMap :: Monoid m => (a -> m) -> Tree a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Tree a -> m Source #

foldr :: (a -> b -> b) -> b -> Tree a -> b Source #

foldr' :: (a -> b -> b) -> b -> Tree a -> b Source #

foldl :: (b -> a -> b) -> b -> Tree a -> b Source #

foldl' :: (b -> a -> b) -> b -> Tree a -> b Source #

foldr1 :: (a -> a -> a) -> Tree a -> a Source #

foldl1 :: (a -> a -> a) -> Tree a -> a Source #

toList :: Tree a -> [a] Source #

null :: Tree a -> Bool Source #

length :: Tree a -> Int Source #

elem :: Eq a => a -> Tree a -> Bool Source #

maximum :: Ord a => Tree a -> a Source #

minimum :: Ord a => Tree a -> a Source #

sum :: Num a => Tree a -> a Source #

product :: Num a => Tree a -> a Source #

Foldable NonEmpty | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => NonEmpty m -> m Source #

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m Source #

foldMap' :: Monoid m => (a -> m) -> NonEmpty a -> m Source #

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b Source #

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b Source #

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b Source #

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b Source #

foldr1 :: (a -> a -> a) -> NonEmpty a -> a Source #

foldl1 :: (a -> a -> a) -> NonEmpty a -> a Source #

toList :: NonEmpty a -> [a] Source #

null :: NonEmpty a -> Bool Source #

length :: NonEmpty a -> Int Source #

elem :: Eq a => a -> NonEmpty a -> Bool Source #

maximum :: Ord a => NonEmpty a -> a Source #

minimum :: Ord a => NonEmpty a -> a Source #

sum :: Num a => NonEmpty a -> a Source #

product :: Num a => NonEmpty a -> a Source #

Foldable Identity | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Identity

Methods

fold :: Monoid m => Identity m -> m Source #

foldMap :: Monoid m => (a -> m) -> Identity a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Identity a -> m Source #

foldr :: (a -> b -> b) -> b -> Identity a -> b Source #

foldr' :: (a -> b -> b) -> b -> Identity a -> b Source #

foldl :: (b -> a -> b) -> b -> Identity a -> b Source #

foldl' :: (b -> a -> b) -> b -> Identity a -> b Source #

foldr1 :: (a -> a -> a) -> Identity a -> a Source #

foldl1 :: (a -> a -> a) -> Identity a -> a Source #

toList :: Identity a -> [a] Source #

null :: Identity a -> Bool Source #

length :: Identity a -> Int Source #

elem :: Eq a => a -> Identity a -> Bool Source #

maximum :: Ord a => Identity a -> a Source #

minimum :: Ord a => Identity a -> a Source #

sum :: Num a => Identity a -> a Source #

product :: Num a => Identity a -> a Source #

Foldable First | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => First m -> m Source #

foldMap :: Monoid m => (a -> m) -> First a -> m Source #

foldMap' :: Monoid m => (a -> m) -> First a -> m Source #

foldr :: (a -> b -> b) -> b -> First a -> b Source #

foldr' :: (a -> b -> b) -> b -> First a -> b Source #

foldl :: (b -> a -> b) -> b -> First a -> b Source #

foldl' :: (b -> a -> b) -> b -> First a -> b Source #

foldr1 :: (a -> a -> a) -> First a -> a Source #

foldl1 :: (a -> a -> a) -> First a -> a Source #

toList :: First a -> [a] Source #

null :: First a -> Bool Source #

length :: First a -> Int Source #

elem :: Eq a => a -> First a -> Bool Source #

maximum :: Ord a => First a -> a Source #

minimum :: Ord a => First a -> a Source #

sum :: Num a => First a -> a Source #

product :: Num a => First a -> a Source #

Foldable Last | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Last m -> m Source #

foldMap :: Monoid m => (a -> m) -> Last a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Last a -> m Source #

foldr :: (a -> b -> b) -> b -> Last a -> b Source #

foldr' :: (a -> b -> b) -> b -> Last a -> b Source #

foldl :: (b -> a -> b) -> b -> Last a -> b Source #

foldl' :: (b -> a -> b) -> b -> Last a -> b Source #

foldr1 :: (a -> a -> a) -> Last a -> a Source #

foldl1 :: (a -> a -> a) -> Last a -> a Source #

toList :: Last a -> [a] Source #

null :: Last a -> Bool Source #

length :: Last a -> Int Source #

elem :: Eq a => a -> Last a -> Bool Source #

maximum :: Ord a => Last a -> a Source #

minimum :: Ord a => Last a -> a Source #

sum :: Num a => Last a -> a Source #

product :: Num a => Last a -> a Source #

Foldable Down | Since: base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Down m -> m Source #

foldMap :: Monoid m => (a -> m) -> Down a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Down a -> m Source #

foldr :: (a -> b -> b) -> b -> Down a -> b Source #

foldr' :: (a -> b -> b) -> b -> Down a -> b Source #

foldl :: (b -> a -> b) -> b -> Down a -> b Source #

foldl' :: (b -> a -> b) -> b -> Down a -> b Source #

foldr1 :: (a -> a -> a) -> Down a -> a Source #

foldl1 :: (a -> a -> a) -> Down a -> a Source #

toList :: Down a -> [a] Source #

null :: Down a -> Bool Source #

length :: Down a -> Int Source #

elem :: Eq a => a -> Down a -> Bool Source #

maximum :: Ord a => Down a -> a Source #

minimum :: Ord a => Down a -> a Source #

sum :: Num a => Down a -> a Source #

product :: Num a => Down a -> a Source #

Foldable Dual | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Dual m -> m Source #

foldMap :: Monoid m => (a -> m) -> Dual a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Dual a -> m Source #

foldr :: (a -> b -> b) -> b -> Dual a -> b Source #

foldr' :: (a -> b -> b) -> b -> Dual a -> b Source #

foldl :: (b -> a -> b) -> b -> Dual a -> b Source #

foldl' :: (b -> a -> b) -> b -> Dual a -> b Source #

foldr1 :: (a -> a -> a) -> Dual a -> a Source #

foldl1 :: (a -> a -> a) -> Dual a -> a Source #

toList :: Dual a -> [a] Source #

null :: Dual a -> Bool Source #

length :: Dual a -> Int Source #

elem :: Eq a => a -> Dual a -> Bool Source #

maximum :: Ord a => Dual a -> a Source #

minimum :: Ord a => Dual a -> a Source #

sum :: Num a => Dual a -> a Source #

product :: Num a => Dual a -> a Source #

Foldable Product | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Product m -> m Source #

foldMap :: Monoid m => (a -> m) -> Product a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Product a -> m Source #

foldr :: (a -> b -> b) -> b -> Product a -> b Source #

foldr' :: (a -> b -> b) -> b -> Product a -> b Source #

foldl :: (b -> a -> b) -> b -> Product a -> b Source #

foldl' :: (b -> a -> b) -> b -> Product a -> b Source #

foldr1 :: (a -> a -> a) -> Product a -> a Source #

foldl1 :: (a -> a -> a) -> Product a -> a Source #

toList :: Product a -> [a] Source #

null :: Product a -> Bool Source #

length :: Product a -> Int Source #

elem :: Eq a => a -> Product a -> Bool Source #

maximum :: Ord a => Product a -> a Source #

minimum :: Ord a => Product a -> a Source #

sum :: Num a => Product a -> a Source #

product :: Num a => Product a -> a Source #

Foldable Sum | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Sum m -> m Source #

foldMap :: Monoid m => (a -> m) -> Sum a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Sum a -> m Source #

foldr :: (a -> b -> b) -> b -> Sum a -> b Source #

foldr' :: (a -> b -> b) -> b -> Sum a -> b Source #

foldl :: (b -> a -> b) -> b -> Sum a -> b Source #

foldl' :: (b -> a -> b) -> b -> Sum a -> b Source #

foldr1 :: (a -> a -> a) -> Sum a -> a Source #

foldl1 :: (a -> a -> a) -> Sum a -> a Source #

toList :: Sum a -> [a] Source #

null :: Sum a -> Bool Source #

length :: Sum a -> Int Source #

elem :: Eq a => a -> Sum a -> Bool Source #

maximum :: Ord a => Sum a -> a Source #

minimum :: Ord a => Sum a -> a Source #

sum :: Num a => Sum a -> a Source #

product :: Num a => Sum a -> a Source #

Foldable ZipList | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Functor.ZipList

Methods

fold :: Monoid m => ZipList m -> m Source #

foldMap :: Monoid m => (a -> m) -> ZipList a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ZipList a -> m Source #

foldr :: (a -> b -> b) -> b -> ZipList a -> b Source #

foldr' :: (a -> b -> b) -> b -> ZipList a -> b Source #

foldl :: (b -> a -> b) -> b -> ZipList a -> b Source #

foldl' :: (b -> a -> b) -> b -> ZipList a -> b Source #

foldr1 :: (a -> a -> a) -> ZipList a -> a Source #

foldl1 :: (a -> a -> a) -> ZipList a -> a Source #

toList :: ZipList a -> [a] Source #

null :: ZipList a -> Bool Source #

length :: ZipList a -> Int Source #

elem :: Eq a => a -> ZipList a -> Bool Source #

maximum :: Ord a => ZipList a -> a Source #

minimum :: Ord a => ZipList a -> a Source #

sum :: Num a => ZipList a -> a Source #

product :: Num a => ZipList a -> a Source #

Foldable Par1 | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Par1 m -> m Source #

foldMap :: Monoid m => (a -> m) -> Par1 a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Par1 a -> m Source #

foldr :: (a -> b -> b) -> b -> Par1 a -> b Source #

foldr' :: (a -> b -> b) -> b -> Par1 a -> b Source #

foldl :: (b -> a -> b) -> b -> Par1 a -> b Source #

foldl' :: (b -> a -> b) -> b -> Par1 a -> b Source #

foldr1 :: (a -> a -> a) -> Par1 a -> a Source #

foldl1 :: (a -> a -> a) -> Par1 a -> a Source #

toList :: Par1 a -> [a] Source #

null :: Par1 a -> Bool Source #

length :: Par1 a -> Int Source #

elem :: Eq a => a -> Par1 a -> Bool Source #

maximum :: Ord a => Par1 a -> a Source #

minimum :: Ord a => Par1 a -> a Source #

sum :: Num a => Par1 a -> a Source #

product :: Num a => Par1 a -> a Source #

Foldable TyVarBndr |

Instance details

Defined in Language.Haskell.TH.Syntax

Methods

fold :: Monoid m => TyVarBndr m -> m Source #

foldMap :: Monoid m => (a -> m) -> TyVarBndr a -> m Source #

foldMap' :: Monoid m => (a -> m) -> TyVarBndr a -> m Source #

foldr :: (a -> b -> b) -> b -> TyVarBndr a -> b Source #

foldr' :: (a -> b -> b) -> b -> TyVarBndr a -> b Source #

foldl :: (b -> a -> b) -> b -> TyVarBndr a -> b Source #

foldl' :: (b -> a -> b) -> b -> TyVarBndr a -> b Source #

foldr1 :: (a -> a -> a) -> TyVarBndr a -> a Source #

foldl1 :: (a -> a -> a) -> TyVarBndr a -> a Source #

toList :: TyVarBndr a -> [a] Source #

null :: TyVarBndr a -> Bool Source #

length :: TyVarBndr a -> Int Source #

elem :: Eq a => a -> TyVarBndr a -> Bool Source #

maximum :: Ord a => TyVarBndr a -> a Source #

minimum :: Ord a => TyVarBndr a -> a Source #

sum :: Num a => TyVarBndr a -> a Source #

product :: Num a => TyVarBndr a -> a Source #

Foldable Directories' |

Instance details

Defined in XMonad.Core

Methods

fold :: Monoid m => Directories' m -> m Source #

foldMap :: Monoid m => (a -> m) -> Directories' a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Directories' a -> m Source #

foldr :: (a -> b -> b) -> b -> Directories' a -> b Source #

foldr' :: (a -> b -> b) -> b -> Directories' a -> b Source #

foldl :: (b -> a -> b) -> b -> Directories' a -> b Source #

foldl' :: (b -> a -> b) -> b -> Directories' a -> b Source #

foldr1 :: (a -> a -> a) -> Directories' a -> a Source #

foldl1 :: (a -> a -> a) -> Directories' a -> a Source #

toList :: Directories' a -> [a] Source #

null :: Directories' a -> Bool Source #

length :: Directories' a -> Int Source #

elem :: Eq a => a -> Directories' a -> Bool Source #

maximum :: Ord a => Directories' a -> a Source #

minimum :: Ord a => Directories' a -> a Source #

sum :: Num a => Directories' a -> a Source #

product :: Num a => Directories' a -> a Source #

Foldable Stack |

Instance details

Defined in XMonad.StackSet

Methods

fold :: Monoid m => Stack m -> m Source #

foldMap :: Monoid m => (a -> m) -> Stack a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Stack a -> m Source #

foldr :: (a -> b -> b) -> b -> Stack a -> b Source #

foldr' :: (a -> b -> b) -> b -> Stack a -> b Source #

foldl :: (b -> a -> b) -> b -> Stack a -> b Source #

foldl' :: (b -> a -> b) -> b -> Stack a -> b Source #

foldr1 :: (a -> a -> a) -> Stack a -> a Source #

foldl1 :: (a -> a -> a) -> Stack a -> a Source #

toList :: Stack a -> [a] Source #

null :: Stack a -> Bool Source #

length :: Stack a -> Int Source #

elem :: Eq a => a -> Stack a -> Bool Source #

maximum :: Ord a => Stack a -> a Source #

minimum :: Ord a => Stack a -> a Source #

sum :: Num a => Stack a -> a Source #

product :: Num a => Stack a -> a Source #

Foldable Cursors Source # |

Instance details

Defined in XMonad.Actions.WorkspaceCursors

Methods

fold :: Monoid m => Cursors m -> m Source #

foldMap :: Monoid m => (a -> m) -> Cursors a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Cursors a -> m Source #

foldr :: (a -> b -> b) -> b -> Cursors a -> b Source #

foldr' :: (a -> b -> b) -> b -> Cursors a -> b Source #

foldl :: (b -> a -> b) -> b -> Cursors a -> b Source #

foldl' :: (b -> a -> b) -> b -> Cursors a -> b Source #

foldr1 :: (a -> a -> a) -> Cursors a -> a Source #

foldl1 :: (a -> a -> a) -> Cursors a -> a Source #

toList :: Cursors a -> [a] Source #

null :: Cursors a -> Bool Source #

length :: Cursors a -> Int Source #

elem :: Eq a => a -> Cursors a -> Bool Source #

maximum :: Ord a => Cursors a -> a Source #

minimum :: Ord a => Cursors a -> a Source #

sum :: Num a => Cursors a -> a Source #

product :: Num a => Cursors a -> a Source #

Foldable Maybe | Since: base-2.1

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

toList :: Maybe a -> [a] Source #

null :: Maybe a -> Bool Source #

length :: Maybe a -> Int Source #

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

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

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

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

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

Foldable Solo | Since: base-4.15

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Solo m -> m Source #

foldMap :: Monoid m => (a -> m) -> Solo a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Solo a -> m Source #

foldr :: (a -> b -> b) -> b -> Solo a -> b Source #

foldr' :: (a -> b -> b) -> b -> Solo a -> b Source #

foldl :: (b -> a -> b) -> b -> Solo a -> b Source #

foldl' :: (b -> a -> b) -> b -> Solo a -> b Source #

foldr1 :: (a -> a -> a) -> Solo a -> a Source #

foldl1 :: (a -> a -> a) -> Solo a -> a Source #

toList :: Solo a -> [a] Source #

null :: Solo a -> Bool Source #

length :: Solo a -> Int Source #

elem :: Eq a => a -> Solo a -> Bool Source #

maximum :: Ord a => Solo a -> a Source #

minimum :: Ord a => Solo a -> a Source #

sum :: Num a => Solo a -> a Source #

product :: Num a => Solo a -> a Source #

Foldable [] | Since: base-2.1

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => [m] -> m Source #

foldMap :: Monoid m => (a -> m) -> [a] -> m Source #

foldMap' :: Monoid m => (a -> m) -> [a] -> m Source #

foldr :: (a -> b -> b) -> b -> [a] -> b Source #

foldr' :: (a -> b -> b) -> b -> [a] -> b Source #

foldl :: (b -> a -> b) -> b -> [a] -> b Source #

foldl' :: (b -> a -> b) -> b -> [a] -> b Source #

foldr1 :: (a -> a -> a) -> [a] -> a Source #

foldl1 :: (a -> a -> a) -> [a] -> a Source #

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

null :: [a] -> Bool Source #

length :: [a] -> Int Source #

elem :: Eq a => a -> [a] -> Bool Source #

maximum :: Ord a => [a] -> a Source #

minimum :: Ord a => [a] -> a Source #

sum :: Num a => [a] -> a Source #

product :: Num a => [a] -> a Source #

Foldable (Arg a) | Since: base-4.9.0.0

Instance details

Defined in Data.Semigroup

Methods

fold :: Monoid m => Arg a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Arg a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Arg a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Arg a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Arg a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Arg a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Arg a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Arg a a0 -> a0 Source #

toList :: Arg a a0 -> [a0] Source #

null :: Arg a a0 -> Bool Source #

length :: Arg a a0 -> Int Source #

elem :: Eq a0 => a0 -> Arg a a0 -> Bool Source #

maximum :: Ord a0 => Arg a a0 -> a0 Source #

minimum :: Ord a0 => Arg a a0 -> a0 Source #

sum :: Num a0 => Arg a a0 -> a0 Source #

product :: Num a0 => Arg a a0 -> a0 Source #

Foldable (Map k) | Folds in order of increasing key.

Instance details

Defined in Data.Map.Internal

Methods

fold :: Monoid m => Map k m -> m Source #

foldMap :: Monoid m => (a -> m) -> Map k a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Map k a -> m Source #

foldr :: (a -> b -> b) -> b -> Map k a -> b Source #

foldr' :: (a -> b -> b) -> b -> Map k a -> b Source #

foldl :: (b -> a -> b) -> b -> Map k a -> b Source #

foldl' :: (b -> a -> b) -> b -> Map k a -> b Source #

foldr1 :: (a -> a -> a) -> Map k a -> a Source #

foldl1 :: (a -> a -> a) -> Map k a -> a Source #

toList :: Map k a -> [a] Source #

null :: Map k a -> Bool Source #

length :: Map k a -> Int Source #

elem :: Eq a => a -> Map k a -> Bool Source #

maximum :: Ord a => Map k a -> a Source #

minimum :: Ord a => Map k a -> a Source #

sum :: Num a => Map k a -> a Source #

product :: Num a => Map k a -> a Source #

Foldable (Array i) | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Array i m -> m Source #

foldMap :: Monoid m => (a -> m) -> Array i a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Array i a -> m Source #

foldr :: (a -> b -> b) -> b -> Array i a -> b Source #

foldr' :: (a -> b -> b) -> b -> Array i a -> b Source #

foldl :: (b -> a -> b) -> b -> Array i a -> b Source #

foldl' :: (b -> a -> b) -> b -> Array i a -> b Source #

foldr1 :: (a -> a -> a) -> Array i a -> a Source #

foldl1 :: (a -> a -> a) -> Array i a -> a Source #

toList :: Array i a -> [a] Source #

null :: Array i a -> Bool Source #

length :: Array i a -> Int Source #

elem :: Eq a => a -> Array i a -> Bool Source #

maximum :: Ord a => Array i a -> a Source #

minimum :: Ord a => Array i a -> a Source #

sum :: Num a => Array i a -> a Source #

product :: Num a => Array i a -> a Source #

Foldable (Either a) | Since: base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

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

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

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

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

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

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

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

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

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

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

null :: Either a a0 -> Bool Source #

length :: Either a a0 -> Int Source #

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

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

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

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

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

Foldable (Proxy :: Type -> Type) | Since: base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Proxy m -> m Source #

foldMap :: Monoid m => (a -> m) -> Proxy a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Proxy a -> m Source #

foldr :: (a -> b -> b) -> b -> Proxy a -> b Source #

foldr' :: (a -> b -> b) -> b -> Proxy a -> b Source #

foldl :: (b -> a -> b) -> b -> Proxy a -> b Source #

foldl' :: (b -> a -> b) -> b -> Proxy a -> b Source #

foldr1 :: (a -> a -> a) -> Proxy a -> a Source #

foldl1 :: (a -> a -> a) -> Proxy a -> a Source #

toList :: Proxy a -> [a] Source #

null :: Proxy a -> Bool Source #

length :: Proxy a -> Int Source #

elem :: Eq a => a -> Proxy a -> Bool Source #

maximum :: Ord a => Proxy a -> a Source #

minimum :: Ord a => Proxy a -> a Source #

sum :: Num a => Proxy a -> a Source #

product :: Num a => Proxy a -> a Source #

Foldable (U1 :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => U1 m -> m Source #

foldMap :: Monoid m => (a -> m) -> U1 a -> m Source #

foldMap' :: Monoid m => (a -> m) -> U1 a -> m Source #

foldr :: (a -> b -> b) -> b -> U1 a -> b Source #

foldr' :: (a -> b -> b) -> b -> U1 a -> b Source #

foldl :: (b -> a -> b) -> b -> U1 a -> b Source #

foldl' :: (b -> a -> b) -> b -> U1 a -> b Source #

foldr1 :: (a -> a -> a) -> U1 a -> a Source #

foldl1 :: (a -> a -> a) -> U1 a -> a Source #

toList :: U1 a -> [a] Source #

null :: U1 a -> Bool Source #

length :: U1 a -> Int Source #

elem :: Eq a => a -> U1 a -> Bool Source #

maximum :: Ord a => U1 a -> a Source #

minimum :: Ord a => U1 a -> a Source #

sum :: Num a => U1 a -> a Source #

product :: Num a => U1 a -> a Source #

Foldable (UAddr :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => UAddr m -> m Source #

foldMap :: Monoid m => (a -> m) -> UAddr a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UAddr a -> m Source #

foldr :: (a -> b -> b) -> b -> UAddr a -> b Source #

foldr' :: (a -> b -> b) -> b -> UAddr a -> b Source #

foldl :: (b -> a -> b) -> b -> UAddr a -> b Source #

foldl' :: (b -> a -> b) -> b -> UAddr a -> b Source #

foldr1 :: (a -> a -> a) -> UAddr a -> a Source #

foldl1 :: (a -> a -> a) -> UAddr a -> a Source #

toList :: UAddr a -> [a] Source #

null :: UAddr a -> Bool Source #

length :: UAddr a -> Int Source #

elem :: Eq a => a -> UAddr a -> Bool Source #

maximum :: Ord a => UAddr a -> a Source #

minimum :: Ord a => UAddr a -> a Source #

sum :: Num a => UAddr a -> a Source #

product :: Num a => UAddr a -> a Source #

Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => UChar m -> m Source #

foldMap :: Monoid m => (a -> m) -> UChar a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UChar a -> m Source #

foldr :: (a -> b -> b) -> b -> UChar a -> b Source #

foldr' :: (a -> b -> b) -> b -> UChar a -> b Source #

foldl :: (b -> a -> b) -> b -> UChar a -> b Source #

foldl' :: (b -> a -> b) -> b -> UChar a -> b Source #

foldr1 :: (a -> a -> a) -> UChar a -> a Source #

foldl1 :: (a -> a -> a) -> UChar a -> a Source #

toList :: UChar a -> [a] Source #

null :: UChar a -> Bool Source #

length :: UChar a -> Int Source #

elem :: Eq a => a -> UChar a -> Bool Source #

maximum :: Ord a => UChar a -> a Source #

minimum :: Ord a => UChar a -> a Source #

sum :: Num a => UChar a -> a Source #

product :: Num a => UChar a -> a Source #

Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => UDouble m -> m Source #

foldMap :: Monoid m => (a -> m) -> UDouble a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UDouble a -> m Source #

foldr :: (a -> b -> b) -> b -> UDouble a -> b Source #

foldr' :: (a -> b -> b) -> b -> UDouble a -> b Source #

foldl :: (b -> a -> b) -> b -> UDouble a -> b Source #

foldl' :: (b -> a -> b) -> b -> UDouble a -> b Source #

foldr1 :: (a -> a -> a) -> UDouble a -> a Source #

foldl1 :: (a -> a -> a) -> UDouble a -> a Source #

toList :: UDouble a -> [a] Source #

null :: UDouble a -> Bool Source #

length :: UDouble a -> Int Source #

elem :: Eq a => a -> UDouble a -> Bool Source #

maximum :: Ord a => UDouble a -> a Source #

minimum :: Ord a => UDouble a -> a Source #

sum :: Num a => UDouble a -> a Source #

product :: Num a => UDouble a -> a Source #

Foldable (UFloat :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => UFloat m -> m Source #

foldMap :: Monoid m => (a -> m) -> UFloat a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UFloat a -> m Source #

foldr :: (a -> b -> b) -> b -> UFloat a -> b Source #

foldr' :: (a -> b -> b) -> b -> UFloat a -> b Source #

foldl :: (b -> a -> b) -> b -> UFloat a -> b Source #

foldl' :: (b -> a -> b) -> b -> UFloat a -> b Source #

foldr1 :: (a -> a -> a) -> UFloat a -> a Source #

foldl1 :: (a -> a -> a) -> UFloat a -> a Source #

toList :: UFloat a -> [a] Source #

null :: UFloat a -> Bool Source #

length :: UFloat a -> Int Source #

elem :: Eq a => a -> UFloat a -> Bool Source #

maximum :: Ord a => UFloat a -> a Source #

minimum :: Ord a => UFloat a -> a Source #

sum :: Num a => UFloat a -> a Source #

product :: Num a => UFloat a -> a Source #

Foldable (UInt :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => UInt m -> m Source #

foldMap :: Monoid m => (a -> m) -> UInt a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UInt a -> m Source #

foldr :: (a -> b -> b) -> b -> UInt a -> b Source #

foldr' :: (a -> b -> b) -> b -> UInt a -> b Source #

foldl :: (b -> a -> b) -> b -> UInt a -> b Source #

foldl' :: (b -> a -> b) -> b -> UInt a -> b Source #

foldr1 :: (a -> a -> a) -> UInt a -> a Source #

foldl1 :: (a -> a -> a) -> UInt a -> a Source #

toList :: UInt a -> [a] Source #

null :: UInt a -> Bool Source #

length :: UInt a -> Int Source #

elem :: Eq a => a -> UInt a -> Bool Source #

maximum :: Ord a => UInt a -> a Source #

minimum :: Ord a => UInt a -> a Source #

sum :: Num a => UInt a -> a Source #

product :: Num a => UInt a -> a Source #

Foldable (UWord :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => UWord m -> m Source #

foldMap :: Monoid m => (a -> m) -> UWord a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UWord a -> m Source #

foldr :: (a -> b -> b) -> b -> UWord a -> b Source #

foldr' :: (a -> b -> b) -> b -> UWord a -> b Source #

foldl :: (b -> a -> b) -> b -> UWord a -> b Source #

foldl' :: (b -> a -> b) -> b -> UWord a -> b Source #

foldr1 :: (a -> a -> a) -> UWord a -> a Source #

foldl1 :: (a -> a -> a) -> UWord a -> a Source #

toList :: UWord a -> [a] Source #

null :: UWord a -> Bool Source #

length :: UWord a -> Int Source #

elem :: Eq a => a -> UWord a -> Bool Source #

maximum :: Ord a => UWord a -> a Source #

minimum :: Ord a => UWord a -> a Source #

sum :: Num a => UWord a -> a Source #

product :: Num a => UWord a -> a Source #

Foldable (V1 :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => V1 m -> m Source #

foldMap :: Monoid m => (a -> m) -> V1 a -> m Source #

foldMap' :: Monoid m => (a -> m) -> V1 a -> m Source #

foldr :: (a -> b -> b) -> b -> V1 a -> b Source #

foldr' :: (a -> b -> b) -> b -> V1 a -> b Source #

foldl :: (b -> a -> b) -> b -> V1 a -> b Source #

foldl' :: (b -> a -> b) -> b -> V1 a -> b Source #

foldr1 :: (a -> a -> a) -> V1 a -> a Source #

foldl1 :: (a -> a -> a) -> V1 a -> a Source #

toList :: V1 a -> [a] Source #

null :: V1 a -> Bool Source #

length :: V1 a -> Int Source #

elem :: Eq a => a -> V1 a -> Bool Source #

maximum :: Ord a => V1 a -> a Source #

minimum :: Ord a => V1 a -> a Source #

sum :: Num a => V1 a -> a Source #

product :: Num a => V1 a -> a Source #

Foldable f => Foldable (Lift f) |

Instance details

Defined in Control.Applicative.Lift

Methods

fold :: Monoid m => Lift f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Lift f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Lift f a -> m Source #

foldr :: (a -> b -> b) -> b -> Lift f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Lift f a -> b Source #

foldl :: (b -> a -> b) -> b -> Lift f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Lift f a -> b Source #

foldr1 :: (a -> a -> a) -> Lift f a -> a Source #

foldl1 :: (a -> a -> a) -> Lift f a -> a Source #

toList :: Lift f a -> [a] Source #

null :: Lift f a -> Bool Source #

length :: Lift f a -> Int Source #

elem :: Eq a => a -> Lift f a -> Bool Source #

maximum :: Ord a => Lift f a -> a Source #

minimum :: Ord a => Lift f a -> a Source #

sum :: Num a => Lift f a -> a Source #

product :: Num a => Lift f a -> a Source #

Foldable f => Foldable (MaybeT f) |

Instance details

Defined in Control.Monad.Trans.Maybe

Methods

fold :: Monoid m => MaybeT f m -> m Source #

foldMap :: Monoid m => (a -> m) -> MaybeT f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> MaybeT f a -> m Source #

foldr :: (a -> b -> b) -> b -> MaybeT f a -> b Source #

foldr' :: (a -> b -> b) -> b -> MaybeT f a -> b Source #

foldl :: (b -> a -> b) -> b -> MaybeT f a -> b Source #

foldl' :: (b -> a -> b) -> b -> MaybeT f a -> b Source #

foldr1 :: (a -> a -> a) -> MaybeT f a -> a Source #

foldl1 :: (a -> a -> a) -> MaybeT f a -> a Source #

toList :: MaybeT f a -> [a] Source #

null :: MaybeT f a -> Bool Source #

length :: MaybeT f a -> Int Source #

elem :: Eq a => a -> MaybeT f a -> Bool Source #

maximum :: Ord a => MaybeT f a -> a Source #

minimum :: Ord a => MaybeT f a -> a Source #

sum :: Num a => MaybeT f a -> a Source #

product :: Num a => MaybeT f a -> a Source #

Foldable (History k) Source # |

Instance details

Defined in XMonad.Util.History

Methods

fold :: Monoid m => History k m -> m Source #

foldMap :: Monoid m => (a -> m) -> History k a -> m Source #

foldMap' :: Monoid m => (a -> m) -> History k a -> m Source #

foldr :: (a -> b -> b) -> b -> History k a -> b Source #

foldr' :: (a -> b -> b) -> b -> History k a -> b Source #

foldl :: (b -> a -> b) -> b -> History k a -> b Source #

foldl' :: (b -> a -> b) -> b -> History k a -> b Source #

foldr1 :: (a -> a -> a) -> History k a -> a Source #

foldl1 :: (a -> a -> a) -> History k a -> a Source #

toList :: History k a -> [a] Source #

null :: History k a -> Bool Source #

length :: History k a -> Int Source #

elem :: Eq a => a -> History k a -> Bool Source #

maximum :: Ord a => History k a -> a Source #

minimum :: Ord a => History k a -> a Source #

sum :: Num a => History k a -> a Source #

product :: Num a => History k a -> a Source #

Foldable ((,) a) | Since: base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => (a, m) -> m Source #

foldMap :: Monoid m => (a0 -> m) -> (a, a0) -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> (a, a0) -> m Source #

foldr :: (a0 -> b -> b) -> b -> (a, a0) -> b Source #

foldr' :: (a0 -> b -> b) -> b -> (a, a0) -> b Source #

foldl :: (b -> a0 -> b) -> b -> (a, a0) -> b Source #

foldl' :: (b -> a0 -> b) -> b -> (a, a0) -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

toList :: (a, a0) -> [a0] Source #

null :: (a, a0) -> Bool Source #

length :: (a, a0) -> Int Source #

elem :: Eq a0 => a0 -> (a, a0) -> Bool Source #

maximum :: Ord a0 => (a, a0) -> a0 Source #

minimum :: Ord a0 => (a, a0) -> a0 Source #

sum :: Num a0 => (a, a0) -> a0 Source #

product :: Num a0 => (a, a0) -> a0 Source #

Foldable (Const m :: Type -> Type) | Since: base-4.7.0.0

Instance details

Defined in GHC.Internal.Data.Functor.Const

Methods

fold :: Monoid m0 => Const m m0 -> m0 Source #

foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 Source #

foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 Source #

foldr :: (a -> b -> b) -> b -> Const m a -> b Source #

foldr' :: (a -> b -> b) -> b -> Const m a -> b Source #

foldl :: (b -> a -> b) -> b -> Const m a -> b Source #

foldl' :: (b -> a -> b) -> b -> Const m a -> b Source #

foldr1 :: (a -> a -> a) -> Const m a -> a Source #

foldl1 :: (a -> a -> a) -> Const m a -> a Source #

toList :: Const m a -> [a] Source #

null :: Const m a -> Bool Source #

length :: Const m a -> Int Source #

elem :: Eq a => a -> Const m a -> Bool Source #

maximum :: Ord a => Const m a -> a Source #

minimum :: Ord a => Const m a -> a Source #

sum :: Num a => Const m a -> a Source #

product :: Num a => Const m a -> a Source #

Foldable f => Foldable (Ap f) | Since: base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Ap f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Ap f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Ap f a -> m Source #

foldr :: (a -> b -> b) -> b -> Ap f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Ap f a -> b Source #

foldl :: (b -> a -> b) -> b -> Ap f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Ap f a -> b Source #

foldr1 :: (a -> a -> a) -> Ap f a -> a Source #

foldl1 :: (a -> a -> a) -> Ap f a -> a Source #

toList :: Ap f a -> [a] Source #

null :: Ap f a -> Bool Source #

length :: Ap f a -> Int Source #

elem :: Eq a => a -> Ap f a -> Bool Source #

maximum :: Ord a => Ap f a -> a Source #

minimum :: Ord a => Ap f a -> a Source #

sum :: Num a => Ap f a -> a Source #

product :: Num a => Ap f a -> a Source #

Foldable f => Foldable (Alt f) | Since: base-4.12.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Alt f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Alt f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Alt f a -> m Source #

foldr :: (a -> b -> b) -> b -> Alt f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Alt f a -> b Source #

foldl :: (b -> a -> b) -> b -> Alt f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Alt f a -> b Source #

foldr1 :: (a -> a -> a) -> Alt f a -> a Source #

foldl1 :: (a -> a -> a) -> Alt f a -> a Source #

toList :: Alt f a -> [a] Source #

null :: Alt f a -> Bool Source #

length :: Alt f a -> Int Source #

elem :: Eq a => a -> Alt f a -> Bool Source #

maximum :: Ord a => Alt f a -> a Source #

minimum :: Ord a => Alt f a -> a Source #

sum :: Num a => Alt f a -> a Source #

product :: Num a => Alt f a -> a Source #

Foldable f => Foldable (Rec1 f) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => Rec1 f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Rec1 f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Rec1 f a -> m Source #

foldr :: (a -> b -> b) -> b -> Rec1 f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Rec1 f a -> b Source #

foldl :: (b -> a -> b) -> b -> Rec1 f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Rec1 f a -> b Source #

foldr1 :: (a -> a -> a) -> Rec1 f a -> a Source #

foldl1 :: (a -> a -> a) -> Rec1 f a -> a Source #

toList :: Rec1 f a -> [a] Source #

null :: Rec1 f a -> Bool Source #

length :: Rec1 f a -> Int Source #

elem :: Eq a => a -> Rec1 f a -> Bool Source #

maximum :: Ord a => Rec1 f a -> a Source #

minimum :: Ord a => Rec1 f a -> a Source #

sum :: Num a => Rec1 f a -> a Source #

product :: Num a => Rec1 f a -> a Source #

Foldable f => Foldable (Backwards f) | Derived instance.

Instance details

Defined in Control.Applicative.Backwards

Methods

fold :: Monoid m => Backwards f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Backwards f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Backwards f a -> m Source #

foldr :: (a -> b -> b) -> b -> Backwards f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Backwards f a -> b Source #

foldl :: (b -> a -> b) -> b -> Backwards f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Backwards f a -> b Source #

foldr1 :: (a -> a -> a) -> Backwards f a -> a Source #

foldl1 :: (a -> a -> a) -> Backwards f a -> a Source #

toList :: Backwards f a -> [a] Source #

null :: Backwards f a -> Bool Source #

length :: Backwards f a -> Int Source #

elem :: Eq a => a -> Backwards f a -> Bool Source #

maximum :: Ord a => Backwards f a -> a Source #

minimum :: Ord a => Backwards f a -> a Source #

sum :: Num a => Backwards f a -> a Source #

product :: Num a => Backwards f a -> a Source #

Foldable f => Foldable (ExceptT e f) |

Instance details

Defined in Control.Monad.Trans.Except

Methods

fold :: Monoid m => ExceptT e f m -> m Source #

foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m Source #

foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b Source #

foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b Source #

foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b Source #

foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b Source #

foldr1 :: (a -> a -> a) -> ExceptT e f a -> a Source #

foldl1 :: (a -> a -> a) -> ExceptT e f a -> a Source #

toList :: ExceptT e f a -> [a] Source #

null :: ExceptT e f a -> Bool Source #

length :: ExceptT e f a -> Int Source #

elem :: Eq a => a -> ExceptT e f a -> Bool Source #

maximum :: Ord a => ExceptT e f a -> a Source #

minimum :: Ord a => ExceptT e f a -> a Source #

sum :: Num a => ExceptT e f a -> a Source #

product :: Num a => ExceptT e f a -> a Source #

Foldable f => Foldable (IdentityT f) |

Instance details

Defined in Control.Monad.Trans.Identity

Methods

fold :: Monoid m => IdentityT f m -> m Source #

foldMap :: Monoid m => (a -> m) -> IdentityT f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> IdentityT f a -> m Source #

foldr :: (a -> b -> b) -> b -> IdentityT f a -> b Source #

foldr' :: (a -> b -> b) -> b -> IdentityT f a -> b Source #

foldl :: (b -> a -> b) -> b -> IdentityT f a -> b Source #

foldl' :: (b -> a -> b) -> b -> IdentityT f a -> b Source #

foldr1 :: (a -> a -> a) -> IdentityT f a -> a Source #

foldl1 :: (a -> a -> a) -> IdentityT f a -> a Source #

toList :: IdentityT f a -> [a] Source #

null :: IdentityT f a -> Bool Source #

length :: IdentityT f a -> Int Source #

elem :: Eq a => a -> IdentityT f a -> Bool Source #

maximum :: Ord a => IdentityT f a -> a Source #

minimum :: Ord a => IdentityT f a -> a Source #

sum :: Num a => IdentityT f a -> a Source #

product :: Num a => IdentityT f a -> a Source #

Foldable f => Foldable (WriterT w f) |

Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

fold :: Monoid m => WriterT w f m -> m Source #

foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m Source #

foldr :: (a -> b -> b) -> b -> WriterT w f a -> b Source #

foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b Source #

foldl :: (b -> a -> b) -> b -> WriterT w f a -> b Source #

foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b Source #

foldr1 :: (a -> a -> a) -> WriterT w f a -> a Source #

foldl1 :: (a -> a -> a) -> WriterT w f a -> a Source #

toList :: WriterT w f a -> [a] Source #

null :: WriterT w f a -> Bool Source #

length :: WriterT w f a -> Int Source #

elem :: Eq a => a -> WriterT w f a -> Bool Source #

maximum :: Ord a => WriterT w f a -> a Source #

minimum :: Ord a => WriterT w f a -> a Source #

sum :: Num a => WriterT w f a -> a Source #

product :: Num a => WriterT w f a -> a Source #

Foldable f => Foldable (WriterT w f) |

Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

fold :: Monoid m => WriterT w f m -> m Source #

foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m Source #

foldr :: (a -> b -> b) -> b -> WriterT w f a -> b Source #

foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b Source #

foldl :: (b -> a -> b) -> b -> WriterT w f a -> b Source #

foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b Source #

foldr1 :: (a -> a -> a) -> WriterT w f a -> a Source #

foldl1 :: (a -> a -> a) -> WriterT w f a -> a Source #

toList :: WriterT w f a -> [a] Source #

null :: WriterT w f a -> Bool Source #

length :: WriterT w f a -> Int Source #

elem :: Eq a => a -> WriterT w f a -> Bool Source #

maximum :: Ord a => WriterT w f a -> a Source #

minimum :: Ord a => WriterT w f a -> a Source #

sum :: Num a => WriterT w f a -> a Source #

product :: Num a => WriterT w f a -> a Source #

Foldable (Constant a :: Type -> Type) |

Instance details

Defined in Data.Functor.Constant

Methods

fold :: Monoid m => Constant a m -> m Source #

foldMap :: Monoid m => (a0 -> m) -> Constant a a0 -> m Source #

foldMap' :: Monoid m => (a0 -> m) -> Constant a a0 -> m Source #

foldr :: (a0 -> b -> b) -> b -> Constant a a0 -> b Source #

foldr' :: (a0 -> b -> b) -> b -> Constant a a0 -> b Source #

foldl :: (b -> a0 -> b) -> b -> Constant a a0 -> b Source #

foldl' :: (b -> a0 -> b) -> b -> Constant a a0 -> b Source #

foldr1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 Source #

foldl1 :: (a0 -> a0 -> a0) -> Constant a a0 -> a0 Source #

toList :: Constant a a0 -> [a0] Source #

null :: Constant a a0 -> Bool Source #

length :: Constant a a0 -> Int Source #

elem :: Eq a0 => a0 -> Constant a a0 -> Bool Source #

maximum :: Ord a0 => Constant a a0 -> a0 Source #

minimum :: Ord a0 => Constant a a0 -> a0 Source #

sum :: Num a0 => Constant a a0 -> a0 Source #

product :: Num a0 => Constant a a0 -> a0 Source #

Foldable f => Foldable (Reverse f) | Fold from right to left.

Instance details

Defined in Data.Functor.Reverse

Methods

fold :: Monoid m => Reverse f m -> m Source #

foldMap :: Monoid m => (a -> m) -> Reverse f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Reverse f a -> m Source #

foldr :: (a -> b -> b) -> b -> Reverse f a -> b Source #

foldr' :: (a -> b -> b) -> b -> Reverse f a -> b Source #

foldl :: (b -> a -> b) -> b -> Reverse f a -> b Source #

foldl' :: (b -> a -> b) -> b -> Reverse f a -> b Source #

foldr1 :: (a -> a -> a) -> Reverse f a -> a Source #

foldl1 :: (a -> a -> a) -> Reverse f a -> a Source #

toList :: Reverse f a -> [a] Source #

null :: Reverse f a -> Bool Source #

length :: Reverse f a -> Int Source #

elem :: Eq a => a -> Reverse f a -> Bool Source #

maximum :: Ord a => Reverse f a -> a Source #

minimum :: Ord a => Reverse f a -> a Source #

sum :: Num a => Reverse f a -> a Source #

product :: Num a => Reverse f a -> a Source #

(Foldable f, Foldable g) => Foldable (Product f g) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

Methods

fold :: Monoid m => Product f g m -> m Source #

foldMap :: Monoid m => (a -> m) -> Product f g a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Product f g a -> m Source #

foldr :: (a -> b -> b) -> b -> Product f g a -> b Source #

foldr' :: (a -> b -> b) -> b -> Product f g a -> b Source #

foldl :: (b -> a -> b) -> b -> Product f g a -> b Source #

foldl' :: (b -> a -> b) -> b -> Product f g a -> b Source #

foldr1 :: (a -> a -> a) -> Product f g a -> a Source #

foldl1 :: (a -> a -> a) -> Product f g a -> a Source #

toList :: Product f g a -> [a] Source #

null :: Product f g a -> Bool Source #

length :: Product f g a -> Int Source #

elem :: Eq a => a -> Product f g a -> Bool Source #

maximum :: Ord a => Product f g a -> a Source #

minimum :: Ord a => Product f g a -> a Source #

sum :: Num a => Product f g a -> a Source #

product :: Num a => Product f g a -> a Source #

(Foldable f, Foldable g) => Foldable (Sum f g) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Sum

Methods

fold :: Monoid m => Sum f g m -> m Source #

foldMap :: Monoid m => (a -> m) -> Sum f g a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Sum f g a -> m Source #

foldr :: (a -> b -> b) -> b -> Sum f g a -> b Source #

foldr' :: (a -> b -> b) -> b -> Sum f g a -> b Source #

foldl :: (b -> a -> b) -> b -> Sum f g a -> b Source #

foldl' :: (b -> a -> b) -> b -> Sum f g a -> b Source #

foldr1 :: (a -> a -> a) -> Sum f g a -> a Source #

foldl1 :: (a -> a -> a) -> Sum f g a -> a Source #

toList :: Sum f g a -> [a] Source #

null :: Sum f g a -> Bool Source #

length :: Sum f g a -> Int Source #

elem :: Eq a => a -> Sum f g a -> Bool Source #

maximum :: Ord a => Sum f g a -> a Source #

minimum :: Ord a => Sum f g a -> a Source #

sum :: Num a => Sum f g a -> a Source #

product :: Num a => Sum f g a -> a Source #

(Foldable f, Foldable g) => Foldable (f :*: g) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => (f :*: g) m -> m Source #

foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> (f :*: g) a -> m Source #

foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b Source #

foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b Source #

foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b Source #

foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b Source #

foldr1 :: (a -> a -> a) -> (f :*: g) a -> a Source #

foldl1 :: (a -> a -> a) -> (f :*: g) a -> a Source #

toList :: (f :*: g) a -> [a] Source #

null :: (f :*: g) a -> Bool Source #

length :: (f :*: g) a -> Int Source #

elem :: Eq a => a -> (f :*: g) a -> Bool Source #

maximum :: Ord a => (f :*: g) a -> a Source #

minimum :: Ord a => (f :*: g) a -> a Source #

sum :: Num a => (f :*: g) a -> a Source #

product :: Num a => (f :*: g) a -> a Source #

(Foldable f, Foldable g) => Foldable (f :+: g) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => (f :+: g) m -> m Source #

foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> (f :+: g) a -> m Source #

foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b Source #

foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b Source #

foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b Source #

foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b Source #

foldr1 :: (a -> a -> a) -> (f :+: g) a -> a Source #

foldl1 :: (a -> a -> a) -> (f :+: g) a -> a Source #

toList :: (f :+: g) a -> [a] Source #

null :: (f :+: g) a -> Bool Source #

length :: (f :+: g) a -> Int Source #

elem :: Eq a => a -> (f :+: g) a -> Bool Source #

maximum :: Ord a => (f :+: g) a -> a Source #

minimum :: Ord a => (f :+: g) a -> a Source #

sum :: Num a => (f :+: g) a -> a Source #

product :: Num a => (f :+: g) a -> a Source #

Foldable (K1 i c :: Type -> Type) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => K1 i c m -> m Source #

foldMap :: Monoid m => (a -> m) -> K1 i c a -> m Source #

foldMap' :: Monoid m => (a -> m) -> K1 i c a -> m Source #

foldr :: (a -> b -> b) -> b -> K1 i c a -> b Source #

foldr' :: (a -> b -> b) -> b -> K1 i c a -> b Source #

foldl :: (b -> a -> b) -> b -> K1 i c a -> b Source #

foldl' :: (b -> a -> b) -> b -> K1 i c a -> b Source #

foldr1 :: (a -> a -> a) -> K1 i c a -> a Source #

foldl1 :: (a -> a -> a) -> K1 i c a -> a Source #

toList :: K1 i c a -> [a] Source #

null :: K1 i c a -> Bool Source #

length :: K1 i c a -> Int Source #

elem :: Eq a => a -> K1 i c a -> Bool Source #

maximum :: Ord a => K1 i c a -> a Source #

minimum :: Ord a => K1 i c a -> a Source #

sum :: Num a => K1 i c a -> a Source #

product :: Num a => K1 i c a -> a Source #

(Foldable f, Foldable g) => Foldable (Compose f g) | Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

fold :: Monoid m => Compose f g m -> m Source #

foldMap :: Monoid m => (a -> m) -> Compose f g a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Compose f g a -> m Source #

foldr :: (a -> b -> b) -> b -> Compose f g a -> b Source #

foldr' :: (a -> b -> b) -> b -> Compose f g a -> b Source #

foldl :: (b -> a -> b) -> b -> Compose f g a -> b Source #

foldl' :: (b -> a -> b) -> b -> Compose f g a -> b Source #

foldr1 :: (a -> a -> a) -> Compose f g a -> a Source #

foldl1 :: (a -> a -> a) -> Compose f g a -> a Source #

toList :: Compose f g a -> [a] Source #

null :: Compose f g a -> Bool Source #

length :: Compose f g a -> Int Source #

elem :: Eq a => a -> Compose f g a -> Bool Source #

maximum :: Ord a => Compose f g a -> a Source #

minimum :: Ord a => Compose f g a -> a Source #

sum :: Num a => Compose f g a -> a Source #

product :: Num a => Compose f g a -> a Source #

(Foldable f, Foldable g) => Foldable (f :.: g) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => (f :.: g) m -> m Source #

foldMap :: Monoid m => (a -> m) -> (f :.: g) a -> m Source #

foldMap' :: Monoid m => (a -> m) -> (f :.: g) a -> m Source #

foldr :: (a -> b -> b) -> b -> (f :.: g) a -> b Source #

foldr' :: (a -> b -> b) -> b -> (f :.: g) a -> b Source #

foldl :: (b -> a -> b) -> b -> (f :.: g) a -> b Source #

foldl' :: (b -> a -> b) -> b -> (f :.: g) a -> b Source #

foldr1 :: (a -> a -> a) -> (f :.: g) a -> a Source #

foldl1 :: (a -> a -> a) -> (f :.: g) a -> a Source #

toList :: (f :.: g) a -> [a] Source #

null :: (f :.: g) a -> Bool Source #

length :: (f :.: g) a -> Int Source #

elem :: Eq a => a -> (f :.: g) a -> Bool Source #

maximum :: Ord a => (f :.: g) a -> a Source #

minimum :: Ord a => (f :.: g) a -> a Source #

sum :: Num a => (f :.: g) a -> a Source #

product :: Num a => (f :.: g) a -> a Source #

Foldable f => Foldable (M1 i c f) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => M1 i c f m -> m Source #

foldMap :: Monoid m => (a -> m) -> M1 i c f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> M1 i c f a -> m Source #

foldr :: (a -> b -> b) -> b -> M1 i c f a -> b Source #

foldr' :: (a -> b -> b) -> b -> M1 i c f a -> b Source #

foldl :: (b -> a -> b) -> b -> M1 i c f a -> b Source #

foldl' :: (b -> a -> b) -> b -> M1 i c f a -> b Source #

foldr1 :: (a -> a -> a) -> M1 i c f a -> a Source #

foldl1 :: (a -> a -> a) -> M1 i c f a -> a Source #

toList :: M1 i c f a -> [a] Source #

null :: M1 i c f a -> Bool Source #

length :: M1 i c f a -> Int Source #

elem :: Eq a => a -> M1 i c f a -> Bool Source #

maximum :: Ord a => M1 i c f a -> a Source #

minimum :: Ord a => M1 i c f a -> a Source #

sum :: Num a => M1 i c f a -> a Source #

product :: Num a => M1 i c f a -> a Source #

concat :: Foldable t => t [a] -> [a] Source #

The concatenation of all the elements of a container of lists.

#### Examples

Expand

Basic usage:

    >>> concat (Just [1, 2, 3])
    [1,2,3]

    >>> concat (Left 42)
    []

    >>> concat [[1, 2, 3], [4, 5], [6], []]
    [1,2,3,4,5,6]

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

\(\mathcal{O}(n)\). `filter`, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e.,

    filter p xs = [ x | x <- xs, p x]

#### Examples

Expand

    >>> filter odd [1, 2, 3]
    [1,3]

    >>> filter (\l -> length l > 3) ["Hello", ", ", "World", "!"]
    ["Hello","World"]

    >>> filter (/= 3) [1, 2, 3, 4, 3, 2, 1]
    [1,2,4,2,1]

zip :: [a] -> [b] -> [(a, b)] Source #

\(\mathcal{O}(\min(m,n))\). `zip` takes two lists and returns a list of corresponding pairs.

`zip` is right-lazy:

    >>> zip [] undefined
    []
    >>> zip undefined []
    *** Exception: Prelude.undefined
    ...

`zip` is capable of list fusion, but it is restricted to its first list argument and its resulting list.

#### Examples

Expand

    >>> zip [1, 2, 3] ['a', 'b', 'c']
    [(1,'a'),(2,'b'),(3,'c')]

If one input list is shorter than the other, excess elements of the longer list are discarded, even if one of the lists is infinite:

    >>> zip [1] ['a', 'b']
    [(1,'a')]

    >>> zip [1, 2] ['a']
    [(1,'a')]

    >>> zip [] [1..]
    []

    >>> zip [1..] []
    []

map :: (a -> b) -> [a] -> [b] Source #

\(\mathcal{O}(n)\). `map` `f xs` is the list obtained by applying `f` to each element of `xs`, i.e.,

    map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
    map f [x1, x2, ...] == [f x1, f x2, ...]

this means that `map id == id`

#### Examples

Expand

    >>> map (+1) [1, 2, 3]
    [2,3,4]

    >>> map id [1, 2, 3]
    [1,2,3]

    >>> map (\n -> 3 * n + 1) [1, 2, 3]
    [4,7,10]

head :: HasCallStack => [a] -> a Source #

\(\mathcal{O}(1)\). Extract the first element of a list, which must be non-empty.

To disable the warning about partiality put `{-# OPTIONS_GHC -Wno-x-partial -Wno-unrecognised-warning-flags #-}` at the top of the file. To disable it throughout a package put the same options into `ghc-options` section of Cabal file. To disable it in GHCi put `:set -Wno-x-partial -Wno-unrecognised-warning-flags` into `~/.ghci` config file. See also the migration guide.

##### Examples

Expand

    >>> head [1, 2, 3]
    1

    >>> head [1..]
    1

    >>> head []
    *** Exception: Prelude.head: empty list

uncons :: [a] -> Maybe (a, [a]) Source #

\(\mathcal{O}(1)\). Decompose a list into its `head` and `tail`.

- If the list is empty, returns `Nothing`.
- If the list is non-empty, returns ``Just` (x, xs)`, where `x` is the `head` of the list and `xs` its `tail`.

#### Examples

Expand

    >>> uncons []
    Nothing

    >>> uncons [1]
    Just (1,[])

    >>> uncons [1, 2, 3]
    Just (1,[2,3])

Since: base-4.8.0.0

unsnoc :: [a] -> Maybe ([a], a) Source #

\(\mathcal{O}(n)\). Decompose a list into `init` and `last`.

- If the list is empty, returns `Nothing`.
- If the list is non-empty, returns ``Just` (xs, x)`, where `xs` is the `init`ial part of the list and `x` is its `last` element.

`unsnoc` is dual to `uncons`: for a finite list `xs`

    unsnoc xs = (\(hd, tl) -> (reverse tl, hd)) <$> uncons (reverse xs)

#### Examples

Expand

    >>> unsnoc []
    Nothing

    >>> unsnoc [1]
    Just ([],1)

    >>> unsnoc [1, 2, 3]
    Just ([1,2],3)

#### Laziness

Expand

    >>> fst <$> unsnoc [undefined]
    Just []

    >>> head . fst <$> unsnoc (1 : undefined)
    Just *** Exception: Prelude.undefined

    >>> head . fst <$> unsnoc (1 : 2 : undefined)
    Just 1

Since: base-4.19.0.0

tail :: HasCallStack => [a] -> [a] Source #

\(\mathcal{O}(1)\). Extract the elements after the head of a list, which must be non-empty.

To disable the warning about partiality put `{-# OPTIONS_GHC -Wno-x-partial -Wno-unrecognised-warning-flags #-}` at the top of the file. To disable it throughout a package put the same options into `ghc-options` section of Cabal file. To disable it in GHCi put `:set -Wno-x-partial -Wno-unrecognised-warning-flags` into `~/.ghci` config file. See also the migration guide.

#### Examples

Expand

    >>> tail [1, 2, 3]
    [2,3]

    >>> tail [1]
    []

    >>> tail []
    *** Exception: Prelude.tail: empty list

last :: HasCallStack => [a] -> a Source #

\(\mathcal{O}(n)\). Extract the last element of a list, which must be finite and non-empty.

WARNING: This function is partial. Consider using `unsnoc` instead.

#### Examples

Expand

    >>> last [1, 2, 3]
    3

    >>> last [1..]
    * Hangs forever *

    >>> last []
    *** Exception: Prelude.last: empty list

init :: HasCallStack => [a] -> [a] Source #

\(\mathcal{O}(n)\). Return all the elements of a list except the last one. The list must be non-empty.

WARNING: This function is partial. Consider using `unsnoc` instead.

#### Examples

Expand

    >>> init [1, 2, 3]
    [1,2]

    >>> init [1]
    []

    >>> init []
    *** Exception: Prelude.init: empty list

foldl1' :: HasCallStack => (a -> a -> a) -> [a] -> a Source #

A strict version of `foldl1`.

scanl :: (b -> a -> b) -> b -> [a] -> [b] Source #

\(\mathcal{O}(n)\). `scanl` is similar to `foldl`, but returns a list of successive reduced values from the left:

    scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]

Note that

    last (scanl f z xs) == foldl f z xs

#### Examples

Expand

    >>> scanl (+) 0 [1..4]
    [0,1,3,6,10]

    >>> scanl (+) 42 []
    [42]

    >>> scanl (-) 100 [1..4]
    [100,99,97,94,90]

    >>> scanl (\reversedString nextChar -> nextChar : reversedString) "foo" ['a', 'b', 'c', 'd']
    ["foo","afoo","bafoo","cbafoo","dcbafoo"]

    >>> take 10 (scanl (+) 0 [1..])
    [0,1,3,6,10,15,21,28,36,45]

    >>> take 1 (scanl undefined 'a' undefined)
    "a"

scanl1 :: (a -> a -> a) -> [a] -> [a] Source #

\(\mathcal{O}(n)\). `scanl1` is a variant of `scanl` that has no starting value argument:

    scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]

#### Examples

Expand

    >>> scanl1 (+) [1..4]
    [1,3,6,10]

    >>> scanl1 (+) []
    []

    >>> scanl1 (-) [1..4]
    [1,-1,-4,-8]

    >>> scanl1 (&&) [True, False, True, True]
    [True,False,False,False]

    >>> scanl1 (||) [False, False, True, True]
    [False,False,True,True]

    >>> take 10 (scanl1 (+) [1..])
    [1,3,6,10,15,21,28,36,45,55]

    >>> take 1 (scanl1 undefined ('a' : undefined))
    "a"

scanl' :: (b -> a -> b) -> b -> [a] -> [b] Source #

\(\mathcal{O}(n)\). A strict version of `scanl`.

scanr :: (a -> b -> b) -> b -> [a] -> [b] Source #

\(\mathcal{O}(n)\). `scanr` is the right-to-left dual of `scanl`. Note that the order of parameters on the accumulating function are reversed compared to `scanl`. Also note that

    head (scanr f z xs) == foldr f z xs.

#### Examples

Expand

    >>> scanr (+) 0 [1..4]
    [10,9,7,4,0]

    >>> scanr (+) 42 []
    [42]

    >>> scanr (-) 100 [1..4]
    [98,-97,99,-96,100]

    >>> scanr (\nextChar reversedString -> nextChar : reversedString) "foo" ['a', 'b', 'c', 'd']
    ["abcdfoo","bcdfoo","cdfoo","dfoo","foo"]

    >>> force $ scanr (+) 0 [1..]
    *** Exception: stack overflow

scanr1 :: (a -> a -> a) -> [a] -> [a] Source #

\(\mathcal{O}(n)\). `scanr1` is a variant of `scanr` that has no starting value argument.

#### Examples

Expand

    >>> scanr1 (+) [1..4]
    [10,9,7,4]

    >>> scanr1 (+) []
    []

    >>> scanr1 (-) [1..4]
    [-2,3,-1,4]

    >>> scanr1 (&&) [True, False, True, True]
    [False,False,True,True]

    >>> scanr1 (||) [True, True, False, False]
    [True,True,False,False]

    >>> force $ scanr1 (+) [1..]
    *** Exception: stack overflow

iterate :: (a -> a) -> a -> [a] Source #

`iterate` `f x` returns an infinite list of repeated applications of `f` to `x`:

    iterate f x == [x, f x, f (f x), ...]

#### Laziness

Expand

Note that `iterate` is lazy, potentially leading to thunk build-up if the consumer doesn't force each iterate. See `iterate'` for a strict variant of this function.

    >>> take 1 $ iterate undefined 42
    [42]

#### Examples

Expand

    >>> take 10 $ iterate not True
    [True,False,True,False,True,False,True,False,True,False]

    >>> take 10 $ iterate (+3) 42
    [42,45,48,51,54,57,60,63,66,69]

`iterate id == `repeat``:

    >>> take 10 $ iterate id 1
    [1,1,1,1,1,1,1,1,1,1]

iterate' :: (a -> a) -> a -> [a] Source #

`iterate'` is the strict version of `iterate`.

It forces the result of each application of the function to weak head normal form (WHNF) before proceeding.

    >>> take 1 $ iterate' undefined 42
    *** Exception: Prelude.undefined

repeat :: a -> [a] Source #

`repeat` `x` is an infinite list, with `x` the value of every element.

#### Examples

Expand

    >>> take 10 $ repeat 17
    [17,17,17,17,17,17,17,17,17, 17]

    >>> repeat undefined
    [*** Exception: Prelude.undefined

replicate :: Int -> a -> [a] Source #

`replicate` `n x` is a list of length `n` with `x` the value of every element. It is an instance of the more general `genericReplicate`, in which `n` may be of any integral type.

#### Examples

Expand

    >>> replicate 0 True
    []

    >>> replicate (-1) True
    []

    >>> replicate 4 True
    [True,True,True,True]

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

`takeWhile`, applied to a predicate `p` and a list `xs`, returns the longest prefix (possibly empty) of `xs` of elements that satisfy `p`.

#### Laziness

Expand

    >>> takeWhile (const False) undefined
    *** Exception: Prelude.undefined

    >>> takeWhile (const False) (undefined : undefined)
    []

    >>> take 1 (takeWhile (const True) (1 : undefined))
    [1]

#### Examples

Expand

    >>> takeWhile (< 3) [1,2,3,4,1,2,3,4]
    [1,2]

    >>> takeWhile (< 9) [1,2,3]
    [1,2,3]

    >>> takeWhile (< 0) [1,2,3]
    []

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

`dropWhile` `p xs` returns the suffix remaining after `takeWhile` `p xs`.

#### Examples

Expand

    >>> dropWhile (< 3) [1,2,3,4,5,1,2,3]
    [3,4,5,1,2,3]

    >>> dropWhile (< 9) [1,2,3]
    []

    >>> dropWhile (< 0) [1,2,3]
    [1,2,3]

take :: Int -> [a] -> [a] Source #

`take` `n`, applied to a list `xs`, returns the prefix of `xs` of length `n`, or `xs` itself if `n >= `length` xs`.

It is an instance of the more general `genericTake`, in which `n` may be of any integral type.

#### Laziness

Expand

    >>> take 0 undefined
    []
    >>> take 2 (1 : 2 : undefined)
    [1,2]

#### Examples

Expand

    >>> take 5 "Hello World!"
    "Hello"

    >>> take 3 [1,2,3,4,5]
    [1,2,3]

    >>> take 3 [1,2]
    [1,2]

    >>> take 3 []
    []

    >>> take (-1) [1,2]
    []

    >>> take 0 [1,2]
    []

drop :: Int -> [a] -> [a] Source #

`drop` `n xs` returns the suffix of `xs` after the first `n` elements, or `[]` if `n >= `length` xs`.

It is an instance of the more general `genericDrop`, in which `n` may be of any integral type.

#### Examples

Expand

    >>> drop 6 "Hello World!"
    "World!"

    >>> drop 3 [1,2,3,4,5]
    [4,5]

    >>> drop 3 [1,2]
    []

    >>> drop 3 []
    []

    >>> drop (-1) [1,2]
    [1,2]

    >>> drop 0 [1,2]
    [1,2]

splitAt :: Int -> [a] -> ([a], [a]) Source #

`splitAt` `n xs` returns a tuple where first element is `xs` prefix of length `n` and second element is the remainder of the list:

`splitAt` is an instance of the more general `genericSplitAt`, in which `n` may be of any integral type.

#### Laziness

Expand

It is equivalent to `(`take` n xs, `drop` n xs)` unless `n` is `_|_`: `splitAt _|_ xs = _|_`, not `(_|_, _|_)`).

The first component of the tuple is produced lazily:

    >>> fst (splitAt 0 undefined)
    []

    >>> take 1 (fst (splitAt 10 (1 : undefined)))
    [1]

#### Examples

Expand

    >>> splitAt 6 "Hello World!"
    ("Hello ","World!")

    >>> splitAt 3 [1,2,3,4,5]
    ([1,2,3],[4,5])

    >>> splitAt 1 [1,2,3]
    ([1],[2,3])

    >>> splitAt 3 [1,2,3]
    ([1,2,3],[])

    >>> splitAt 4 [1,2,3]
    ([1,2,3],[])

    >>> splitAt 0 [1,2,3]
    ([],[1,2,3])

    >>> splitAt (-1) [1,2,3]
    ([],[1,2,3])

span :: (a -> Bool) -> [a] -> ([a], [a]) Source #

`span`, applied to a predicate `p` and a list `xs`, returns a tuple where first element is the longest prefix (possibly empty) of `xs` of elements that satisfy `p` and second element is the remainder of the list:

`span` `p xs` is equivalent to `(`takeWhile` p xs, `dropWhile` p xs)`, even if `p` is `_|_`.

#### Laziness

Expand

    >>> span undefined []
    ([],[])
    >>> fst (span (const False) undefined)
    *** Exception: Prelude.undefined
    >>> fst (span (const False) (undefined : undefined))
    []
    >>> take 1 (fst (span (const True) (1 : undefined)))
    [1]

`span` produces the first component of the tuple lazily:

    >>> take 10 (fst (span (const True) [1..]))
    [1,2,3,4,5,6,7,8,9,10]

#### Examples

Expand

    >>> span (< 3) [1,2,3,4,1,2,3,4]
    ([1,2],[3,4,1,2,3,4])

    >>> span (< 9) [1,2,3]
    ([1,2,3],[])

    >>> span (< 0) [1,2,3]
    ([],[1,2,3])

break :: (a -> Bool) -> [a] -> ([a], [a]) Source #

`break`, applied to a predicate `p` and a list `xs`, returns a tuple where first element is longest prefix (possibly empty) of `xs` of elements that do not satisfy `p` and second element is the remainder of the list:

`break` `p` is equivalent to ``span` (`not` . p)` and consequently to `(`takeWhile` (`not` . p) xs, `dropWhile` (`not` . p) xs)`, even if `p` is `_|_`.

#### Laziness

Expand

    >>> break undefined []
    ([],[])

    >>> fst (break (const True) undefined)
    *** Exception: Prelude.undefined

    >>> fst (break (const True) (undefined : undefined))
    []

    >>> take 1 (fst (break (const False) (1 : undefined)))
    [1]

`break` produces the first component of the tuple lazily:

    >>> take 10 (fst (break (const False) [1..]))
    [1,2,3,4,5,6,7,8,9,10]

#### Examples

Expand

    >>> break (> 3) [1,2,3,4,1,2,3,4]
    ([1,2,3],[4,1,2,3,4])

    >>> break (< 9) [1,2,3]
    ([],[1,2,3])

    >>> break (> 9) [1,2,3]
    ([1,2,3],[])

reverse :: [a] -> [a] Source #

\(\mathcal{O}(n)\). `reverse` `xs` returns the elements of `xs` in reverse order. `xs` must be finite.

#### Laziness

Expand

`reverse` is lazy in its elements.

    >>> head (reverse [undefined, 1])
    1

    >>> reverse (1 : 2 : undefined)
    *** Exception: Prelude.undefined

#### Examples

Expand

    >>> reverse []
    []

    >>> reverse [42]
    [42]

    >>> reverse [2,5,7]
    [7,5,2]

    >>> reverse [1..]
    * Hangs forever *

and :: Foldable t => t Bool -> Bool Source #

`and` returns the conjunction of a container of Bools. For the result to be `True`, the container must be finite; `False`, however, results from a `False` value finitely far from the left end.

#### Examples

Expand

Basic usage:

    >>> and []
    True

    >>> and [True]
    True

    >>> and [False]
    False

    >>> and [True, True, False]
    False

    >>> and (False : repeat True) -- Infinite list [False,True,True,True,...
    False

    >>> and (repeat True)
    * Hangs forever *

or :: Foldable t => t Bool -> Bool Source #

`or` returns the disjunction of a container of Bools. For the result to be `False`, the container must be finite; `True`, however, results from a `True` value finitely far from the left end.

#### Examples

Expand

Basic usage:

    >>> or []
    False

    >>> or [True]
    True

    >>> or [False]
    False

    >>> or [True, True, False]
    True

    >>> or (True : repeat False) -- Infinite list [True,False,False,False,...
    True

    >>> or (repeat False)
    * Hangs forever *

any :: Foldable t => (a -> Bool) -> t a -> Bool Source #

Determines whether any element of the structure satisfies the predicate.

#### Examples

Expand

Basic usage:

    >>> any (> 3) []
    False

    >>> any (> 3) [1,2]
    False

    >>> any (> 3) [1,2,3,4,5]
    True

    >>> any (> 3) [1..]
    True

    >>> any (> 3) [0, -1..]
    * Hangs forever *

all :: Foldable t => (a -> Bool) -> t a -> Bool Source #

Determines whether all elements of the structure satisfy the predicate.

#### Examples

Expand

Basic usage:

    >>> all (> 3) []
    True

    >>> all (> 3) [1,2]
    False

    >>> all (> 3) [1,2,3,4,5]
    False

    >>> all (> 3) [1..]
    False

    >>> all (> 3) [4..]
    * Hangs forever *

notElem :: (Foldable t, Eq a) => a -> t a -> Bool infix 4 Source #

`notElem` is the negation of `elem`.

#### Examples

Expand

Basic usage:

    >>> 3 `notElem` []
    True

    >>> 3 `notElem` [1,2]
    True

    >>> 3 `notElem` [1,2,3,4,5]
    False

For infinite structures, `notElem` terminates if the value exists at a finite distance from the left side of the structure:

    >>> 3 `notElem` [1..]
    False

    >>> 3 `notElem` ([4..] ++ [3])
    * Hangs forever *

lookup :: Eq a => a -> [(a, b)] -> Maybe b Source #

\(\mathcal{O}(n)\). `lookup` `key assocs` looks up a key in an association list. For the result to be `Nothing`, the list must be finite.

#### Examples

Expand

    >>> lookup 2 []
    Nothing

    >>> lookup 2 [(1, "first")]
    Nothing

    >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")]
    Just "second"

concatMap :: Foldable t => (a -> [b]) -> t a -> [b] Source #

Map a function over all the elements of a container and concatenate the resulting lists.

#### Examples

Expand

Basic usage:

    >>> concatMap (take 3) [[1..], [10..], [100..], [1000..]]
    [1,2,3,10,11,12,100,101,102,1000,1001,1002]

    >>> concatMap (take 3) (Just [1..])
    [1,2,3]

(!!) :: HasCallStack => [a] -> Int -> a infixl 9 Source #

List index (subscript) operator, starting from 0. It is an instance of the more general `genericIndex`, which takes an index of any integral type.

WARNING: This function is partial, and should only be used if you are sure that the indexing will not fail. Otherwise, use `!?`.

WARNING: This function takes linear time in the index.

#### Examples

Expand

    >>> ['a', 'b', 'c'] !! 0
    'a'

    >>> ['a', 'b', 'c'] !! 2
    'c'

    >>> ['a', 'b', 'c'] !! 3
    *** Exception: Prelude.!!: index too large

    >>> ['a', 'b', 'c'] !! (-1)
    *** Exception: Prelude.!!: negative index

zip3 :: [a] -> [b] -> [c] -> [(a, b, c)] Source #

`zip3` takes three lists and returns a list of triples, analogous to `zip`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] Source #

\(\mathcal{O}(\min(m,n))\). `zipWith` generalises `zip` by zipping with the function given as the first argument, instead of a tupling function.

    zipWith (,) xs ys == zip xs ys
    zipWith f [x1,x2,x3..] [y1,y2,y3..] == [f x1 y1, f x2 y2, f x3 y3..]

`zipWith` is right-lazy:

    >>> let f = undefined
    >>> zipWith f [] undefined
    []

`zipWith` is capable of list fusion, but it is restricted to its first list argument and its resulting list.

#### Examples

Expand

``zipWith` `(+)`` can be applied to two lists to produce the list of corresponding sums:

    >>> zipWith (+) [1, 2, 3] [4, 5, 6]
    [5,7,9]

    >>> zipWith (++) ["hello ", "foo"] ["world!", "bar"]
    ["hello world!","foobar"]

zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] Source #

\(\mathcal{O}(\min(l,m,n))\). The `zipWith3` function takes a function which combines three elements, as well as three lists and returns a list of the function applied to corresponding elements, analogous to `zipWith`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

    zipWith3 (,,) xs ys zs == zip3 xs ys zs
    zipWith3 f [x1,x2,x3..] [y1,y2,y3..] [z1,z2,z3..] == [f x1 y1 z1, f x2 y2 z2, f x3 y3 z3..]

#### Examples

Expand

    >>> zipWith3 (\x y z -> [x, y, z]) "123" "abc" "xyz"
    ["1ax","2by","3cz"]

    >>> zipWith3 (\x y z -> (x * y) + z) [1, 2, 3] [4, 5, 6] [7, 8, 9]
    [11,18,27]

unzip :: [(a, b)] -> ([a], [b]) Source #

`unzip` transforms a list of pairs into a list of first components and a list of second components.

#### Examples

Expand

    >>> unzip []
    ([],[])

    >>> unzip [(1, 'a'), (2, 'b')]
    ([1,2],"ab")

unzip3 :: [(a, b, c)] -> ([a], [b], [c]) Source #

The `unzip3` function takes a list of triples and returns three lists of the respective components, analogous to `unzip`.

#### Examples

Expand

    >>> unzip3 []
    ([],[],[])

    >>> unzip3 [(1, 'a', True), (2, 'b', False)]
    ([1,2],"ab",[True,False])

(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 Source #

Flipped version of `<$>`.

    (<&>) = flip fmap

#### Examples

Expand

Apply `(+1)` to a list, a `Just` and a `Right`:

    >>> Just 2 <&> (+1)
    Just 3

    >>> [1,2,3] <&> (+1)
    [2,3,4]

    >>> Right 3 <&> (+1)
    Right 4

Since: base-4.11.0.0

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

Flipped version of `<$`.

#### Examples

Expand

Replace the contents of a ``Maybe` `Int`` with a constant `String`:

    >>> Nothing $> "foo"
    Nothing

    >>> Just 90210 $> "foo"
    Just "foo"

Replace the contents of an ``Either` `Int` `Int`` with a constant `String`, resulting in an ``Either` `Int` `String``:

    >>> Left 8675309 $> "foo"
    Left 8675309

    >>> Right 8675309 $> "foo"
    Right "foo"

Replace each element of a list with a constant `String`:

    >>> [1,2,3] $> "foo"
    ["foo","foo","foo"]

Replace the second element of a pair with a constant `String`:

    >>> (1,2) $> "foo"
    (1,"foo")

Since: base-4.7.0.0

foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b Source #

Right-to-left monadic fold over the elements of a structure.

Given a structure `t` with elements `(a, b, c, ..., x, y)`, the result of a fold with an operator function `f` is equivalent to:

    foldrM f z t = do
        yy <- f y z
        xx <- f x yy
        ...
        bb <- f b cc
        aa <- f a bb
        return aa -- Just @return z@ when the structure is empty

For a Monad `m`, given two functions `f1 :: a -> m b` and `f2 :: b -> m c`, their Kleisli composition `(f1 >=> f2) :: a -> m c` is defined by:

    (f1 >=> f2) a = f1 a >>= f2

Another way of thinking about `foldrM` is that it amounts to an application to `z` of a Kleisli composition:

    foldrM f z t = f y >=> f x >=> ... >=> f b >=> f a $ z

The monadic effects of `foldrM` are sequenced from right to left, and e.g. folds of infinite lists will diverge.

If at some step the bind operator `(`>>=`)` short-circuits (as with, e.g., `mzero` in a `MonadPlus`), the evaluated effects will be from a tail of the element sequence. If you want to evaluate the monadic effects in left-to-right order, or perhaps be able to short-circuit after an initial sequence of elements, you'll need to use `foldlM` instead.

If the monadic effects don't short-circuit, the outermost application of `f` is to the leftmost element `a`, so that, ignoring effects, the result looks like a right fold:

    a `f` (b `f` (c `f` (... (x `f` (y `f` z))))).

#### Examples

Expand

Basic usage:

    >>> let f i acc = do { print i ; return $ i : acc }
    >>> foldrM f [] [0..3]
    3
    2
    1
    0
    [0,1,2,3]

foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b Source #

Left-to-right monadic fold over the elements of a structure.

Given a structure `t` with elements `(a, b, ..., w, x, y)`, the result of a fold with an operator function `f` is equivalent to:

    foldlM f z t = do
        aa <- f z a
        bb <- f aa b
        ...
        xx <- f ww x
        yy <- f xx y
        return yy -- Just @return z@ when the structure is empty

For a Monad `m`, given two functions `f1 :: a -> m b` and `f2 :: b -> m c`, their Kleisli composition `(f1 >=> f2) :: a -> m c` is defined by:

    (f1 >=> f2) a = f1 a >>= f2

Another way of thinking about `foldlM` is that it amounts to an application to `z` of a Kleisli composition:

    foldlM f z t =
        flip f a >=> flip f b >=> ... >=> flip f x >=> flip f y $ z

The monadic effects of `foldlM` are sequenced from left to right.

If at some step the bind operator `(`>>=`)` short-circuits (as with, e.g., `mzero` in a `MonadPlus`), the evaluated effects will be from an initial segment of the element sequence. If you want to evaluate the monadic effects in right-to-left order, or perhaps be able to short-circuit after processing a tail of the sequence of elements, you'll need to use `foldrM` instead.

If the monadic effects don't short-circuit, the outermost application of `f` is to the rightmost element `y`, so that, ignoring effects, the result looks like a left fold:

    ((((z `f` a) `f` b) ... `f` w) `f` x) `f` y

#### Examples

Expand

Basic usage:

    >>> let f a e = do { print e ; return $ e : a }
    >>> foldlM f [] [0..3]
    0
    1
    2
    3
    [3,2,1,0]

traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () Source #

Map each element of a structure to an `Applicative` action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see `traverse`.

`traverse_` is just like `mapM_`, but generalised to `Applicative` actions.

#### Examples

Expand

Basic usage:

    >>> traverse_ print ["Hello", "world", "!"]
    "Hello"
    "world"
    "!"

for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f () Source #

`for_` is `traverse_` with its arguments flipped. For a version that doesn't ignore the results see `for`. This is `forM_` generalised to `Applicative` actions.

`for_` is just like `forM_`, but generalised to `Applicative` actions.

#### Examples

Expand

Basic usage:

    >>> for_ [1..4] print
    1
    2
    3
    4

sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f () Source #

Evaluate each action in the structure from left to right, and ignore the results. For a version that doesn't ignore the results see `sequenceA`.

`sequenceA_` is just like `sequence_`, but generalised to `Applicative` actions.

#### Examples

Expand

Basic usage:

    >>> sequenceA_ [print "Hello", print "world", print "!"]
    "Hello"
    "world"
    "!"

maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a Source #

The largest element of a non-empty structure with respect to the given comparison function.

#### Examples

Expand

Basic usage:

    >>> maximumBy (compare `on` length) ["Hello", "World", "!", "Longest", "bar"]
    "Longest"

WARNING: This function is partial for possibly-empty structures like lists.

minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a Source #

The least element of a non-empty structure with respect to the given comparison function.

#### Examples

Expand

Basic usage:

    >>> minimumBy (compare `on` length) ["Hello", "World", "!", "Longest", "bar"]
    "!"

WARNING: This function is partial for possibly-empty structures like lists.

find :: Foldable t => (a -> Bool) -> t a -> Maybe a Source #

The `find` function takes a predicate and a structure and returns the leftmost element of the structure matching the predicate, or `Nothing` if there is no such element.

#### Examples

Expand

Basic usage:

    >>> find (> 42) [0, 5..]
    Just 45

    >>> find (> 12) [1..7]
    Nothing

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

The `dropWhileEnd` function drops the largest suffix of a list in which the given predicate holds for all elements.

#### Laziness

Expand

This function is lazy in spine, but strict in elements, which makes it different from `reverse` `.` `dropWhile` `p` `.` `reverse`, which is strict in spine, but lazy in elements. For instance:

    >>> take 1 (dropWhileEnd (< 0) (1 : undefined))
    [1]

    >>> take 1 (reverse $ dropWhile (< 0) $ reverse (1 : undefined))
    *** Exception: Prelude.undefined

but on the other hand

    >>> last (dropWhileEnd (< 0) [undefined, 1])
    *** Exception: Prelude.undefined

    >>> last (reverse $ dropWhile (< 0) $ reverse [undefined, 1])
    1

#### Examples

Expand

    >>> dropWhileEnd isSpace "foo\n"
    "foo"

    >>> dropWhileEnd isSpace "foo bar"
    "foo bar"
    >>> dropWhileEnd (> 10) [1..20]
    [1,2,3,4,5,6,7,8,9,10]

Since: base-4.5.0.0

stripPrefix :: Eq a => [a] -> [a] -> Maybe [a] Source #

\(\mathcal{O}(\min(m,n))\). The `stripPrefix` function drops the given prefix from a list. It returns `Nothing` if the list did not start with the prefix given, or `Just` the list after the prefix, if it does.

##### Examples

Expand

    >>> stripPrefix "foo" "foobar"
    Just "bar"

    >>> stripPrefix "foo" "foo"
    Just ""

    >>> stripPrefix "foo" "barfoo"
    Nothing

    >>> stripPrefix "foo" "barfoobaz"
    Nothing

elemIndex :: Eq a => a -> [a] -> Maybe Int Source #

The `elemIndex` function returns the index of the first element in the given list which is equal (by `==`) to the query element, or `Nothing` if there is no such element. For the result to be `Nothing`, the list must be finite.

#### Examples

Expand

    >>> elemIndex 4 [0..]
    Just 4

    >>> elemIndex 'o' "haskell"
    Nothing

    >>> elemIndex 0 [1..]
    * hangs forever *

elemIndices :: Eq a => a -> [a] -> [Int] Source #

The `elemIndices` function extends `elemIndex`, by returning the indices of all elements equal to the query element, in ascending order.

#### Examples

Expand

    >>> elemIndices 'o' "Hello World"
    [4,7]

    >>> elemIndices 1 [1, 2, 3, 1, 2, 3]
    [0,3]

findIndex :: (a -> Bool) -> [a] -> Maybe Int Source #

The `findIndex` function takes a predicate and a list and returns the index of the first element in the list satisfying the predicate, or `Nothing` if there is no such element. For the result to be `Nothing`, the list must be finite.

#### Examples

Expand

    >>> findIndex isSpace "Hello World!"
    Just 5

    >>> findIndex odd [0, 2, 4, 6]
    Nothing

    >>> findIndex even [1..]
    Just 1

    >>> findIndex odd [0, 2 ..]
    * hangs forever *

findIndices :: (a -> Bool) -> [a] -> [Int] Source #

The `findIndices` function extends `findIndex`, by returning the indices of all elements satisfying the predicate, in ascending order.

#### Examples

Expand

    >>> findIndices (`elem` "aeiou") "Hello World!"
    [1,4,7]

    >>> findIndices (\l -> length l > 3) ["a", "bcde", "fgh", "ijklmnop"]
    [1,3]

isPrefixOf :: Eq a => [a] -> [a] -> Bool Source #

\(\mathcal{O}(\min(m,n))\). The `isPrefixOf` function takes two lists and returns `True` iff the first list is a prefix of the second.

#### Examples

Expand

    >>> "Hello" `isPrefixOf` "Hello World!"
    True

    >>> "Hello" `isPrefixOf` "Wello Horld!"
    False

For the result to be `True`, the first list must be finite; `False`, however, results from any mismatch:

    >>> [0..] `isPrefixOf` [1..]
    False

    >>> [0..] `isPrefixOf` [0..99]
    False

    >>> [0..99] `isPrefixOf` [0..]
    True

    >>> [0..] `isPrefixOf` [0..]
    * Hangs forever *

`isPrefixOf` shortcuts when the first argument is empty:

    >>> isPrefixOf [] undefined
    True

isSuffixOf :: Eq a => [a] -> [a] -> Bool Source #

The `isSuffixOf` function takes two lists and returns `True` iff the first list is a suffix of the second.

#### Examples

Expand

    >>> "ld!" `isSuffixOf` "Hello World!"
    True

    >>> "World" `isSuffixOf` "Hello World!"
    False

The second list must be finite; however the first list may be infinite:

    >>> [0..] `isSuffixOf` [0..99]
    False

    >>> [0..99] `isSuffixOf` [0..]
    * Hangs forever *

isInfixOf :: Eq a => [a] -> [a] -> Bool Source #

The `isInfixOf` function takes two lists and returns `True` iff the first list is contained, wholly and intact, anywhere within the second.

#### Examples

Expand

    >>> isInfixOf "Haskell" "I really like Haskell."
    True

    >>> isInfixOf "Ial" "I really like Haskell."
    False

For the result to be `True`, the first list must be finite; for the result to be `False`, the second list must be finite:

    >>> [20..50] `isInfixOf` [0..]
    True

    >>> [0..] `isInfixOf` [20..50]
    False

    >>> [0..] `isInfixOf` [0..]
    * Hangs forever *

nub :: Eq a => [a] -> [a] Source #

\(\mathcal{O}(n^2)\). The `nub` function removes duplicate elements from a list. In particular, it keeps only the first occurrence of each element. (The name `nub` means `essence'.) It is a special case of `nubBy`, which allows the programmer to supply their own equality test.

If there exists `instance Ord a`, it's faster to use `nubOrd` from the `containers` package (link to the latest online documentation), which takes only \(\mathcal{O}(n \log d)\) time where `d` is the number of distinct elements in the list.

Another approach to speed up `nub` is to use `map` `Data.List.NonEmpty.``head` . `Data.List.NonEmpty.``group` . `sort`, which takes \(\mathcal{O}(n \log n)\) time, requires `instance Ord a` and doesn't preserve the order.

#### Examples

Expand

    >>> nub [1,2,3,4,3,2,1,2,4,3,5]
    [1,2,3,4,5]

    >>> nub "hello, world!"
    "helo, wrd!"

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

The `nubBy` function behaves just like `nub`, except it uses a user-supplied equality predicate instead of the overloaded `(==)` function.

#### Examples

Expand

    >>> nubBy (\x y -> mod x 3 == mod y 3) [1,2,4,5,6]
    [1,2,6]

    >>> nubBy (/=) [2, 7, 1, 8, 2, 8, 1, 8, 2, 8]
    [2,2,2]

    >>> nubBy (>) [1, 2, 3, 2, 1, 5, 4, 5, 3, 2]
    [1,2,3,5,5]

delete :: Eq a => a -> [a] -> [a] Source #

\(\mathcal{O}(n)\). `delete` `x` removes the first occurrence of `x` from its list argument.

It is a special case of `deleteBy`, which allows the programmer to supply their own equality test.

#### Examples

Expand

    >>> delete 'a' "banana"
    "bnana"

    >>> delete "not" ["haskell", "is", "not", "awesome"]
    ["haskell","is","awesome"]

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

\(\mathcal{O}(n)\). The `deleteBy` function behaves like `delete`, but takes a user-supplied equality predicate.

#### Examples

Expand

    >>> deleteBy (<=) 4 [1..10]
    [1,2,3,5,6,7,8,9,10]

    >>> deleteBy (/=) 5 [5, 5, 4, 3, 5, 2]
    [5,5,3,5,2]

(\\) :: Eq a => [a] -> [a] -> [a] infix 5 Source #

The `\\` function is list difference (non-associative). In the result of `xs` `\\` `ys`, the first occurrence of each element of `ys` in turn (if any) has been removed from `xs`. Thus `(xs ++ ys) \\ xs == ys`.

It is a special case of `deleteFirstsBy`, which allows the programmer to supply their own equality test.

#### Examples

Expand

    >>> "Hello World!" \\ "ell W"
    "Hoorld!"

The second list must be finite, but the first may be infinite.

    >>> take 5 ([0..] \\ [2..4])
    [0,1,5,6,7]

    >>> take 5 ([0..] \\ [2..])
    * Hangs forever *

union :: Eq a => [a] -> [a] -> [a] Source #

The `union` function returns the list union of the two lists. It is a special case of `unionBy`, which allows the programmer to supply their own equality test.

#### Examples

Expand

    >>> "dog" `union` "cow"
    "dogcw"

If equal elements are present in both lists, an element from the first list will be used. If the second list contains equal elements, only the first one will be retained:

    >>> import Data.Semigroup(Arg(..))
    >>> union [Arg () "dog"] [Arg () "cow"]
    [Arg () "dog"]
    >>> union [] [Arg () "dog", Arg () "cow"]
    [Arg () "dog"]

However if the first list contains duplicates, so will the result:

    >>> "coot" `union` "duck"
    "cootduk"
    >>> "duck" `union` "coot"
    "duckot"

`union` is productive even if both arguments are infinite.

    >>> [0, 2 ..] `union` [1, 3 ..]
    [0,2,4,6,8,10,12..

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

The `unionBy` function is the non-overloaded version of `union`. Both arguments may be infinite.

#### Examples

Expand

    >>> unionBy (>) [3, 4, 5] [1, 2, 3, 4, 5, 6]
    [3,4,5,4,5,6]

    >>> import Data.Semigroup (Arg(..))
    >>> unionBy (/=) [Arg () "Saul"] [Arg () "Kim"]
    [Arg () "Saul", Arg () "Kim"]

intersect :: Eq a => [a] -> [a] -> [a] Source #

The `intersect` function takes the list intersection of two lists. It is a special case of `intersectBy`, which allows the programmer to supply their own equality test.

##### Examples

Expand

    >>> [1,2,3,4] `intersect` [2,4,6,8]
    [2,4]

If equal elements are present in both lists, an element from the first list will be used, and all duplicates from the second list quashed:

    >>> import Data.Semigroup
    >>> intersect [Arg () "dog"] [Arg () "cow", Arg () "cat"]
    [Arg () "dog"]

However if the first list contains duplicates, so will the result.

    >>> "coot" `intersect` "heron"
    "oo"
    >>> "heron" `intersect` "coot"
    "o"

If the second list is infinite, `intersect` either hangs or returns its first argument in full. Otherwise if the first list is infinite, `intersect` might be productive:

    >>> intersect [100..] [0..]
    [100,101,102,103...
    >>> intersect [0] [1..]
    * Hangs forever *
    >>> intersect [1..] [0]
    * Hangs forever *
    >>> intersect (cycle [1..3]) [2]
    [2,2,2,2...

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

The `intersectBy` function is the non-overloaded version of `intersect`. It is productive for infinite arguments only if the first one is a subset of the second.

intersperse :: a -> [a] -> [a] Source #

\(\mathcal{O}(n)\). The `intersperse` function takes an element and a list and `intersperses' that element between the elements of the list.

#### Laziness

Expand

`intersperse` has the following properties

    >>> take 1 (intersperse undefined ('a' : undefined))
    "a"

    >>> take 2 (intersperse ',' ('a' : undefined))
    "a*** Exception: Prelude.undefined

#### Examples

Expand

    >>> intersperse ',' "abcde"
    "a,b,c,d,e"

    >>> intersperse 1 [3, 4, 5]
    [3,1,4,1,5]

intercalate :: [a] -> [[a]] -> [a] Source #

`intercalate` `xs xss` is equivalent to `(`concat` (`intersperse` xs xss))`. It inserts the list `xs` in between the lists in `xss` and concatenates the result.

#### Laziness

Expand

`intercalate` has the following properties:

    >>> take 5 (intercalate undefined ("Lorem" : undefined))
    "Lorem"

    >>> take 6 (intercalate ", " ("Lorem" : undefined))
    "Lorem*** Exception: Prelude.undefined

#### Examples

Expand

    >>> intercalate ", " ["Lorem", "ipsum", "dolor"]
    "Lorem, ipsum, dolor"

    >>> intercalate [0, 1] [[2, 3], [4, 5, 6], []]
    [2,3,0,1,4,5,6,0,1]

    >>> intercalate [1, 2, 3] [[], []]
    [1,2,3]

partition :: (a -> Bool) -> [a] -> ([a], [a]) Source #

The `partition` function takes a predicate and a list, and returns the pair of lists of elements which do and do not satisfy the predicate, respectively; i.e.,

    partition p xs == (filter p xs, filter (not . p) xs)

#### Examples

Expand

    >>> partition (`elem` "aeiou") "Hello World!"
    ("eoo","Hll Wrld!")

    >>> partition even [1..10]
    ([2,4,6,8,10],[1,3,5,7,9])

    >>> partition (< 5) [1..10]
    ([1,2,3,4],[5,6,7,8,9,10])

insert :: Ord a => a -> [a] -> [a] Source #

\(\mathcal{O}(n)\). The `insert` function takes an element and a list and inserts the element into the list at the first position where it is less than or equal to the next element. In particular, if the list is sorted before the call, the result will also be sorted. It is a special case of `insertBy`, which allows the programmer to supply their own comparison function.

#### Examples

Expand

    >>> insert (-1) [1, 2, 3]
    [-1,1,2,3]

    >>> insert 'd' "abcefg"
    "abcdefg"

    >>> insert 4 [1, 2, 3, 5, 6, 7]
    [1,2,3,4,5,6,7]

insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a] Source #

\(\mathcal{O}(n)\). The non-overloaded version of `insert`.

#### Examples

Expand

    >>> insertBy (\x y -> compare (length x) (length y)) [1, 2] [[1], [1, 2, 3], [1, 2, 3, 4]]
    [[1],[1,2],[1,2,3],[1,2,3,4]]

genericLength :: Num i => [a] -> i Source #

\(\mathcal{O}(n)\). The `genericLength` function is an overloaded version of `length`. In particular, instead of returning an `Int`, it returns any type which is an instance of `Num`. It is, however, less efficient than `length`.

#### Examples

Expand

    >>> genericLength [1, 2, 3] :: Int
    3
    >>> genericLength [1, 2, 3] :: Float
    3.0

Users should take care to pick a return type that is wide enough to contain the full length of the list. If the width is insufficient, the overflow behaviour will depend on the `(+)` implementation in the selected `Num` instance. The following example overflows because the actual list length of 200 lies outside of the `Int8` range of `-128..127`.

    >>> genericLength [1..200] :: Int8
    -56

genericTake :: Integral i => i -> [a] -> [a] Source #

The `genericTake` function is an overloaded version of `take`, which accepts any `Integral` value as the number of elements to take.

genericDrop :: Integral i => i -> [a] -> [a] Source #

The `genericDrop` function is an overloaded version of `drop`, which accepts any `Integral` value as the number of elements to drop.

genericSplitAt :: Integral i => i -> [a] -> ([a], [a]) Source #

The `genericSplitAt` function is an overloaded version of `splitAt`, which accepts any `Integral` value as the position at which to split.

genericIndex :: Integral i => [a] -> i -> a Source #

The `genericIndex` function is an overloaded version of `!!`, which accepts any `Integral` value as the index.

genericReplicate :: Integral i => i -> a -> [a] Source #

The `genericReplicate` function is an overloaded version of `replicate`, which accepts any `Integral` value as the number of repetitions to make.

zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)] Source #

The `zip4` function takes four lists and returns a list of quadruples, analogous to `zip`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)] Source #

The `zip5` function takes five lists and returns a list of five-tuples, analogous to `zip`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)] Source #

The `zip6` function takes six lists and returns a list of six-tuples, analogous to `zip`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)] Source #

The `zip7` function takes seven lists and returns a list of seven-tuples, analogous to `zip`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e] Source #

The `zipWith4` function takes a function which combines four elements, as well as four lists and returns a list of their point-wise combination, analogous to `zipWith`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] Source #

The `zipWith5` function takes a function which combines five elements, as well as five lists and returns a list of their point-wise combination, analogous to `zipWith`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] Source #

The `zipWith6` function takes a function which combines six elements, as well as six lists and returns a list of their point-wise combination, analogous to `zipWith`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h] Source #

The `zipWith7` function takes a function which combines seven elements, as well as seven lists and returns a list of their point-wise combination, analogous to `zipWith`. It is capable of list fusion, but it is restricted to its first list argument and its resulting list.

unzip4 :: [(a, b, c, d)] -> ([a], [b], [c], [d]) Source #

The `unzip4` function takes a list of quadruples and returns four lists, analogous to `unzip`.

unzip5 :: [(a, b, c, d, e)] -> ([a], [b], [c], [d], [e]) Source #

The `unzip5` function takes a list of five-tuples and returns five lists, analogous to `unzip`.

unzip6 :: [(a, b, c, d, e, f)] -> ([a], [b], [c], [d], [e], [f]) Source #

The `unzip6` function takes a list of six-tuples and returns six lists, analogous to `unzip`.

unzip7 :: [(a, b, c, d, e, f, g)] -> ([a], [b], [c], [d], [e], [f], [g]) Source #

The `unzip7` function takes a list of seven-tuples and returns seven lists, analogous to `unzip`.

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

The `deleteFirstsBy` function takes a predicate and two lists and returns the first list with the first occurrence of each element of the second list removed. This is the non-overloaded version of `(\\)`.

    (\\) == deleteFirstsBy (==)

The second list must be finite, but the first may be infinite.

#### Examples

Expand

    >>> deleteFirstsBy (>) [1..10] [3, 4, 5]
    [4,5,6,7,8,9,10]

    >>> deleteFirstsBy (/=) [1..10] [1, 3, 5]
    [4,5,6,7,8,9,10]

group :: Eq a => [a] -> [[a]] Source #

The `group` function takes a list and returns a list of lists such that the concatenation of the result is equal to the argument. Moreover, each sublist in the result is non-empty, all elements are equal to the first one, and consecutive equal elements of the input end up in the same element of the output list.

`group` is a special case of `groupBy`, which allows the programmer to supply their own equality test.

It's often preferable to use `Data.List.NonEmpty.``group`, which provides type-level guarantees of non-emptiness of inner lists. A common idiom to squash repeating elements `map` `head` `.` `group` is better served by `map` `Data.List.NonEmpty.``head` `.` `Data.List.NonEmpty.``group` because it avoids partial functions.

#### Examples

Expand

    >>> group "Mississippi"
    ["M","i","ss","i","ss","i","pp","i"]

    >>> group [1, 1, 1, 2, 2, 3, 4, 5, 5]
    [[1,1,1],[2,2],[3],[4],[5,5]]

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

The `groupBy` function is the non-overloaded version of `group`.

When a supplied relation is not transitive, it is important to remember that equality is checked against the first element in the group, not against the nearest neighbour:

    >>> groupBy (\a b -> b - a < 5) [0..19]
    [[0,1,2,3,4],[5,6,7,8,9],[10,11,12,13,14],[15,16,17,18,19]]

It's often preferable to use `Data.List.NonEmpty.``groupBy`, which provides type-level guarantees of non-emptiness of inner lists.

#### Examples

Expand

    >>> groupBy (/=) [1, 1, 1, 2, 3, 1, 4, 4, 5]
    [[1],[1],[1,2,3],[1,4,4,5]]

    >>> groupBy (>) [1, 3, 5, 1, 4, 2, 6, 5, 4]
    [[1],[3],[5,1,4,2],[6,5,4]]

    >>> groupBy (const not) [True, False, True, False, False, False, True]
    [[True,False],[True,False,False,False],[True]]

inits :: [a] -> [[a]] Source #

The `inits` function returns all initial segments of the argument, shortest first.

`inits` is semantically equivalent to ``map` `reverse` . `scanl` (`flip` (:)) []`, but under the hood uses a queue to amortize costs of `reverse`.

#### Laziness

Expand

Note that `inits` has the following strictness property: `inits (xs ++ _|_) = inits xs ++ _|_`

In particular, `inits _|_ = [] : _|_`

#### Examples

Expand

    >>> inits "abc"
    ["","a","ab","abc"]

    >>> inits []
    [[]]

inits is productive on infinite lists:

    >>> take 5 $ inits [1..]
    [[],[1],[1,2],[1,2,3],[1,2,3,4]]

tails :: [a] -> [[a]] Source #

\(\mathcal{O}(n)\). The `tails` function returns all final segments of the argument, longest first.

#### Laziness

Expand

Note that `tails` has the following strictness property: `tails _|_ = _|_ : _|_`

    >>> tails undefined
    [*** Exception: Prelude.undefined

    >>> drop 1 (tails [undefined, 1, 2])
    [[1, 2], [2], []]

#### Examples

Expand

    >>> tails "abc"
    ["abc","bc","c",""]

    >>> tails [1, 2, 3]
    [[1,2,3],[2,3],[3],[]]

    >>> tails []
    [[]]

subsequences :: [a] -> [[a]] Source #

The `subsequences` function returns the list of all subsequences of the argument.

#### Laziness

Expand

`subsequences` does not look ahead unless it must:

    >>> take 1 (subsequences undefined)
    [[]]
    >>> take 2 (subsequences ('a' : undefined))
    ["","a"]

#### Examples

Expand

    >>> subsequences "abc"
    ["","a","b","ab","c","ac","bc","abc"]

This function is productive on infinite inputs:

    >>> take 8 $ subsequences ['a'..]
    ["","a","b","ab","c","ac","bc","abc"]

permutations :: [a] -> [[a]] Source #

The `permutations` function returns the list of all permutations of the argument.

Note that the order of permutations is not lexicographic. It satisfies the following property:

    map (take n) (take (product [1..n]) (permutations ([1..n] ++ undefined))) == permutations [1..n]

#### Laziness

Expand

The `permutations` function is maximally lazy: for each `n`, the value of ``permutations` xs` starts with those permutations that permute ``take` n xs` and keep ``drop` n xs`.

#### Examples

Expand

    >>> permutations "abc"
    ["abc","bac","cba","bca","cab","acb"]

    >>> permutations [1, 2]
    [[1,2],[2,1]]

    >>> permutations []
    [[]]

This function is productive on infinite inputs:

    >>> take 6 $ map (take 3) $ permutations ['a'..]
    ["abc","bac","cba","bca","cab","acb"]

sort :: Ord a => [a] -> [a] Source #

The `sort` function implements a stable sorting algorithm. It is a special case of `sortBy`, which allows the programmer to supply their own comparison function.

Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.

The argument must be finite.

#### Examples

Expand

    >>> sort [1,6,4,3,2,5]
    [1,2,3,4,5,6]

    >>> sort "haskell"
    "aehklls"

    >>> import Data.Semigroup(Arg(..))
    >>> sort [Arg ":)" 0, Arg ":D" 0, Arg ":)" 1, Arg ":3" 0, Arg ":D" 1]
    [Arg ":)" 0,Arg ":)" 1,Arg ":3" 0,Arg ":D" 0,Arg ":D" 1]

singleton :: a -> [a] Source #

Construct a list from a single element.

#### Examples

Expand

    >>> singleton True
    [True]

    >>> singleton [1, 2, 3]
    [[1,2,3]]

    >>> singleton 'c'
    "c"

Since: base-4.15.0.0

lines :: String -> [String] Source #

Splits the argument into a list of lines stripped of their terminating `\n` characters. The `\n` terminator is optional in a final non-empty line of the argument string.

When the argument string is empty, or ends in a `\n` character, it can be recovered by passing the result of `lines` to the `unlines` function. Otherwise, `unlines` appends the missing terminating `\n`. This makes `unlines . lines` idempotent:

    (unlines . lines) . (unlines . lines) = (unlines . lines)

#### Examples

Expand

    >>> lines ""           -- empty input contains no lines
    []

    >>> lines "\n"         -- single empty line
    [""]

    >>> lines "one"        -- single unterminated line
    ["one"]

    >>> lines "one\n"      -- single non-empty line
    ["one"]

    >>> lines "one\n\n"    -- second line is empty
    ["one",""]

    >>> lines "one\ntwo"   -- second line is unterminated
    ["one","two"]

    >>> lines "one\ntwo\n" -- two non-empty lines
    ["one","two"]

unlines :: [String] -> String Source #

Appends a `\n` character to each input string, then concatenates the results. Equivalent to ``foldMap` (s -> s `++` "\n")`.

#### Examples

Expand

    >>> unlines ["Hello", "World", "!"]
    "Hello\nWorld\n!\n"

Note that ``unlines` `.` `lines` `/=` `id`` when the input is not `\n`-terminated:

    >>> unlines . lines $ "foo\nbar"
    "foo\nbar\n"

words :: String -> [String] Source #

`words` breaks a string up into a list of words, which were delimited by white space (as defined by `isSpace`). This function trims any white spaces at the beginning and at the end.

#### Examples

Expand

    >>> words "Lorem ipsum\ndolor"
    ["Lorem","ipsum","dolor"]

    >>> words " foo bar "
    ["foo","bar"]

unwords :: [String] -> String Source #

`unwords` joins words with separating spaces (U+0020 SPACE).

`unwords` is neither left nor right inverse of `words`:

    >>> words (unwords [" "])
    []
    >>> unwords (words "foo\nbar")
    "foo bar"

#### Examples

Expand

    >>> unwords ["Lorem", "ipsum", "dolor"]
    "Lorem ipsum dolor"

    >>> unwords ["foo", "bar", "", "baz"]
    "foo bar  baz"

isSubsequenceOf :: Eq a => [a] -> [a] -> Bool Source #

The `isSubsequenceOf` function takes two lists and returns `True` if all the elements of the first list occur, in order, in the second. The elements do not have to occur consecutively.

``isSubsequenceOf` x y` is equivalent to `x ``elem`` (`subsequences` y)`.

Note: `isSubsequenceOf` is often used in infix form.

#### Examples

Expand

    >>> "GHC" `isSubsequenceOf` "The Glorious Haskell Compiler"
    True

    >>> ['a','d'..'z'] `isSubsequenceOf` ['a'..'z']
    True

    >>> [1..10] `isSubsequenceOf` [10,9..0]
    False

For the result to be `True`, the first list must be finite; for the result to be `False`, the second list must be finite:

    >>> [0,2..10] `isSubsequenceOf` [0..]
    True

    >>> [0..] `isSubsequenceOf` [0,2..10]
    False

    >>> [0,2..] `isSubsequenceOf` [0..]
    * Hangs forever*

Since: base-4.8.0.0

fi :: (Integral a, Num b) => a -> b Source #

Short for `fromIntegral`.

chunksOf :: Int -> [a] -> [[a]] Source #

Given a maximum length, splits a list into sublists

    >>> chunksOf 5 (take 30 $ repeat 'a')
    ["aaaaa","aaaaa","aaaaa","aaaaa","aaaaa","aaaaa"]

(.:) :: (a -> b) -> (c -> d -> a) -> c -> d -> b Source #

Multivariable composition.

    f .: g ≡ (f .) . g ≡ \c d -> f (g c d)

(!?) :: [a] -> Int -> Maybe a Source #

Safe version of `(!!)`.

data NonEmpty a Source #

Non-empty (and non-strict) list type.

Since: base-4.9.0.0

Constructors

a :| [a] infixr 5 |

#### Instances

Instances details

MonadZip NonEmpty | Since: base-4.9.0.0
Instance details Defined in Control.Monad.Zip Methods mzip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) Source # mzipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c Source # munzip :: NonEmpty (a, b) -> (NonEmpty a, NonEmpty b) Source #
Foldable1 NonEmpty | Since: base-4.18.0.0

Instance details

Defined in Data.Foldable1

Methods

fold1 :: Semigroup m => NonEmpty m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> NonEmpty a -> m Source #

foldMap1' :: Semigroup m => (a -> m) -> NonEmpty a -> m Source #

toNonEmpty :: NonEmpty a -> NonEmpty a Source #

maximum :: Ord a => NonEmpty a -> a Source #

minimum :: Ord a => NonEmpty a -> a Source #

head :: NonEmpty a -> a Source #

last :: NonEmpty a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> NonEmpty a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> NonEmpty a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> NonEmpty a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> NonEmpty a -> b Source #

Eq1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftEq :: (a -> b -> Bool) -> NonEmpty a -> NonEmpty b -> Bool Source #
Ord1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftCompare :: (a -> b -> Ordering) -> NonEmpty a -> NonEmpty b -> Ordering Source #
Read1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmpty a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [NonEmpty a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (NonEmpty a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [NonEmpty a] Source #
Show1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonEmpty a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NonEmpty a] -> ShowS Source #
NFData1 NonEmpty | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> NonEmpty a -> () Source #
Applicative NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Base Methods pure :: a -> NonEmpty a Source # (<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b Source # liftA2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c Source # (*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source # (<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a Source #
Functor NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Base Methods fmap :: (a -> b) -> NonEmpty a -> NonEmpty b Source # (<$) :: a -> NonEmpty b -> NonEmpty a Source #
Monad NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Base Methods (>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b Source # (>>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source # return :: a -> NonEmpty a Source #
Foldable NonEmpty | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Data.Foldable

Methods

fold :: Monoid m => NonEmpty m -> m Source #

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m Source #

foldMap' :: Monoid m => (a -> m) -> NonEmpty a -> m Source #

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b Source #

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b Source #

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b Source #

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b Source #

foldr1 :: (a -> a -> a) -> NonEmpty a -> a Source #

foldl1 :: (a -> a -> a) -> NonEmpty a -> a Source #

toList :: NonEmpty a -> [a] Source #

null :: NonEmpty a -> Bool Source #

length :: NonEmpty a -> Int Source #

elem :: Eq a => a -> NonEmpty a -> Bool Source #

maximum :: Ord a => NonEmpty a -> a Source #

minimum :: Ord a => NonEmpty a -> a Source #

sum :: Num a => NonEmpty a -> a Source #

product :: Num a => NonEmpty a -> a Source #

Traversable NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) Source # sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) Source # mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) Source # sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) Source #
Generic1 NonEmpty |

Instance details

Defined in GHC.Internal.Generics

Associated Types

type Rep1 NonEmpty | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep1 NonEmpty = D1 ('MetaData "NonEmpty" "GHC.Internal.Base" "ghc-internal" 'False) (C1 ('MetaCons ":|" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))

Methods

from1 :: NonEmpty a -> Rep1 NonEmpty a Source #

to1 :: Rep1 NonEmpty a -> NonEmpty a Source #

Lift a => Lift (NonEmpty a :: Type) | Since: template-haskell-2.15.0.0
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => NonEmpty a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => NonEmpty a -> Code m (NonEmpty a) Source #
NFData a => NFData (NonEmpty a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: NonEmpty a -> () Source #
Semigroup (NonEmpty a) | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Base Methods (<>) :: NonEmpty a -> NonEmpty a -> NonEmpty a Source # sconcat :: NonEmpty (NonEmpty a) -> NonEmpty a Source # stimes :: Integral b => b -> NonEmpty a -> NonEmpty a Source #
Generic (NonEmpty a) |

Instance details

Defined in GHC.Internal.Generics

Associated Types

type Rep (NonEmpty a) | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep (NonEmpty a) = D1 ('MetaData "NonEmpty" "GHC.Internal.Base" "ghc-internal" 'False) (C1 ('MetaCons ":|" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))

Methods

from :: NonEmpty a -> Rep (NonEmpty a) x Source #

to :: Rep (NonEmpty a) x -> NonEmpty a Source #

IsList (NonEmpty a) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.IsList

Associated Types

type Item (NonEmpty a) |
Instance details Defined in GHC.Internal.IsList type Item (NonEmpty a) = a

Methods

fromList :: [Item (NonEmpty a)] -> NonEmpty a Source #

fromListN :: Int -> [Item (NonEmpty a)] -> NonEmpty a Source #

toList :: NonEmpty a -> [Item (NonEmpty a)] Source #

Read a => Read (NonEmpty a) | Since: base-4.11.0.0
Instance details Defined in GHC.Internal.Read Methods readsPrec :: Int -> ReadS (NonEmpty a) Source # readList :: ReadS [NonEmpty a] Source # readPrec :: ReadPrec (NonEmpty a) Source # readListPrec :: ReadPrec [NonEmpty a] Source #
Show a => Show (NonEmpty a) | Since: base-4.11.0.0
Instance details Defined in GHC.Internal.Show Methods showsPrec :: Int -> NonEmpty a -> ShowS Source # show :: NonEmpty a -> String Source # showList :: [NonEmpty a] -> ShowS Source #
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Base Methods (==) :: NonEmpty a -> NonEmpty a -> Bool Source # (/=) :: NonEmpty a -> NonEmpty a -> Bool Source #
Ord a => Ord (NonEmpty a) | Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.Base

Methods

compare :: NonEmpty a -> NonEmpty a -> Ordering Source #

(<) :: NonEmpty a -> NonEmpty a -> Bool Source #

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

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

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

max :: NonEmpty a -> NonEmpty a -> NonEmpty a Source #

min :: NonEmpty a -> NonEmpty a -> NonEmpty a Source #

type Rep1 NonEmpty | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep1 NonEmpty = D1 ('MetaData "NonEmpty" "GHC.Internal.Base" "ghc-internal" 'False) (C1 ('MetaCons ":|" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))

type Rep (NonEmpty a) | Since: base-4.6.0.0

Instance details

Defined in GHC.Internal.Generics

type Rep (NonEmpty a) = D1 ('MetaData "NonEmpty" "GHC.Internal.Base" "ghc-internal" 'False) (C1 ('MetaCons ":|" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))

type Item (NonEmpty a) |
Instance details Defined in GHC.Internal.IsList type Item (NonEmpty a) = a

notEmpty :: HasCallStack => [a] -> NonEmpty a Source #

`fromList` with a better error message. Useful to silence GHC's Pattern match(es) are non-exhaustive warning in places where the programmer knows it's always non-empty, but it's infeasible to express that in the type system.

safeGetWindowAttributes :: Window -> X (Maybe WindowAttributes) Source #

A safe version of `getWindowAttributes`.

mkAbsolutePath :: MonadIO m => FilePath -> m FilePath Source #

(Naïvely) turn a relative path into an absolute one.

- If the path starts with `/`, do nothing.
- If it starts with `~/`, replace that with the actual home
- directory.
- If it starts with `$`, read the name of an environment
- variable and replace it with the contents of that.
- Otherwise, prepend the home directory and `/` to the path.

findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a) Source #

Like `find`, but takes a monadic function instead; retains the short-circuiting behaviour of the non-monadic version.

For example,

    findM (\a -> putStr (show a <> " ") >> pure False) [1..10]

would print "1 2 3 4 5 6 7 8 9 10" and return `Nothing`, while

    findM (\a -> putStr (show a <> " ") >> pure True) [1..10]

would print `"1"` and return `Just 1`.

# Keys

keyToString :: (KeyMask, KeySym) -> String Source #

Convert a full key combination; i.e., a `KeyMask` and `KeySym` pair, into a string.

keymaskToString Source #

Arguments

:: KeyMask | Num lock mask
-> KeyMask | Modifier mask
-> String |

Convert a modifier mask into a useful string.

cleanKeyMask :: X (KeyMask -> KeyMask) Source #

Strip numlock, capslock, mouse buttons and XKB group from a `KeyMask`, leaving only modifier keys like Shift, Control, Super, Hyper in the mask (hence the "Key" in "cleanKeyMask").

Core's `cleanMask` only strips the first two because key events from passive grabs (key bindings) are stripped of mouse buttons and XKB group by the X server already for compatibility reasons. For more info, see: https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html#Delivering_a_Key_or_Button_Event_to_a_Client

regularKeys :: [(String, KeySym)] Source #

A list of "regular" (extended ASCII) keys.

allSpecialKeys :: [(String, KeySym)] Source #

A list of all special key names and their associated KeySyms.

specialKeys :: [(String, KeySym)] Source #

A list of special key names and their corresponding KeySyms.

multimediaKeys :: [(String, KeySym)] Source #

List of multimedia keys. If Xlib does not know about some keysym it's omitted from the list (`stringToKeysym` returns `noSymbol` in this case).

functionKeys :: [(String, KeySym)] Source #

A list pairing function key descriptor strings (e.g. `"<F2>"`) with the associated KeySyms.

type WindowScreen = Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail Source #

The specialized `Screen` derived from `WindowSet`.

# Infinite streams

data Stream a Source #

An infinite stream type

Constructors

!a :~ (Stream a) infixr 5 |

#### Instances

Instances details

Functor Stream Source # |
Instance details Defined in XMonad.Prelude Methods fmap :: (a -> b) -> Stream a -> Stream b Source # (<$) :: a -> Stream b -> Stream a Source #
IsList (Stream a) Source # |

Instance details

Defined in XMonad.Prelude

Associated Types

type Item (Stream a) |
Instance details Defined in XMonad.Prelude type Item (Stream a) = a

Methods

fromList :: [Item (Stream a)] -> Stream a Source #

fromListN :: Int -> [Item (Stream a)] -> Stream a Source #

toList :: Stream a -> [Item (Stream a)] Source #

type Item (Stream a) Source # |
Instance details Defined in XMonad.Prelude type Item (Stream a) = a

(+~) :: [a] -> Stream a -> Stream a infixr 5 Source #

Absorb a list into an infinite stream.

cycleS :: NonEmpty a -> Stream a Source #

Absorb a non-empty list into an infinite stream.

takeS :: Int -> Stream a -> [a] Source #

`takeS n stream` returns the first `n` elements of `stream`; if `n < 0`, this returns the empty list.

toList :: IsList l => l -> [Item l] Source #

The `toList` function extracts a list of `Item l` from the structure `l`. It should satisfy fromList . toList = id.

fromList :: IsList l => [Item l] -> l Source #

The `fromList` function constructs the structure `l` from the given list of `Item l`