Agda-2.8.0: A dependently typed functional programming language and proof assistant

Safe Haskell | None
Language | Haskell2010

Agda.Utils.List1

Description

Non-empty lists.

Better name `List1` for non-empty lists, plus missing functionality.

Import: @

{-# LANGUAGE PatternSynonyms #-}

import Agda.Utils.List1 (List1, pattern (:|)) import qualified Agda.Utils.List1 as List1

@

Synopsis

- foldr :: (a -> b -> b) -> (a -> b) -> List1 a -> b
- union :: Eq a => List1 a -> List1 a -> List1 a
- mapMaybe :: (a -> Maybe b) -> List1 a -> [b]
- catMaybes :: List1 (Maybe a) -> [a]
- concat :: [List1 a] -> [a]
- lefts :: List1 (Either a b) -> [a]
- rights :: List1 (Either a b) -> [b]
- partitionEithers :: List1 (Either a b) -> ([a], [b])
- find :: (a -> Bool) -> List1 a -> Maybe a
- unwords :: List1 String -> String
- zipWithM :: Applicative m => (a -> b -> m c) -> List1 a -> List1 b -> m (List1 c)
- zipWithM_ :: Applicative m => (a -> b -> m c) -> List1 a -> List1 b -> m ()
- snoc :: [a] -> a -> List1 a
- unzipWith :: (a -> (b, c)) -> List1 a -> (List1 b, List1 c)
- wordsBy :: (a -> Bool) -> [a] -> [List1 a]
- type List1 = NonEmpty
- unlessNullM :: Monad m => m [a] -> (List1 a -> m ()) -> m ()
- type String1 = List1 Char
- updateHead :: (a -> a) -> List1 a -> List1 a
- updateLast :: (a -> a) -> List1 a -> List1 a
- initLast :: List1 a -> ([a], a)
- ifNull :: [a] -> b -> (List1 a -> b) -> b
- unlessNull :: Applicative m => [a] -> (List1 a -> m ()) -> m ()
- last2 :: List1 a -> Maybe (a, a)
- ifNotNull :: [a] -> (List1 a -> b) -> b -> b
- liftList1 :: (List1 a -> List1 b) -> [a] -> [b]
- breakAfter :: (a -> Bool) -> List1 a -> (List1 a, [a])
- allEqual :: Eq a => List1 a -> Bool
- nubM :: Monad m => (a -> a -> m Bool) -> List1 a -> m (List1 a)
- toList' :: Maybe (List1 a) -> [a]
- fromListSafe :: List1 a -> [a] -> List1 a
- groupOn :: Ord b => (a -> b) -> [a] -> [List1 a]
- groupOn1 :: Ord b => (a -> b) -> List1 a -> List1 (List1 a)
- groupBy' :: (a -> a -> Bool) -> [a] -> [List1 a]
- groupByFst :: Eq a => [(a, b)] -> [(a, List1 b)]
- groupByFst1 :: Eq a => List1 (a, b) -> List1 (a, List1 b)
- concatMap1 :: (a -> List1 b) -> List1 a -> List1 b
- lensHead :: Functor f => (a -> f a) -> List1 a -> f (List1 a)
- lensLast :: Functor f => (a -> f a) -> List1 a -> f (List1 a)
- singleton :: a -> NonEmpty a
- insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a
- map :: (a -> b) -> NonEmpty a -> NonEmpty b
- filter :: (a -> Bool) -> NonEmpty a -> [a]
- data NonEmpty a = a :| [a]
- unfoldr :: (a -> (b, Maybe a)) -> a -> NonEmpty b
- sortOn :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty a
- transpose :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)
- sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a
- cycle :: NonEmpty a -> NonEmpty a
- zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b)
- head :: NonEmpty a -> a
- uncons :: NonEmpty a -> (a, Maybe (NonEmpty a))
- tail :: NonEmpty a -> [a]
- last :: NonEmpty a -> a
- init :: NonEmpty a -> [a]
- length :: NonEmpty a -> Int
- scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b
- scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
- scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b
- scanr1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
- iterate :: (a -> a) -> a -> NonEmpty a
- repeat :: a -> NonEmpty a
- takeWhile :: (a -> Bool) -> NonEmpty a -> [a]
- dropWhile :: (a -> Bool) -> NonEmpty a -> [a]
- take :: Int -> NonEmpty a -> [a]
- drop :: Int -> NonEmpty a -> [a]
- splitAt :: Int -> NonEmpty a -> ([a], [a])
- span :: (a -> Bool) -> NonEmpty a -> ([a], [a])
- break :: (a -> Bool) -> NonEmpty a -> ([a], [a])
- reverse :: NonEmpty a -> NonEmpty a
- (!!) :: HasCallStack => NonEmpty a -> Int -> a
- zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
- xor :: NonEmpty Bool -> Bool
- isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool
- nub :: Eq a => NonEmpty a -> NonEmpty a
- nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a
- intersperse :: a -> NonEmpty a -> NonEmpty a
- partition :: (a -> Bool) -> NonEmpty a -> ([a], [a])
- group :: (Foldable f, Eq a) => f a -> [NonEmpty a]
- groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a]
- inits :: Foldable f => f a -> NonEmpty [a]
- tails :: Foldable f => f a -> NonEmpty [a]
- permutations :: [a] -> NonEmpty [a]
- sort :: Ord a => NonEmpty a -> NonEmpty a
- sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a
- groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a]
- unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b
- nonEmpty :: [a] -> Maybe (NonEmpty a)
- (<|) :: a -> NonEmpty a -> NonEmpty a
- cons :: a -> NonEmpty a -> NonEmpty a
- inits1 :: NonEmpty a -> NonEmpty (NonEmpty a)
- tails1 :: NonEmpty a -> NonEmpty (NonEmpty a)
- some1 :: Alternative f => f a -> f (NonEmpty a)
- groupAllWith :: Ord b => (a -> b) -> [a] -> [NonEmpty a]
- group1 :: Eq a => NonEmpty a -> NonEmpty (NonEmpty a)
- groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a)
- groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)
- groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)
- permutations1 :: NonEmpty a -> NonEmpty (NonEmpty a)
- append :: NonEmpty a -> NonEmpty a -> NonEmpty a
- appendList :: NonEmpty a -> [a] -> NonEmpty a
- prependList :: [a] -> NonEmpty a -> NonEmpty a
- class IsList l where
  - type Item l
  - fromList :: [Item l] -> l
  - fromListN :: Int -> [Item l] -> l
  - toList :: l -> [Item l]
- type family Item l
- unzip :: Functor f => f (a, b) -> (f a, f b)

# Documentation

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

List `foldr` but with a base case for the singleton list.

union :: Eq a => List1 a -> List1 a -> List1 a Source #

Like `union`. Duplicates in the first list are not removed. O(nm).

