Copyright | (c) OleksandrZhabenko 2020-2023 |
---|---|
License | MIT |
Maintainer | oleksandr.zhabenko@yahoo.com |
Stability | Experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
Synopsis
- data OneInTwoBang a b = B12 !a !b
- data ThreeInFourBang a b = B34 b !b ![a]
- findIdx1 :: (Eq a, Foldable t, Integral b) => a -> t a -> Maybe b
- findIdx1' :: (Eq a, Foldable t) => a -> t a -> Maybe Int
- findIdxs :: (Eq a, Foldable t) => a -> t a -> [Int]
- findIdxsL1 :: (Eq a, Foldable t) => a -> t a -> [Int]
- sliceToList :: (Eq a, Foldable t) => Int -> Int -> t a -> [a]
- s2L :: Eq a => Int -> Int -> [a] -> [a]
Documentation
data OneInTwoBang a b Source #
B12 !a !b |
Instances
(Eq a, Eq b) => Eq (OneInTwoBang a b) Source # | |
Defined in Data.Foldable.Ix (==) :: OneInTwoBang a b -> OneInTwoBang a b -> Bool # (/=) :: OneInTwoBang a b -> OneInTwoBang a b -> Bool # |
data ThreeInFourBang a b Source #
B34 b !b ![a] |
Instances
(Eq b, Eq a) => Eq (ThreeInFourBang a b) Source # | |
Defined in Data.Foldable.Ix (==) :: ThreeInFourBang a b -> ThreeInFourBang a b -> Bool # (/=) :: ThreeInFourBang a b -> ThreeInFourBang a b -> Bool # |
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.