chatty-utils-0.7.3.0: 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

Instances

None Bool 
None Int 
None Integer 
None () 
None Text 
None [a] 
None (Maybe a) 
None (TST a) 
None (BST a) 
None (Focus a) 
None (AVL a) 
Monad m => None (a -> m a) 
None (a -> a) 
None (Graph a b c) 

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.