First and Last generalized to return up to n values

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Mark Andrus Roberts

This library provides data types First' n and Last' n generalizing First and Last from Data.Monoid to return up to n values.

getFirst' (foldMap pure [1,2,3,4] :: First' 2 Int)
getLast' (foldMap pure [1,2,3,4] :: Last' 2 Int)

It also provides API-compatible type synonyms First and Last as well as functions getFirst and getLast, allowing you to use it as a drop-in replacement.

Depends on 1 package:
Used by 1 package:
comments powered byDisqus