mapMaybe :: (a -> Maybe b) -> List1 a -> [b] Source #

Like `mapMaybe`.

catMaybes :: List1 (Maybe a) -> [a] Source #

Like `catMaybes`.

concat :: [List1 a] -> [a] Source #

Concatenate one or more non-empty lists.

lefts :: List1 (Either a b) -> [a] Source #

Like `lefts`.

rights :: List1 (Either a b) -> [b] Source #

Like `rights`.

partitionEithers :: List1 (Either a b) -> ([a], [b]) Source #

Like `partitionEithers`.

find :: (a -> Bool) -> List1 a -> Maybe a Source #

Like `find`.

unwords :: List1 String -> String Source #

Like `unwords`.

zipWithM :: Applicative m => (a -> b -> m c) -> List1 a -> List1 b -> m (List1 c) Source #

Like `zipWithM`.

zipWithM_ :: Applicative m => (a -> b -> m c) -> List1 a -> List1 b -> m () Source #

Like `zipWithM`.

snoc :: [a] -> a -> List1 a Source #

Build a list with one element.

More precise type for `snoc`.

unzipWith :: (a -> (b, c)) -> List1 a -> (List1 b, List1 c) Source #

Like `unzipWith`.

wordsBy :: (a -> Bool) -> [a] -> [List1 a] Source #

Split a list into sublists. Generalisation of the prelude function `words`. Same as `wordsBy` and `wordsBy`, but with the non-emptyness guarantee on the chunks. O(n).

    words xs == wordsBy isSpace xs

type List1 = NonEmpty Source #

unlessNullM :: Monad m => m [a] -> (List1 a -> m ()) -> m () Source #

type String1 = List1 Char Source #

updateHead :: (a -> a) -> List1 a -> List1 a Source #

Update the first element of a non-empty list. O(1).

updateLast :: (a -> a) -> List1 a -> List1 a Source #

Update the last element of a non-empty list. O(n).

initLast :: List1 a -> ([a], a) Source #

Return the last element and the rest.

ifNull :: [a] -> b -> (List1 a -> b) -> b Source #

unlessNull :: Applicative m => [a] -> (List1 a -> m ()) -> m () Source #

The more general type `Null m => [a] -> (List1 a -> m) -> m` often causes type inference to fail, as we do not in general have `instance Applicative m => Null (m ())`.

last2 :: List1 a -> Maybe (a, a) Source #

Last two elements (safe). O(n).

ifNotNull :: [a] -> (List1 a -> b) -> b -> b Source #

liftList1 :: (List1 a -> List1 b) -> [a] -> [b] Source #

Lift a function on non-empty lists to a function on lists.

This is in essence `fmap` for `Maybe`, if we take `[a] = Maybe (List1 a)`.

breakAfter :: (a -> Bool) -> List1 a -> (List1 a, [a]) Source #

Breaks a list just after an element satisfying the predicate is found.

    >>> breakAfter even [1,3,5,2,4,7,8]
    (1 :| [3,5,2],[4,7,8])

allEqual :: Eq a => List1 a -> Bool Source #

Checks if all the elements in the list are equal. Assumes that the `Eq` instance stands for an equivalence relation. O(n).

nubM :: Monad m => (a -> a -> m Bool) -> List1 a -> m (List1 a) Source #

Non-efficient, monadic `nub`. O(n²).

toList' :: Maybe (List1 a) -> [a] Source #

Lossless `toList`, opposite of `nonEmpty`.

fromListSafe Source #

Arguments

:: List1 a | Default value if convertee is empty.
-> [a] | List to convert, supposedly non-empty.
-> List1 a | Converted list.

Safe version of `fromList`.

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

``groupOn` f = `groupBy` ((`==`) `on` f) `.` `sortBy` (`compare` `on` f)`. O(n log n).

groupOn1 :: Ord b => (a -> b) -> List1 a -> List1 (List1 a) Source #

groupBy' :: (a -> a -> Bool) -> [a] -> [List1 a] Source #

More precise type for `groupBy'`.

A variant of `groupBy` which applies the predicate to consecutive pairs. O(n).

groupByFst :: Eq a => [(a, b)] -> [(a, List1 b)] Source #

Group consecutive items that share the same first component.

groupByFst1 :: Eq a => List1 (a, b) -> List1 (a, List1 b) Source #

Group consecutive items that share the same first component.

concatMap1 :: (a -> List1 b) -> List1 a -> List1 b Source #

lensHead :: Functor f => (a -> f a) -> List1 a -> f (List1 a) Source #

Focus on the first element of a non-empty list. O(1).

lensLast :: Functor f => (a -> f a) -> List1 a -> f (List1 a) Source #

Focus on the last element of a non-empty list. O(n).

singleton :: a -> NonEmpty a Source #

Construct a `NonEmpty` list from a single element.

Since: base-4.15

insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a Source #

``insert` x xs` inserts `x` into the last position in `xs` where it is still less than or equal to the next element. In particular, if the list is sorted beforehand, the result will also be sorted.

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

Map a function over a `NonEmpty` stream.

filter :: (a -> Bool) -> NonEmpty a -> [a] Source #

``filter` p xs` removes any elements from `xs` that do not satisfy `p`.

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

NumHoles NameParts Source # |
Instance details Defined in Agda.Syntax.Concrete.Name Methods numHoles :: NameParts -> Int Source #
FromJSON1 NonEmpty |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (NonEmpty a) Source # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [NonEmpty a] Source # liftOmittedField :: Maybe a -> Maybe (NonEmpty a) Source #
ToJSON1 NonEmpty |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> NonEmpty a -> Value Source #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [NonEmpty a] -> Value Source #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> NonEmpty a -> Encoding Source #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [NonEmpty a] -> Encoding Source #

liftOmitField :: (a -> Bool) -> NonEmpty a -> Bool Source #

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 #

IsString String1 Source # |
Instance details Defined in Agda.Utils.String Methods fromString :: String -> String1 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 #
Hashable1 NonEmpty | Since: hashable-1.3.1.0
Instance details Defined in Data.Hashable.Class Methods liftHashWithSalt :: (Int -> a -> Int) -> Int -> NonEmpty a -> Int 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 #

