foldable-ix-0.2.1.0: Functions to find out the indices of the elements in the Foldable structures

Data.Foldable.Ix

Description

Synopsis

# Documentation

data TwoInThreeBang a b Source #

Constructors

 B23 a !Int !Int

#### Instances

Instances details
 Eq a => Eq (TwoInThreeBang a b) Source # Instance detailsDefined in Data.Foldable.Ix Methods(==) :: TwoInThreeBang a b -> TwoInThreeBang a b -> Bool #(/=) :: TwoInThreeBang a b -> TwoInThreeBang a b -> Bool #

Constructors

 B23L a ![Int] !Int

data ThreeInFourBang a b Source #

Constructors

 B34 b b !b ![a]

#### Instances

Instances details
 (Eq b, Eq a) => Eq (ThreeInFourBang a b) Source # Instance detailsDefined in Data.Foldable.Ix Methods(==) :: ThreeInFourBang a b -> ThreeInFourBang a b -> Bool #(/=) :: ThreeInFourBang a b -> ThreeInFourBang a b -> Bool #

findIdx1 :: (Eq a, Foldable t, Integral b) => a -> t a -> Maybe b Source #

Function to find out the 'index' (as the reperesentative of the Integral class) of the first element in the Foldable structure (from the left with indices starting from 0), which equals to the first argument. Returns Nothing if there are no such elements.

findIdx1' :: (Eq a, Foldable t) => a -> t a -> Maybe Int Source #

A variant of the findIdx1 where the resulting Maybe b is Maybe Int. Possibly can be more optimized.

findIdxs :: (Eq a, Foldable t) => a -> t a -> [Int] Source #

Function to find out the 'indices' of the elements in the Foldable structure (from the left with indices starting from 0) that equal to the first argument. Returns empty list if there are no such elements. Uses two passes through the structure.

findIdxsL1 :: (Eq a, Foldable t) => a -> t a -> [Int] Source #

Function to find out the 'indices' of the elements in the Foldable structure (from the left with indices starting from 0) that equal to the first argument. Returns empty list if there are no such elements. Uses just one pass through the structure and additional reverse operation on the resulting list with foldl'.

sliceToList :: (Eq a, Foldable t) => Int -> Int -> t a -> [a] Source #

Inspired by the Data.Vector.slice function from the vector package. Takes a 'slice' for the Foldable structure converting it to the list. The first argument is the 'index' of the element in the structure starting from 0 from the left. The second one is the length of the slice.

s2L :: Eq a => Int -> Int -> [a] -> [a] Source #