Empty-0.1.0.1: A type class for empty containers

Control.Empty

Synopsis

# Documentation

class HasEmpty f where Source #

The class of type of * -> * which may be empty. There is only one law for HasEmpty and its enforced by the type. The law is that there exists a value in type f for which a is fully generic. This alone is often enough to uniquely determine the value for a given, data type.

Additional laws for HasEmpty work backwards, empty has a relationships with other classes. So if f is a member of one of these classes, the following should hold.

Functor identity
g <\$> empty = empty
Applicative annihilation left
x <*> empty = empty
Applicative annihilation right
empty <*> x = empty
empty >>= f = empty
Alternative empty
empty = Alternative.empty
empty = mzero
Foldable identity
foldr f x empty = empty

Methods

empty :: forall a. f a Source #

empty :: Alternative f => f a Source #

Instances

 HasEmpty [] Source # Methodsempty :: [a] Source # Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods HasEmpty (Map k) Source # Methodsempty :: Map k a Source # (Alternative f, Alternative g) => HasEmpty (Product * f g) Source # Methodsempty :: Product * f g a Source # (Alternative f, Applicative g) => HasEmpty (Compose * * f g) Source # Methodsempty :: Compose * * f g a Source #

coerce :: HasEmpty f => a -> f b Source #

isEmpty :: (HasEmpty f, Eq (f a)) => f a -> Bool Source #