Singleton a (NonEmpty a) Source # |
Instance details Defined in Agda.Utils.Singleton Methods singleton :: 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 #
Pretty a => Pretties (List1 a) Source # |
Instance details Defined in Agda.Compiler.JS.Pretty Methods pretties :: (Nat, Bool, JSModuleStyle) -> List1 a -> [Doc] Source #
SubstExpr a => SubstExpr (List1 a) Source # |
Instance details Defined in Agda.Syntax.Abstract Methods substExpr :: [(Name, Expr)] -> List1 a -> List1 a Source #
DeclaredNames a => DeclaredNames (List1 a) Source # |
Instance details Defined in Agda.Syntax.Abstract.Views Methods declaredNames :: Collection KName m => List1 a -> m Source #
ExprLike a => ExprLike (List1 a) Source # |
Instance details Defined in Agda.Syntax.Abstract.Views Methods recurseExpr :: RecurseExprFn m (List1 a) Source # foldExpr :: FoldExprFn m (List1 a) Source # traverseExpr :: TraverseExprFn m (List1 a) Source # mapExpr :: (Expr -> Expr) -> List1 a -> List1 a Source #
Pretty a => Pretty (List1 a) Source # |
Instance details Defined in Agda.Syntax.Common.Pretty Methods pretty :: List1 a -> Doc Source # prettyPrec :: Int -> List1 a -> Doc Source # prettyList :: [List1 a] -> Doc Source #
ExprLike a => ExprLike (List1 a) Source # |
Instance details Defined in Agda.Syntax.Concrete.Generic Methods mapExpr :: (Expr -> Expr) -> List1 a -> List1 a Source # foldExpr :: Monoid m => (Expr -> m) -> List1 a -> m Source # traverseExpr :: Monad m => (Expr -> m Expr) -> List1 a -> m (List1 a) Source #
FoldDecl a => FoldDecl (List1 a) Source # |
Instance details Defined in Agda.Syntax.Concrete.Generic Methods foldDecl :: Monoid m => (Declaration -> m) -> List1 a -> m Source #
TraverseDecl a => TraverseDecl (List1 a) Source # |
Instance details Defined in Agda.Syntax.Concrete.Generic Methods preTraverseDecl :: Monad m => (Declaration -> m Declaration) -> List1 a -> m (List1 a) Source #
CPatternLike p => CPatternLike (List1 p) Source # |
Instance details Defined in Agda.Syntax.Concrete.Pattern Methods foldrCPattern :: Monoid m => (Pattern -> m -> m) -> List1 p -> m Source # traverseCPatternA :: (Applicative m, Functor m) => (Pattern -> m Pattern -> m Pattern) -> List1 p -> m (List1 p) Source # traverseCPatternM :: Monad m => (Pattern -> m Pattern) -> (Pattern -> m Pattern) -> List1 p -> m (List1 p) Source #
TermLike a => TermLike (List1 a) Source # |
Instance details Defined in Agda.Syntax.Internal.Generic Methods traverseTermM :: Monad m => (Term -> m Term) -> List1 a -> m (List1 a) Source # foldTerm :: Monoid m => (Term -> m) -> List1 a -> m Source #
NamesIn a => NamesIn (List1 a) Source # |
Instance details Defined in Agda.Syntax.Internal.Names Methods namesAndMetasIn' :: Monoid m => (Either QName MetaId -> m) -> List1 a -> m Source #
HasRange a => HasRange (List1 a) Source # | Precondition: The ranges of the list elements must point to the same file (or be empty).
Instance details Defined in Agda.Syntax.Position Methods getRange :: List1 a -> Range Source #
HasRangeWithoutFile a => HasRangeWithoutFile (List1 a) Source # |
Instance details Defined in Agda.Syntax.Position Methods getRangeWithoutFile :: List1 a -> RangeWithoutFile Source #
KillRange a => KillRange (List1 a) Source # |
Instance details Defined in Agda.Syntax.Position Methods killRange :: KillRangeT (List1 a) Source #
SetBindingSite a => SetBindingSite (List1 a) Source # |
Instance details Defined in Agda.Syntax.Scope.Base Methods setBindingSite :: Range -> List1 a -> List1 a Source #
ToConcrete a => ToConcrete (List1 a) Source # |

Instance details

Defined in Agda.Syntax.Translation.AbstractToConcrete

Associated Types

type ConOfAbs (List1 a) |
Instance details Defined in Agda.Syntax.Translation.AbstractToConcrete type ConOfAbs (List1 a) = List1 (ConOfAbs a)

Methods

toConcrete :: MonadToConcrete m => List1 a -> m (ConOfAbs (List1 a)) Source #

bindToConcrete :: MonadToConcrete m => List1 a -> (ConOfAbs (List1 a) -> m b) -> m b Source #

ToAbstract c => ToAbstract (List1 c) Source # |

Instance details

Defined in Agda.Syntax.Translation.ConcreteToAbstract

Associated Types

type AbsOfCon (List1 c) |
Instance details Defined in Agda.Syntax.Translation.ConcreteToAbstract type AbsOfCon (List1 c) = List1 (AbsOfCon c)

Methods

toAbstract :: List1 c -> ScopeM (AbsOfCon (List1 c)) Source #

Reify i => Reify (List1 i) Source # |

Instance details

Defined in Agda.Syntax.Translation.InternalToAbstract

Associated Types

type ReifiesTo (List1 i) |
Instance details Defined in Agda.Syntax.Translation.InternalToAbstract type ReifiesTo (List1 i) = List1 (ReifiesTo i)

Methods

reify :: MonadReify m => List1 i -> m (ReifiesTo (List1 i)) Source #

reifyWhen :: MonadReify m => Bool -> List1 i -> m (ReifiesTo (List1 i)) Source #

ToAbstract (List1 (QNamed Clause)) Source # |

Instance details

Defined in Agda.Syntax.Translation.ReflectedToAbstract

Associated Types

type AbsOfRef (List1 (QNamed Clause)) |
Instance details Defined in Agda.Syntax.Translation.ReflectedToAbstract type AbsOfRef (List1 (QNamed Clause)) = List1 Clause

Methods

toAbstract :: MonadReflectedToAbstract m => List1 (QNamed Clause) -> m (AbsOfRef (List1 (QNamed Clause))) Source #

Free t => Free (List1 t) Source # |
Instance details Defined in Agda.TypeChecking.Free.Lazy Methods freeVars' :: IsVarSet a c => List1 t -> FreeM a c Source #
PrettyTCM a => PrettyTCM (List1 a) Source # |
Instance details Defined in Agda.TypeChecking.Pretty Methods prettyTCM :: MonadPretty m => List1 a -> m Doc Source #
Instantiate t => Instantiate (List1 t) Source # |
Instance details Defined in Agda.TypeChecking.Reduce Methods instantiate' :: List1 t -> ReduceM (List1 t) Source #
InstantiateFull t => InstantiateFull (List1 t) Source # |
Instance details Defined in Agda.TypeChecking.Reduce Methods instantiateFull' :: List1 t -> ReduceM (List1 t) Source #
Normalise t => Normalise (List1 t) Source # |
Instance details Defined in Agda.TypeChecking.Reduce Methods normalise' :: List1 t -> ReduceM (List1 t) Source #
EmbPrj a => EmbPrj (List1 a) Source # |
Instance details Defined in Agda.TypeChecking.Serialise.Instances.Common Methods icode :: List1 a -> S Word32 Source # icod_ :: List1 a -> S Word32 Source # value :: Word32 -> R (List1 a) Source #
Subst a => Subst (List1 a) Source # |

