The IsNull package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

A typeclass to determine if a given foldable type (or other) is empty ~ null ~ invalid. The definition is intentionally vague, to cover types from Either to Text and Sets.


[Skip to ReadMe]

Properties

Versions0.3.0.0, 0.3.0.0, 0.4.0.0
Change logNone available
Dependenciesbase (>=4.5 && <4.8), base-compat (==0.5.*), bytestring (>=0.10.0 && <1.0), containers (==0.5.*), text (>=0.11.3 && <1.3) [details]
LicenseBSD3
AuthorJoão Cristóvão
Maintainerjmacristovao@gmail.com
CategoryData
Home pagehttps://github.com/jcristovao/IsNull
Source repositoryhead: git clone https://github.com/jcristovao/IsNull
UploadedThu May 8 09:40:55 UTC 2014 by jcristovao

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for IsNull-0.3.0.0

[back to package description]

IsNull

A typeclass to determine if a given container is null.

Strongly inspired by mono-traversable, but with a simpler goal: supporting IsNull and nested IsNull operations.

Supported functions:

isNull :: a -> Bool

notNull :: a -> Bool

-- | Nested isNull
isNullN :: (Foldable f) => f a -> Bool

-- | Monadic isNull
isNullM :: Monad m => m a -> m Bool

-- | Monadic Nested isNull
isNullNM :: (Monad m, Foldable f) => m (f a) -> m Bool


-- | Alternative <|> operator does not always operate as choice,
-- at least not in an intuitive way (for example with lists).
-- This one does:
<\> :: a -> a -> a

The N stands for (non-recursive) nested, such that:


isNullN (Just "abc") == False
isNullN (Just ""   ) == True
isNullN (Nothing   ) == True

While the isNull function is equivalent to (==) mempty for most of the instances, not all Foldables are monoids, and not all monoids mempty means null:

Bugs, suggestions and comments are most welcomed!