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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Agda.Utils.List2

Description

Lists of length at least 2.

Import as: `import Agda.Utils.List2 (List2(List2)) import qualified Agda.Utils.List2 as List2`

Synopsis

- data List2 a = List2 a a [a]
- head :: List2 a -> a
- tail :: List2 a -> List1 a
- init :: List2 a -> List1 a
- fromListMaybe :: [a] -> Maybe (List2 a)
- fromList1Maybe :: List1 a -> Maybe (List2 a)
- toList1 :: List2 a -> List1 a
- fromList1 :: List1 a -> List2 a
- break :: (a -> Bool) -> List2 a -> ([a], [a])
- toList :: IsList l => l -> [Item l]

# Documentation

data List2 a Source #

Lists of length ≥2.

Constructors

List2 a a [a] |

#### Instances

Instances details

Foldable List2 Source # |

Instance details

Defined in Agda.Utils.List2

Methods

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

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

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

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

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

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

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

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

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

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

null :: List2 a -> Bool Source #

length :: List2 a -> Int Source #

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

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

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

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

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

Traversable List2 Source # |
Instance details Defined in Agda.Utils.List2 Methods traverse :: Applicative f => (a -> f b) -> List2 a -> f (List2 b) Source # sequenceA :: Applicative f => List2 (f a) -> f (List2 a) Source # mapM :: Monad m => (a -> m b) -> List2 a -> m (List2 b) Source # sequence :: Monad m => List2 (m a) -> m (List2 a) Source #
Functor List2 Source # |
Instance details Defined in Agda.Utils.List2 Methods fmap :: (a -> b) -> List2 a -> List2 b Source # (<$) :: a -> List2 b -> List2 a Source #
ExprLike a => ExprLike (List2 a) Source # |
Instance details Defined in Agda.Syntax.Concrete.Generic Methods mapExpr :: (Expr -> Expr) -> List2 a -> List2 a Source # foldExpr :: Monoid m => (Expr -> m) -> List2 a -> m Source # traverseExpr :: Monad m => (Expr -> m Expr) -> List2 a -> m (List2 a) Source #
CPatternLike p => CPatternLike (List2 p) Source # |
Instance details Defined in Agda.Syntax.Concrete.Pattern Methods foldrCPattern :: Monoid m => (Pattern -> m -> m) -> List2 p -> m Source # traverseCPatternA :: (Applicative m, Functor m) => (Pattern -> m Pattern -> m Pattern) -> List2 p -> m (List2 p) Source # traverseCPatternM :: Monad m => (Pattern -> m Pattern) -> (Pattern -> m Pattern) -> List2 p -> m (List2 p) Source #
HasRange a => HasRange (List2 a) Source # |
Instance details Defined in Agda.Syntax.Position Methods getRange :: List2 a -> Range Source #
KillRange a => KillRange (List2 a) Source # |
Instance details Defined in Agda.Syntax.Position Methods killRange :: KillRangeT (List2 a) Source #
EmbPrj a => EmbPrj (List2 a) Source # |
Instance details Defined in Agda.TypeChecking.Serialise.Instances.Common Methods icode :: List2 a -> S Int32 Source # icod_ :: List2 a -> S Int32 Source # value :: Int32 -> R (List2 a) Source #
Data a => Data (List2 a) Source # |

Instance details

Defined in Agda.Utils.List2

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> List2 a -> c (List2 a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (List2 a) Source #

toConstr :: List2 a -> Constr Source #

dataTypeOf :: List2 a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (List2 a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (List2 a)) Source #

gmapT :: (forall b. Data b => b -> b) -> List2 a -> List2 a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> List2 a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> List2 a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> List2 a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> List2 a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> List2 a -> m (List2 a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> List2 a -> m (List2 a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> List2 a -> m (List2 a) Source #

IsList (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 Associated Types type Item (List2 a) Source # Methods fromList :: [Item (List2 a)] -> List2 a Source # fromListN :: Int -> [Item (List2 a)] -> List2 a Source # toList :: List2 a -> [Item (List2 a)] Source #
Show a => Show (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 Methods showsPrec :: Int -> List2 a -> ShowS Source # show :: List2 a -> String Source # showList :: [List2 a] -> ShowS Source #
NFData a => NFData (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 Methods rnf :: List2 a -> () Source #
Eq a => Eq (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 Methods (==) :: List2 a -> List2 a -> Bool Source # (/=) :: List2 a -> List2 a -> Bool Source #
Ord a => Ord (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 Methods compare :: List2 a -> List2 a -> Ordering Source # (<) :: List2 a -> List2 a -> Bool Source # (<=) :: List2 a -> List2 a -> Bool Source # (>) :: List2 a -> List2 a -> Bool Source # (>=) :: List2 a -> List2 a -> Bool Source # max :: List2 a -> List2 a -> List2 a Source # min :: List2 a -> List2 a -> List2 a Source #
type Item (List2 a) Source # |
Instance details Defined in Agda.Utils.List2 type Item (List2 a) = a

head :: List2 a -> a Source #

Safe. O(1).

tail :: List2 a -> List1 a Source #

Safe. O(1).

init :: List2 a -> List1 a Source #

Safe. O(n).

fromListMaybe :: [a] -> Maybe (List2 a) Source #

Safe. O(1).

fromList1Maybe :: List1 a -> Maybe (List2 a) Source #

Safe. O(1).

toList1 :: List2 a -> List1 a Source #

Safe. O(1).

fromList1 :: List1 a -> List2 a Source #

Unsafe!

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

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.