Instance details

Defined in Agda.TypeChecking.Substitute

Associated Types

type SubstArg (List1 a) |
Instance details Defined in Agda.TypeChecking.Substitute type SubstArg (List1 a) = SubstArg a

Methods

applySubst :: Substitution' (SubstArg (List1 a)) -> List1 a -> List1 a Source #

Sized (List1 a) Source # |
Instance details Defined in Agda.Utils.Size Methods size :: List1 a -> Int Source # natSize :: List1 a -> Peano Source #
FromJSON a => FromJSON (NonEmpty a) |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (NonEmpty a) Source # parseJSONList :: Value -> Parser [NonEmpty a] Source # omittedField :: Maybe (NonEmpty a) Source #
ToJSON a => ToJSON (NonEmpty a) |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: NonEmpty a -> Value Source # toEncoding :: NonEmpty a -> Encoding Source # toJSONList :: [NonEmpty a] -> Value Source # toEncodingList :: [NonEmpty a] -> Encoding Source # omitField :: NonEmpty a -> Bool Source #
Binary a => Binary (NonEmpty a) | Since: binary-0.8.4.0
Instance details Defined in Data.Binary.Class Methods put :: NonEmpty a -> Put Source # get :: Get (NonEmpty a) Source # putList :: [NonEmpty a] -> Put Source #
ToMarkup (NonEmpty Char) |
Instance details Defined in Text.Blaze Methods toMarkup :: NonEmpty Char -> Markup preEscapedToMarkup :: NonEmpty Char -> Markup
ToValue (NonEmpty Char) |
Instance details Defined in Text.Blaze Methods toValue :: NonEmpty Char -> AttributeValue preEscapedToValue :: NonEmpty Char -> AttributeValue
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 #

Hashable a => Hashable (NonEmpty a) |
Instance details Defined in Data.Hashable.Class Methods hashWithSalt :: Int -> NonEmpty a -> Int Source # hash :: NonEmpty a -> Int Source #
AddContext (List1 Name, Dom Type) Source # |
Instance details Defined in Agda.TypeChecking.Monad.Context Methods addContext :: MonadAddContext m => (List1 Name, Dom Type) -> m a -> m a Source # contextSize :: (List1 Name, Dom Type) -> Nat Source #
AddContext (List1 (Arg Name), Type) Source # |
Instance details Defined in Agda.TypeChecking.Monad.Context Methods addContext :: MonadAddContext m => (List1 (Arg Name), Type) -> m a -> m a Source # contextSize :: (List1 (Arg Name), Type) -> Nat Source #
AddContext (List1 (NamedArg Name), Type) Source # |
Instance details Defined in Agda.TypeChecking.Monad.Context Methods addContext :: MonadAddContext m => (List1 (NamedArg Name), Type) -> m a -> m a Source # contextSize :: (List1 (NamedArg Name), Type) -> Nat Source #
AddContext (List1 (WithHiding Name), Dom Type) Source # |
Instance details Defined in Agda.TypeChecking.Monad.Context Methods addContext :: MonadAddContext m => (List1 (WithHiding Name), Dom Type) -> m a -> m a Source # contextSize :: (List1 (WithHiding Name), Dom Type) -> Nat 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 ConOfAbs (List1 a) Source # |
Instance details Defined in Agda.Syntax.Translation.AbstractToConcrete type ConOfAbs (List1 a) = List1 (ConOfAbs a)
type AbsOfCon (List1 c) Source # |
Instance details Defined in Agda.Syntax.Translation.ConcreteToAbstract type AbsOfCon (List1 c) = List1 (AbsOfCon c)
type ReifiesTo (List1 i) Source # |
Instance details Defined in Agda.Syntax.Translation.InternalToAbstract type ReifiesTo (List1 i) = List1 (ReifiesTo i)
type AbsOfRef (List1 (QNamed Clause)) Source # |
Instance details Defined in Agda.Syntax.Translation.ReflectedToAbstract type AbsOfRef (List1 (QNamed Clause)) = List1 Clause
type SubstArg (List1 a) Source # |
Instance details Defined in Agda.TypeChecking.Substitute type SubstArg (List1 a) = SubstArg a
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

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

The `unfoldr` function is analogous to Data.List's `unfoldr` operation.

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

Sort a `NonEmpty` on a user-supplied projection of its elements. See `sortOn` for more detailed information.

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

`sortWith` is an alias for `sortBy . comparing`.

Since: base-4.20.0.0

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

`transpose` for `NonEmpty`, behaves the same as `transpose` The rows/columns need not be the same length, in which case > transpose . transpose /= id

sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a Source #

`sortBy` for `NonEmpty`, behaves the same as `sortBy`

cycle :: NonEmpty a -> NonEmpty a Source #

``cycle` xs` returns the infinite repetition of `xs`:

    cycle (1 :| [2,3]) = 1 :| [2,3,1,2,3,...]

zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) Source #

The `zip` function takes two streams and returns a stream of corresponding pairs.

head :: NonEmpty a -> a Source #

Extract the first element of the stream.

uncons :: NonEmpty a -> (a, Maybe (NonEmpty a)) Source #

`uncons` produces the first element of the stream, and a stream of the remaining elements, if any.

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

Extract the possibly-empty tail of the stream.

last :: NonEmpty a -> a Source #

Extract the last element of the stream.

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

Extract everything except the last element of the stream.

length :: NonEmpty a -> Int Source #

Number of elements in `NonEmpty` list.

scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b Source #

`scanl` is similar to `foldl`, but returns a stream of successive reduced values from the left:

    scanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...]

Note that

    last (scanl f z xs) == foldl f z xs.

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

`scanl1` is a variant of `scanl` that has no starting value argument:

    scanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]

scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b Source #

`scanr` is the right-to-left dual of `scanl`. Note that

    head (scanr f z xs) == foldr f z xs.

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

`scanr1` is a variant of `scanr` that has no starting value argument.

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

``iterate` f x` produces the infinite sequence of repeated applications of `f` to `x`.

    iterate f x = x :| [f x, f (f x), ..]

repeat :: a -> NonEmpty a Source #

``repeat` x` returns a constant stream, where all elements are equal to `x`.

takeWhile :: (a -> Bool) -> NonEmpty a -> [a] Source #

``takeWhile` p xs` returns the longest prefix of the stream `xs` for which the predicate `p` holds.

dropWhile :: (a -> Bool) -> NonEmpty a -> [a] Source #

``dropWhile` p xs` returns the suffix remaining after ``takeWhile` p xs`.

take :: Int -> NonEmpty a -> [a] Source #

``take` n xs` returns the first `n` elements of `xs`.

drop :: Int -> NonEmpty a -> [a] Source #

``drop` n xs` drops the first `n` elements off the front of the sequence `xs`.

splitAt :: Int -> NonEmpty a -> ([a], [a]) Source #

