chatty-utils-0.7.3.3: Some utilities every serious chatty-based application may need.

Safe HaskellSafe
LanguageHaskell2010

Data.Chatty.None

Description

Provides a typeclass for everything that may carry a void value

Synopsis

Documentation

class None n where Source

Typeclass for everything that may carry a void value

Methods

none :: n Source

noneM :: (Monad m, None n) => m n Source

Wrap the void into a monad.

joinMaybe :: None n => Maybe n -> n Source

Join a maybe into the underlying type. Nothing becomes none.

expandMaybe :: (Eq n, None n) => n -> Maybe n Source

Wrap the value into a maybe. none becomes Nothing.

cleanMaybe :: (Eq n, None n) => Maybe n -> Maybe n Source

Clean the maybe by pulling wrapped nones to the outside (as a Nothing).

reduce :: (Eq n, None n) => [n] -> [n] Source

Eliminate all void elements from the list.

reduceMaybe :: [Maybe a] -> [a] Source

Eliminate all Nothings from the list and unjust all remaining values.