| Copyright | (C) 2015 Mark Andrus Roberts |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Mark Andrus Roberts <markandrusroberts@gmail.com> |
| Stability | provisional |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Monoid.Last
Description
is a generalization of the Last' nLast exported by Data.Monoid:
whereas Data.Monoid.Last returns up to one value, returns
up to Last' nn values.
Data.Monoid.Last a ≡
Last' 1 a ≡
Last a
This library also provides an API-compatible type synonym Last and
function getLast allowing you to use it as a drop-in replacement.
Last
getLast :: Last a -> Maybe a Source
Get the last value of type a, if any.
>>>getLast (foldMap pure [])Nothing
>>>getLast (foldMap pure [1,2,3,4])Just 4
Last'
A generalized version of Data.Monoid.Last
Instances
| Functor (Last' n) Source | |
| KnownNat n => Applicative (Last' n) Source | |
| Foldable (Last' n) Source | |
| Traversable (Last' n) Source | |
| Generic1 (Last' n) Source | |
| KnownNat n => Alternative (Last' n) Source | |
| Eq a => Eq (Last' n a) Source | |
| (Data a, Typeable Nat n) => Data (Last' n a) Source | |
| Ord a => Ord (Last' n a) Source | |
| Read a => Read (Last' n a) Source | |
| Show a => Show (Last' n a) Source | |
| KnownNat n => IsString (Last' n Char) Source | |
| Generic (Last' n a) Source | |
| KnownNat n => Monoid (Last' n a) Source | |
| type Rep1 (Last' n) Source | |
| type Rep (Last' n a) Source |