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

[ bsd3, data, library ] [ Propose Tags ]
Dependencies base (==4.8.*) [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 Fri Oct 16 00:43:48 UTC 2015
Distributions NixOS:
Downloads 478 total (6 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-10-16 [all 1 reports]
Hackage Matrix CI

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

For package maintainers and hackage trustees