``splitAt` n xs` returns a pair consisting of the prefix of `xs` of length `n` and the remaining stream immediately following this prefix.

    'splitAt' n xs == ('take' n xs, 'drop' n xs)
    xs == ys ++ zs where (ys, zs) = 'splitAt' n xs

span :: (a -> Bool) -> NonEmpty a -> ([a], [a]) Source #

``span` p xs` returns the longest prefix of `xs` that satisfies `p`, together with the remainder of the stream.

    'span' p xs == ('takeWhile' p xs, 'dropWhile' p xs)
    xs == ys ++ zs where (ys, zs) = 'span' p xs

break :: (a -> Bool) -> NonEmpty a -> ([a], [a]) Source #

The ``break` p` function is equivalent to ``span` (not . p)`.

reverse :: NonEmpty a -> NonEmpty a Source #

`reverse` a finite NonEmpty stream.

(!!) :: HasCallStack => NonEmpty a -> Int -> a infixl 9 Source #

`xs !! n` returns the element of the stream `xs` at index `n`. Note that the head of the stream has index 0.

Beware: a negative or out-of-bounds index will cause an error.

zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c Source #

The `zipWith` function generalizes `zip`. Rather than tupling the elements, the elements are combined using the function passed as the first argument.

xor :: NonEmpty Bool -> Bool Source #

Compute n-ary logic exclusive OR operation on `NonEmpty` list.

isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool Source #

The `isPrefixOf` function returns `True` if the first argument is a prefix of the second.

nub :: Eq a => NonEmpty a -> NonEmpty a Source #

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 inequality test.

nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a Source #

The `nubBy` function behaves just like `nub`, except it uses a user-supplied equality predicate instead of the overloaded `==` function.

intersperse :: a -> NonEmpty a -> NonEmpty a Source #

'intersperse x xs' alternates elements of the list with copies of `x`.

    intersperse 0 (1 :| [2,3]) == 1 :| [0,2,0,3]

partition :: (a -> Bool) -> NonEmpty a -> ([a], [a]) Source #

The `partition` function takes a predicate `p` and a stream `xs`, and returns a pair of lists. The first list corresponds to the elements of `xs` for which `p` holds; the second corresponds to the elements of `xs` for which `p` does not hold.

    'partition' p xs = ('filter' p xs, 'filter' (not . p) xs)

group :: (Foldable f, Eq a) => f a -> [NonEmpty a] Source #

The `group` function takes a stream and returns a list of streams such that flattening the resulting list is equal to the argument. Moreover, each stream in the resulting list contains only equal elements, and consecutive equal elements of the input end up in the same stream of the output list. For example, in list notation:

    >>> group "Mississippi"
    ["M", "i", "ss", "i", "ss", "i", "pp", "i"]

groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a] Source #

`groupBy` operates like `group`, but uses the provided equality predicate instead of `==`.

inits :: Foldable f => f a -> NonEmpty [a] Source #

The `inits` function takes a stream `xs` and returns all the finite prefixes of `xs`, starting with the shortest. The result is `NonEmpty` because the result always contains the empty list as the first element.

    inits [1,2,3] == [] :| [[1], [1,2], [1,2,3]]
    inits [1] == [] :| [[1]]
    inits [] == [] :| []

tails :: Foldable f => f a -> NonEmpty [a] Source #

The `tails` function takes a stream `xs` and returns all the suffixes of `xs`, starting with the longest. The result is `NonEmpty` because the result always contains the empty list as the last element.

    tails [1,2,3] == [1,2,3] :| [[2,3], [3], []]
    tails [1] == [1] :| [[]]
    tails [] == [] :| []

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

The `permutations` function returns the list of all permutations of the argument.

Since: base-4.20.0.0

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

Sort a stream.

sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a Source #

`sortWith` for `NonEmpty`, behaves the same as:

    sortBy . comparing

groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a] Source #

`groupWith` operates like `group`, but uses the provided projection when comparing for equality

unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b Source #

`unfold` produces a new stream by repeatedly applying the unfolding function to the seed value to produce an element of type `b` and a new seed value. When the unfolding function returns `Nothing` instead of a new seed value, the stream ends.

nonEmpty :: [a] -> Maybe (NonEmpty a) Source #

`nonEmpty` efficiently turns a normal list into a `NonEmpty` stream, producing `Nothing` if the input is empty.

(<|) :: a -> NonEmpty a -> NonEmpty a infixr 5 Source #

Prepend an element to the stream.

cons :: a -> NonEmpty a -> NonEmpty a Source #

Synonym for `<|`.

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

The `inits1` function takes a `NonEmpty` stream `xs` and returns all the `NonEmpty` finite prefixes of `xs`, starting with the shortest.

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

Since: base-4.18

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

The `tails1` function takes a `NonEmpty` stream `xs` and returns all the non-empty suffixes of `xs`, starting with the longest.

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

Since: base-4.18

some1 :: Alternative f => f a -> f (NonEmpty a) Source #

``some1` x` sequences `x` one or more times.

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

`groupAllWith` operates like `groupWith`, but sorts the list first so that each equivalence class has, at most, one list in the output

group1 :: Eq a => NonEmpty a -> NonEmpty (NonEmpty a) Source #

`group1` operates like `group`, but uses the knowledge that its input is non-empty to produce guaranteed non-empty output.

groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) Source #

`groupBy1` is to `group1` as `groupBy` is to `group`.

groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) Source #

`groupWith1` is to `group1` as `groupWith` is to `group`

groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) Source #

`groupAllWith1` is to `groupWith1` as `groupAllWith` is to `groupWith`

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

`permutations1` operates like `permutations`, but uses the knowledge that its input is non-empty to produce output where every element is non-empty.

    permutations1 = fmap fromList . permutations . toList

Since: base-4.20.0.0

append :: NonEmpty a -> NonEmpty a -> NonEmpty a Source #

A monomorphic version of `<>` for `NonEmpty`.

    >>> append (1 :| []) (2 :| [3])
    1 :| [2,3]

Since: base-4.16

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

Attach a list at the end of a `NonEmpty`.

    >>> appendList (1 :| [2,3]) []
    1 :| [2,3]

    >>> appendList (1 :| [2,3]) [4,5]
    1 :| [2,3,4,5]

Since: base-4.16

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

Attach a list at the beginning of a `NonEmpty`.

    >>> prependList [] (1 :| [2,3])
    1 :| [2,3]

    >>> prependList [negate 1, 0] (1 :| [2, 3])
    -1 :| [0,1,2,3]

Since: base-4.16

class IsList l where Source #

The `IsList` class and its methods are intended to be used in conjunction with the OverloadedLists extension.

Since: base-4.7.0.0

Minimal complete definition

fromList, toList

Associated Types

type Item l Source #

The `Item` type function returns the type of items of the structure `l`.

Methods

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

