foldable-ix-0.1.0.0: Functions to find out the indices of the elements in the Foldable structures
Copyright(c) OleksandrZhabenko 2020
LicenseMIT
Maintainerolexandr543@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010
ExtensionsCpp

Data.Foldable.Ix

Description

 
Synopsis

Documentation

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.

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'.