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

Safe HaskellNone

Data.Chatty.None

Description

Provides a typeclass for everything that may carry a void value

Synopsis

Documentation

class None n whereSource

Typeclass for everything that may carry a void value

Methods

none :: nSource

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 nSource

Wrap the void into a monad.

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

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

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

Wrap the value into a maybe. none becomes Nothing.

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

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.