antisplice-0.12.0.0: An engine for text-based dungeons.

Safe HaskellNone

Game.Antisplice.Utils.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

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.