-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Description
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 indexMetadata
Metadata
Assignees
Labels
No labels