first-and-last: First and Last generalized to return up to n values

[ bsd3, data, library ] [ Propose Tags ]

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.


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],
Dependencies base (>=4.8 && <4.9) [details]
License BSD-3-Clause
Copyright Copyright (C) 2015 Mark Andrus Roberts
Author Mark Andrus Roberts
Category Data
Home page
Source repo head: git clone
Uploaded by andrus at 2015-10-16T00:43:48Z
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1537 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-10-16 [all 1 reports]