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 |
is a generalization of the First'
nFirst
exported by Data.Monoid
:
whereas Data.Monoid.First
returns up to one value,
returns
up to First'
nn
values.
Data.Monoid.First a ≡First'
1 a ≡First
a
This library also provides an API-compatible type synonym First
and
function getFirst
allowing you to use it as a drop-in replacement.
First
getFirst :: First a -> Maybe a Source
Get the first value of type a
, if any.
>>>
getFirst (foldMap pure [])
Nothing
>>>
getFirst (foldMap pure [1,2,3,4])
Just 1
First'
A generalized version of Data.Monoid.First
Functor (First' n) Source | |
KnownNat n => Applicative (First' n) Source | |
Foldable (First' n) Source | |
Traversable (First' n) Source | |
Generic1 (First' n) Source | |
KnownNat n => Alternative (First' n) Source | |
Eq a => Eq (First' n a) Source | |
(Data a, Typeable Nat n) => Data (First' n a) Source | |
Ord a => Ord (First' n a) Source | |
Read a => Read (First' n a) Source | |
Show a => Show (First' n a) Source | |
KnownNat n => IsString (First' n Char) Source | |
Generic (First' n a) Source | |
KnownNat n => Monoid (First' n a) Source | |
type Rep1 (First' n) Source | |
type Rep (First' n a) Source |