The `fromList` function constructs the structure `l` from the given list of `Item l`

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

The `fromListN` function takes the input list's length and potentially uses it to construct the structure `l` more efficiently compared to `fromList`. If the given number does not equal to the input list's length the behaviour of `fromListN` is not specified.

    fromListN (length xs) xs == fromList xs

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

The `toList` function extracts a list of `Item l` from the structure `l`. It should satisfy fromList . toList = id.

#### Instances

Instances details

IsList CharString |

Instance details

Defined in Data.ListLike.CharString

Associated Types

type Item CharString |
Instance details Defined in Data.ListLike.CharString type Item CharString = Char

Methods

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

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

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

IsList CharStringLazy |

Instance details

Defined in Data.ListLike.CharString

Associated Types

type Item CharStringLazy |
Instance details Defined in Data.ListLike.CharString type Item CharStringLazy = Char

Methods

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

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

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

IsList Chars |

Instance details

Defined in Data.ListLike.Chars

Associated Types

type Item Chars |
Instance details Defined in Data.ListLike.Chars type Item Chars = Char

Methods

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

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

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

IsList ByteArray | Since: base-4.17.0.0

Instance details

Defined in Data.Array.Byte

Associated Types

type Item ByteArray |
Instance details Defined in Data.Array.Byte type Item ByteArray = Word8

Methods

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

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

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

IsList Builder | For long or infinite lists use `fromList` because it uses `LazyByteString` otherwise use `fromListN` which uses `StrictByteString`.

Instance details

Defined in Data.ByteString.Builder.Internal

Associated Types

type Item Builder |
Instance details Defined in Data.ByteString.Builder.Internal type Item Builder = Word8

Methods

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

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

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

IsList ByteString | Since: bytestring-0.10.12.0

Instance details

Defined in Data.ByteString.Internal.Type

Associated Types

type Item ByteString |
Instance details Defined in Data.ByteString.Internal.Type type Item ByteString = Word8

Methods

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

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

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

IsList ByteString | Since: bytestring-0.10.12.0

Instance details

Defined in Data.ByteString.Lazy.Internal

Associated Types

type Item ByteString |
Instance details Defined in Data.ByteString.Lazy.Internal type Item ByteString = Word8

Methods

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

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

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

IsList ShortByteString | Since: bytestring-0.10.12.0

Instance details

Defined in Data.ByteString.Short.Internal

Associated Types

type Item ShortByteString |
Instance details Defined in Data.ByteString.Short.Internal type Item ShortByteString = Word8

Methods

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

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

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

IsList IntSet | Since: containers-0.5.6.2

Instance details

Defined in Data.IntSet.Internal

Associated Types

type Item IntSet |
Instance details Defined in Data.IntSet.Internal type Item IntSet = Key

Methods

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

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

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

IsList Version | Since: base-4.8.0.0

Instance details

Defined in GHC.Internal.IsList

Associated Types

type Item Version |
Instance details Defined in GHC.Internal.IsList type Item Version = Int

Methods

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

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

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

IsList CallStack | Be aware that 'fromList . toList = id' only for unfrozen `CallStack`s, since `toList` removes frozenness information. Since: base-4.9.0.0

Instance details

Defined in GHC.Internal.IsList

Associated Types

type Item CallStack |
Instance details Defined in GHC.Internal.IsList type Item CallStack = (String, SrcLoc)

Methods

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

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

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

IsList Text

Performs replacement on invalid scalar values:

    >>> :set -XOverloadedLists
    >>> ['\55555'] :: Text
    "\65533"

Since: text-1.2.0.0

Instance details

Defined in Data.Text

Associated Types

type Item Text |
Instance details Defined in Data.Text type Item Text = Char

Methods

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

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

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

IsList Builder |

Instance details

Defined in Data.ListLike.Text.Builder

Associated Types

type Item Builder |
Instance details Defined in Data.ListLike.Text.Builder type Item Builder = Char

Methods

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

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

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

IsList Text

Performs replacement on invalid scalar values:

    >>> :set -XOverloadedLists
    >>> ['\55555'] :: Data.Text.Lazy.Text
    "\65533"

Since: text-1.2.0.0

Instance details

Defined in Data.Text.Lazy

Associated Types

type Item Text |
Instance details Defined in Data.Text.Lazy type Item Text = Char

Methods

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

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

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

IsList ShortText |

Instance details

Defined in Data.Text.Short.Internal

Associated Types

type Item ShortText |
Instance details Defined in Data.Text.Short.Internal type Item ShortText = Char

Methods

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

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

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

IsList (List2 a) Source # | `fromList` is unsafe.

Instance details

Defined in Agda.Utils.List2

Associated Types

type Item (List2 a) |
Instance details Defined in Agda.Utils.List2 type Item (List2 a) = a

Methods

fromList :: [Item (List2 a)] -> List2 a Source #

fromListN :: Int -> [Item (List2 a)] -> List2 a Source #

toList :: List2 a -> [Item (List2 a)] Source #

IsList (KeyMap v) | Since: aeson-2.0.2.0

Instance details

Defined in Data.Aeson.KeyMap

Associated Types

type Item (KeyMap v) |
Instance details Defined in Data.Aeson.KeyMap type Item (KeyMap v) = (Key, v)

Methods

fromList :: [Item (KeyMap v)] -> KeyMap v Source #

fromListN :: Int -> [Item (KeyMap v)] -> KeyMap v Source #

toList :: KeyMap v -> [Item (KeyMap v)] Source #

IsList (IntMap a) | Since: containers-0.5.6.2

Instance details

Defined in Data.IntMap.Internal

Associated Types

type Item (IntMap a) |
Instance details Defined in Data.IntMap.Internal type Item (IntMap a) = (Key, a)

Methods

fromList :: [Item (IntMap a)] -> IntMap a Source #

fromListN :: Int -> [Item (IntMap a)] -> IntMap a Source #

toList :: IntMap a -> [Item (IntMap a)] Source #

IsList (Seq a) |

Instance details

Defined in Data.Sequence.Internal

Associated Types

type Item (Seq a) |
Instance details Defined in Data.Sequence.Internal type Item (Seq a) = a

Methods

fromList :: [Item (Seq a)] -> Seq a Source #

fromListN :: Int -> [Item (Seq a)] -> Seq a Source #

toList :: Seq a -> [Item (Seq a)] Source #

Ord a => IsList (Set a) | Since: containers-0.5.6.2

Instance details

Defined in Data.Set.Internal

Associated Types

type Item (Set a) |
Instance details Defined in Data.Set.Internal type Item (Set a) = a

Methods

fromList :: [Item (Set a)] -> Set a Source #

fromListN :: Int -> [Item (Set a)] -> Set a Source #

toList :: Set a -> [Item (Set a)] Source #

IsList (DNonEmpty a) |

Instance details

Defined in Data.DList.DNonEmpty.Internal

Associated Types

