Skip to content

Add indexWith?  #22

@safareli

Description

@safareli

Not sure if it's best place for it but I find using something like his when working with NonEmpty:

indexWith ::  a f. (f a  Int  Maybe a)  NonEmpty f a  Int  Maybe a
indexWith _    (NonEmpty x _ ) 0   = pure x
indexWith with (NonEmpty _ xs) idx = with xs (idx - 1)

indexNEA ::  a. NonEmpty Array a  Int  Maybe a
indexNEA = indexWith index

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions