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

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

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)
[1,2]
>>> getLast' (foldMap pure [1,2,3,4] :: Last' 2 Int)
[3,4]

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.

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1
Dependencies base (>=4.8 && <4.9) [details]
License BSD-3-Clause
Copyright Copyright (C) 2015 Mark Andrus Roberts
Author Mark Andrus Roberts
Maintainer markandrusroberts@gmail.com
Category Data
Home page https://github.com/markandrus/first-and-last
Source repo head: git clone https://github.com/markandrus/first-and-last
Uploaded by andrus at 2015-10-16T00:43:48Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1571 total (7 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]