type Item (DNonEmpty a) |
Instance details Defined in Data.DList.DNonEmpty.Internal type Item (DNonEmpty a) = a

Methods

fromList :: [Item (DNonEmpty a)] -> DNonEmpty a Source #

fromListN :: Int -> [Item (DNonEmpty a)] -> DNonEmpty a Source #

toList :: DNonEmpty a -> [Item (DNonEmpty a)] Source #

IsList (DList a) |

Instance details

Defined in Data.DList.Internal

Associated Types

type Item (DList a) |
Instance details Defined in Data.DList.Internal type Item (DList a) = a

Methods

fromList :: [Item (DList a)] -> DList a Source #

fromListN :: Int -> [Item (DList a)] -> DList a Source #

toList :: DList a -> [Item (DList a)] Source #

Enum a => IsList (EnumSet a) |

Instance details

Defined in Data.EnumSet

Associated Types

type Item (EnumSet a) |
Instance details Defined in Data.EnumSet type Item (EnumSet a) = a

Methods

fromList :: [Item (EnumSet a)] -> EnumSet a Source #

fromListN :: Int -> [Item (EnumSet a)] -> EnumSet a Source #

toList :: EnumSet a -> [Item (EnumSet a)] Source #

IsList (FMList a) |

Instance details

Defined in Data.ListLike.FMList

Associated Types

type Item (FMList a) |
Instance details Defined in Data.ListLike.FMList type Item (FMList a) = a

Methods

fromList :: [Item (FMList a)] -> FMList a Source #

fromListN :: Int -> [Item (FMList a)] -> FMList a Source #

