Copyright | Gautier DI FOLCO |
---|---|
License | BSD2 |
Maintainer | Gautier DI FOLCO <gautier.difolco@gmail.com> |
Stability | Unstable |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Create NonEmpty version of any container.
Synopsis
- data NonEmpty a
- $sel:getNonEmpty:NonEmpty :: NonEmpty a -> a
- trustedNonEmpty :: a -> NonEmpty a
- class NonEmptySingleton a where
- type NonEmptySingletonElement a :: Type
- nonEmptySingleton :: Proxy a -> NonEmptySingletonElement a -> a
- singleton :: NonEmptySingleton a => Proxy a -> NonEmptySingletonElement a -> NonEmpty a
- newtype MkNonEmptySingletonApplicative a = MkNonEmptySingletonApplicative a
- class NonEmptyFromContainer a where
- isNonEmpty :: a -> Bool
- nonEmpty :: NonEmptyFromContainer a => a -> Maybe (NonEmpty a)
- newtype MkNonEmptyFromContainerFoldable a = MkNonEmptyFromContainerFoldable a
- (<|) :: Semigroup a => NonEmpty a -> a -> NonEmpty a
- (|>) :: Semigroup a => a -> NonEmpty a -> NonEmpty a
- overNonEmpty :: (a -> b) -> NonEmpty a -> NonEmpty b
- overNonEmpty2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
- overNonEmpty3 :: (a -> b -> c -> d) -> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d
- overNonEmpty4 :: (a -> b -> c -> d -> e) -> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d -> NonEmpty e
- overNonEmpty5 :: (a -> b -> c -> d -> e -> f) -> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d -> NonEmpty e -> NonEmpty f
- fmapNonEmpty :: Functor f => (a -> b) -> NonEmpty (f a) -> NonEmpty (f b)
- withNonEmpty :: (a -> Maybe b) -> NonEmpty a -> b
Base type
NonEmpty proofed value.
Instances
Eq a => Eq (NonEmpty a) Source # | |
Ord a => Ord (NonEmpty a) Source # | |
Show a => Show (NonEmpty a) Source # | |
Semigroup a => Semigroup (NonEmpty a) Source # | |
$sel:getNonEmpty:NonEmpty :: NonEmpty a -> a Source #
Extract the NonEmpty proven value
trustedNonEmpty :: a -> NonEmpty a Source #
Trusted value
Singleton constructor
class NonEmptySingleton a where Source #
Singleton constructible value
type NonEmptySingletonElement a :: Type Source #
nonEmptySingleton :: Proxy a -> NonEmptySingletonElement a -> a Source #
Instances
Applicative f => NonEmptySingleton (f a) Source # | |
Defined in Data.NonEmpty type NonEmptySingletonElement (f a) Source # nonEmptySingleton :: Proxy (f a) -> NonEmptySingletonElement (f a) -> f a Source # |
singleton :: NonEmptySingleton a => Proxy a -> NonEmptySingletonElement a -> NonEmpty a Source #
Build a NonEmpty
value from a singleton value
newtype MkNonEmptySingletonApplicative a Source #
Build NonEmptySingleton
for Applicative
defined types
to be used with DerivingVia
:
deriving instance NonEmptySingleton [a] via (MkNonEmptySingletonApplicative [a])
From container
class NonEmptyFromContainer a where Source #
Used to attempt conversion from possibly empty to NonEmpty
.
isNonEmpty :: a -> Bool Source #
Instances
Foldable f => NonEmptyFromContainer (f a) Source # | |
Defined in Data.NonEmpty isNonEmpty :: f a -> Bool Source # |
newtype MkNonEmptyFromContainerFoldable a Source #
Build MkNonEmptyFromContainerFoldable
for Foldable
defined types
to be used with DerivingVia
:
deriving instance NonEmptyFromContainer [a] via (MkNonEmptyFromContainerFoldable [a])
Operations
overNonEmpty :: (a -> b) -> NonEmpty a -> NonEmpty b Source #
Wrap and unwrap NonEmpty
(unsafe, be sure f
is size-conservative)
overNonEmpty2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c Source #
Wrap and unwrap NonEmpty
(unsafe, be sure f
is size-conservative)
overNonEmpty3 :: (a -> b -> c -> d) -> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d Source #
Wrap and unwrap NonEmpty
(unsafe, be sure f
is size-conservative)
overNonEmpty4 :: (a -> b -> c -> d -> e) -> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d -> NonEmpty e Source #
Wrap and unwrap NonEmpty
(unsafe, be sure f
is size-conservative)
overNonEmpty5 :: (a -> b -> c -> d -> e -> f) -> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d -> NonEmpty e -> NonEmpty f Source #
Wrap and unwrap NonEmpty
(unsafe, be sure f
is size-conservative)