-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | NonEmpty for Alternative types -- -- This package extends NonEmpty from semigroups for -- arbitrary Alternative types. @package nonempty-alternative @version 0.4.0 -- | This package extends NonEmpty from semigroups to -- arbitrary Alternative types. The method is the same as for -- lists, by separating an element from the rest. -- -- There are two natural ways to merge an element x to the rest -- of the structure xs. The first gives rise to -- NonEmptyL: -- --
-- flattenL :: NonEmptyL f a -> f a -- flattenL (x :<: xs) = pure x <|> xs ---- -- The second gives rise to NonEmptyR: -- --
-- flattenR :: NonEmptyR f a -> f a -- flattenR (xs :>: x) = xs <|> pure x ---- -- The instances are made so that flattenL gives a type class -- morphism between NonEmptyL List and List, and -- flattenR gives the same for NonEmptyR RList and -- RList from the package rlist. module Data.NonEmpty -- | The type NonEmptyL is well suited for cons -- structures. data NonEmptyL f a (:<:) :: a -> f a -> NonEmptyL f a -- | Extracts the structure's singular element. This function is total and -- equivalent to extract from Comonad. headL :: NonEmptyL f a -> a -- | Extracts the structure's remaining data. This function is total. tailL :: NonEmptyL f a -> f a -- | Flattens the structure to its base type from the left. flattenL :: Alternative f => NonEmptyL f a -> f a -- | This is equivalent to join for Monad. joinL :: (Alternative f, Monad f) => NonEmptyL f (NonEmptyL f a) -> NonEmptyL f a -- | Budge the head into the remaining structure from the left, adding an -- empty head. budgeL :: (Alternative f, Alternative g) => NonEmptyL f (g a) -> NonEmptyL f (g a) -- | The type NonEmptyR is well suited for snoc -- structures. data NonEmptyR f a (:>:) :: f a -> a -> NonEmptyR f a -- | Extracts the structure's singular element. This function is total and -- equivalent to extract from Comonad. lastR :: NonEmptyR f a -> a -- | Extracts the structure's remaining data. This function is total. initR :: NonEmptyR f a -> f a -- | Flattens the structure to its base type from the right. flattenR :: Alternative f => NonEmptyR f a -> f a -- | This is equivalent to join for Monad. joinR :: (Alternative f, Monad f) => NonEmptyR f (NonEmptyR f a) -> NonEmptyR f a -- | Budge the head into the remaining structure from the right, adding an -- empty head. budgeR :: (Alternative f, Alternative g) => NonEmptyR f (g a) -> NonEmptyR f (g a) instance GHC.Generics.Constructor Data.NonEmpty.C1_0NonEmptyR instance GHC.Generics.Datatype Data.NonEmpty.D1NonEmptyR instance GHC.Generics.Constructor Data.NonEmpty.C1_0NonEmptyL instance GHC.Generics.Datatype Data.NonEmpty.D1NonEmptyL instance GHC.Generics.Generic1 (Data.NonEmpty.NonEmptyR f) instance GHC.Generics.Generic (Data.NonEmpty.NonEmptyR f a) instance (Data.Data.Data a, Data.Data.Data (f a), Data.Typeable.Internal.Typeable f) => Data.Data.Data (Data.NonEmpty.NonEmptyR f a) instance (GHC.Read.Read a, GHC.Read.Read (f a)) => GHC.Read.Read (Data.NonEmpty.NonEmptyR f a) instance (GHC.Classes.Ord a, GHC.Classes.Ord (f a)) => GHC.Classes.Ord (Data.NonEmpty.NonEmptyR f a) instance (GHC.Classes.Eq a, GHC.Classes.Eq (f a)) => GHC.Classes.Eq (Data.NonEmpty.NonEmptyR f a) instance (GHC.Show.Show a, GHC.Show.Show (f a)) => GHC.Show.Show (Data.NonEmpty.NonEmptyR f a) instance GHC.Generics.Generic1 (Data.NonEmpty.NonEmptyL f) instance GHC.Generics.Generic (Data.NonEmpty.NonEmptyL f a) instance (Data.Data.Data a, Data.Data.Data (f a), Data.Typeable.Internal.Typeable f) => Data.Data.Data (Data.NonEmpty.NonEmptyL f a) instance (GHC.Read.Read a, GHC.Read.Read (f a)) => GHC.Read.Read (Data.NonEmpty.NonEmptyL f a) instance (GHC.Classes.Ord a, GHC.Classes.Ord (f a)) => GHC.Classes.Ord (Data.NonEmpty.NonEmptyL f a) instance (GHC.Classes.Eq a, GHC.Classes.Eq (f a)) => GHC.Classes.Eq (Data.NonEmpty.NonEmptyL f a) instance (GHC.Show.Show a, GHC.Show.Show (f a)) => GHC.Show.Show (Data.NonEmpty.NonEmptyL f a) instance GHC.Base.Functor f => GHC.Base.Functor (Data.NonEmpty.NonEmptyL f) instance GHC.Base.Functor f => GHC.Base.Functor (Data.NonEmpty.NonEmptyR f) instance GHC.Base.Alternative f => GHC.Base.Applicative (Data.NonEmpty.NonEmptyL f) instance GHC.Base.Alternative f => GHC.Base.Applicative (Data.NonEmpty.NonEmptyR f) instance (GHC.Base.Alternative f, GHC.Base.Monad f) => GHC.Base.Monad (Data.NonEmpty.NonEmptyL f) instance GHC.Base.Alternative f => Control.Comonad.Comonad (Data.NonEmpty.NonEmptyL f) instance GHC.Base.Alternative f => Control.Comonad.Comonad (Data.NonEmpty.NonEmptyR f) instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Data.NonEmpty.NonEmptyL f) instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Data.NonEmpty.NonEmptyR f) instance (GHC.Base.Functor f, Data.Traversable.Traversable f) => Data.Traversable.Traversable (Data.NonEmpty.NonEmptyL f) instance (GHC.Base.Functor f, Data.Traversable.Traversable f) => Data.Traversable.Traversable (Data.NonEmpty.NonEmptyR f) instance GHC.Base.Alternative f => Data.Semigroup.Semigroup (Data.NonEmpty.NonEmptyL f a) instance GHC.Base.Alternative f => Data.Semigroup.Semigroup (Data.NonEmpty.NonEmptyR f a)