toList :: FMList a -> [Item (FMList 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 #

IsList (ZipList a) | Since: base-4.15.0.0

Instance details

Defined in GHC.Internal.IsList

Associated Types

type Item (ZipList a) |
Instance details Defined in GHC.Internal.IsList type Item (ZipList a) = a

Methods

fromList :: [Item (ZipList a)] -> ZipList a Source #

fromListN :: Int -> [Item (ZipList a)] -> ZipList a Source #

toList :: ZipList a -> [Item (ZipList a)] Source #

IsList (Array a) |

Instance details

Defined in Data.Primitive.Array

Associated Types

type Item (Array a) |
Instance details Defined in Data.Primitive.Array type Item (Array a) = a

Methods

fromList :: [Item (Array a)] -> Array a Source #

fromListN :: Int -> [Item (Array a)] -> Array a Source #

toList :: Array a -> [Item (Array a)] Source #

Prim a => IsList (PrimArray a) |

Instance details

Defined in Data.Primitive.PrimArray

Associated Types

type Item (PrimArray a) |
Instance details Defined in Data.Primitive.PrimArray type Item (PrimArray a) = a

Methods

fromList :: [Item (PrimArray a)] -> PrimArray a Source #

fromListN :: Int -> [Item (PrimArray a)] -> PrimArray a Source #

toList :: PrimArray a -> [Item (PrimArray a)] Source #

IsList (SmallArray a) |

Instance details

Defined in Data.Primitive.SmallArray

Associated Types

type Item (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray type Item (SmallArray a) = a

Methods

fromList :: [Item (SmallArray a)] -> SmallArray a Source #

fromListN :: Int -> [Item (SmallArray a)] -> SmallArray a Source #

toList :: SmallArray a -> [Item (SmallArray a)] Source #

(Eq a, Hashable a) => IsList (HashSet a) |

Instance details

Defined in Data.HashSet.Internal

Associated Types

type Item (HashSet a) |
Instance details Defined in Data.HashSet.Internal type Item (HashSet a) = a

Methods

fromList :: [Item (HashSet a)] -> HashSet a Source #

fromListN :: Int -> [Item (HashSet a)] -> HashSet a Source #

toList :: HashSet a -> [Item (HashSet a)] Source #

IsList (UTF8 ByteString) |

Instance details

Defined in Data.ListLike.UTF8

Associated Types

type Item (UTF8 ByteString) |
Instance details Defined in Data.ListLike.UTF8 type Item (UTF8 ByteString) = Char

Methods

fromList :: [Item (UTF8 ByteString)] -> UTF8 ByteString Source #

fromListN :: Int -> [Item (UTF8 ByteString)] -> UTF8 ByteString Source #

toList :: UTF8 ByteString -> [Item (UTF8 ByteString)] Source #

IsList (UTF8 ByteString) |

Instance details

Defined in Data.ListLike.UTF8

Associated Types

type Item (UTF8 ByteString) |
Instance details Defined in Data.ListLike.UTF8 type Item (UTF8 ByteString) = Char

Methods

fromList :: [Item (UTF8 ByteString)] -> UTF8 ByteString Source #

fromListN :: Int -> [Item (UTF8 ByteString)] -> UTF8 ByteString Source #

toList :: UTF8 ByteString -> [Item (UTF8 ByteString)] Source #

IsList (Vector a) |

Instance details

Defined in Data.Vector

Associated Types

type Item (Vector a) |
Instance details Defined in Data.Vector type Item (Vector a) = a

Methods

fromList :: [Item (Vector a)] -> Vector a Source #

fromListN :: Int -> [Item (Vector a)] -> Vector a Source #

toList :: Vector a -> [Item (Vector a)] Source #

Prim a => IsList (Vector a) |

Instance details

Defined in Data.Vector.Primitive

Associated Types

type Item (Vector a) |
Instance details Defined in Data.Vector.Primitive type Item (Vector a) = a

Methods

fromList :: [Item (Vector a)] -> Vector a Source #

fromListN :: Int -> [Item (Vector a)] -> Vector a Source #

toList :: Vector a -> [Item (Vector a)] Source #

Storable a => IsList (Vector a) |

Instance details

Defined in Data.Vector.Storable

Associated Types

type Item (Vector a) |
Instance details Defined in Data.Vector.Storable type Item (Vector a) = a

Methods

fromList :: [Item (Vector a)] -> Vector a Source #

fromListN :: Int -> [Item (Vector a)] -> Vector a Source #

toList :: Vector a -> [Item (Vector a)] Source #

IsList (Vector a) |

Instance details

Defined in Data.Vector.Strict

Associated Types

type Item (Vector a) |
Instance details Defined in Data.Vector.Strict type Item (Vector a) = a

Methods

fromList :: [Item (Vector a)] -> Vector a Source #

fromListN :: Int -> [Item (Vector a)] -> Vector a Source #

toList :: Vector a -> [Item (Vector a)] Source #

Unbox e => IsList (Vector e) |

Instance details

Defined in Data.Vector.Unboxed

Associated Types

type Item (Vector e) |
Instance details Defined in Data.Vector.Unboxed type Item (Vector e) = e

Methods

fromList :: [Item (Vector e)] -> Vector e Source #

fromListN :: Int -> [Item (Vector e)] -> Vector e Source #

toList :: Vector e -> [Item (Vector e)] 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 #

Ord k => IsList (Map k v) | Since: containers-0.5.6.2

Instance details

Defined in Data.Map.Internal

Associated Types

type Item (Map k v) |
Instance details Defined in Data.Map.Internal type Item (Map k v) = (k, v)

Methods

fromList :: [Item (Map k v)] -> Map k v Source #

fromListN :: Int -> [Item (Map k v)] -> Map k v Source #

toList :: Map k v -> [Item (Map k v)] Source #

Enum k => IsList (EnumMap k a) |

Instance details

Defined in Data.EnumMap.Base

Associated Types

type Item (EnumMap k a) |
Instance details Defined in Data.EnumMap.Base type Item (EnumMap k a) = (k, a)

Methods

fromList :: [Item (EnumMap k a)] -> EnumMap k a Source #

fromListN :: Int -> [Item (EnumMap k a)] -> EnumMap k a Source #

toList :: EnumMap k a -> [Item (EnumMap k a)] Source #

(Integral i, Ix i) => IsList (Array i e) |

Instance details

Defined in Data.ListLike.Instances

Associated Types

type Item (Array i e) |
Instance details Defined in Data.ListLike.Instances type Item (Array i e) = e

Methods

fromList :: [Item (Array i e)] -> Array i e Source #

fromListN :: Int -> [Item (Array i e)] -> Array i e Source #

toList :: Array i e -> [Item (Array i e)] Source #

(Eq k, Hashable k) => IsList (HashMap k v) |

Instance details

Defined in Data.HashMap.Internal

Associated Types

type Item (HashMap k v) |
Instance details Defined in Data.HashMap.Internal type Item (HashMap k v) = (k, v)

Methods

fromList :: [Item (HashMap k v)] -> HashMap k v Source #

fromListN :: Int -> [Item (HashMap k v)] -> HashMap k v Source #

toList :: HashMap k v -> [Item (HashMap k v)] Source #

type family Item l Source #

The `Item` type function returns the type of items of the structure `l`.

#### Instances

Instances details

type Item CharString |
Instance details Defined in Data.ListLike.CharString type Item CharString = Char
type Item CharStringLazy |
Instance details Defined in Data.ListLike.CharString type Item CharStringLazy = Char
type Item Chars |
Instance details Defined in Data.ListLike.Chars type Item Chars = Char
type Item ByteArray |
Instance details Defined in Data.Array.Byte type Item ByteArray = Word8
type Item Builder |
Instance details Defined in Data.ByteString.Builder.Internal type Item Builder = Word8
type Item ByteString |
Instance details Defined in Data.ByteString.Internal.Type type Item ByteString = Word8
type Item ByteString |
Instance details Defined in Data.ByteString.Lazy.Internal type Item ByteString = Word8
type Item ShortByteString |
Instance details Defined in Data.ByteString.Short.Internal type Item ShortByteString = Word8
type Item IntSet |
Instance details Defined in Data.IntSet.Internal type Item IntSet = Key
type Item Version |
Instance details Defined in GHC.Internal.IsList type Item Version = Int
type Item CallStack |
Instance details Defined in GHC.Internal.IsList type Item CallStack = (String, SrcLoc)
type Item Text |
Instance details Defined in Data.Text type Item Text = Char
type Item Builder |
Instance details Defined in Data.ListLike.Text.Builder type Item Builder = Char
type Item Text |
Instance details Defined in Data.Text.Lazy type Item Text = Char
type Item ShortText |
Instance details Defined in Data.Text.Short.Internal type Item ShortText = Char
type Item (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 type Item (List2 a) = a
type Item (KeyMap v) |
Instance details Defined in Data.Aeson.KeyMap type Item (KeyMap v) = (Key, v)
type Item (IntMap a) |
Instance details Defined in Data.IntMap.Internal type Item (IntMap a) = (Key, a)
type Item (Seq a) |
Instance details Defined in Data.Sequence.Internal type Item (Seq a) = a
type Item (Set a) |
Instance details Defined in Data.Set.Internal type Item (Set a) = a
type Item (DNonEmpty a) |
Instance details Defined in Data.DList.DNonEmpty.Internal type Item (DNonEmpty a) = a
type Item (DList a) |
Instance details Defined in Data.DList.Internal type Item (DList a) = a
type Item (EnumSet a) |
Instance details Defined in Data.EnumSet type Item (EnumSet a) = a
type Item (FMList a) |
Instance details Defined in Data.ListLike.FMList type Item (FMList a) = a
type Item (NonEmpty a) |
Instance details Defined in GHC.Internal.IsList type Item (NonEmpty a) = a
type Item (ZipList a) |
Instance details Defined in GHC.Internal.IsList type Item (ZipList a) = a
type Item (Array a) |
Instance details Defined in Data.Primitive.Array type Item (Array a) = a
type Item (PrimArray a) |
Instance details Defined in Data.Primitive.PrimArray type Item (PrimArray a) = a
type Item (SmallArray a) |
Instance details Defined in Data.Primitive.SmallArray type Item (SmallArray a) = a
type Item (HashSet a) |
Instance details Defined in Data.HashSet.Internal type Item (HashSet a) = a
type Item (UTF8 ByteString) |
Instance details Defined in Data.ListLike.UTF8 type Item (UTF8 ByteString) = Char
type Item (UTF8 ByteString) |
Instance details Defined in Data.ListLike.UTF8 type Item (UTF8 ByteString) = Char
type Item (Vector a) |
Instance details Defined in Data.Vector type Item (Vector a) = a
type Item (Vector a) |
Instance details Defined in Data.Vector.Primitive type Item (Vector a) = a
type Item (Vector a) |
Instance details Defined in Data.Vector.Storable type Item (Vector a) = a
type Item (Vector a) |
Instance details Defined in Data.Vector.Strict type Item (Vector a) = a
type Item (Vector e) |
Instance details Defined in Data.Vector.Unboxed type Item (Vector e) = e
type Item [a] |
Instance details Defined in GHC.Internal.IsList type Item [a] = a
type Item (Map k v) |
Instance details Defined in Data.Map.Internal type Item (Map k v) = (k, v)
type Item (EnumMap k a) |
Instance details Defined in Data.EnumMap.Base type Item (EnumMap k a) = (k, a)
type Item (Array i e) |
Instance details Defined in Data.ListLike.Instances type Item (Array i e) = e
type Item (HashMap k v) |
Instance details Defined in Data.HashMap.Internal type Item (HashMap k v) = (k, v)

unzip :: Functor f => f (a, b) -> (f a, f b) Source #

Generalization of `Data.List.``unzip`.

#### Examples

Expand

    >>> unzip (Just ("Hello", "World"))
    (Just "Hello",Just "World")

    >>> unzip [("I", "love"), ("really", "haskell")]
    (["I","really"],["love","haskell"])

Since: base-4.19.0.0