Skip to content

Latest commit

 

History

History
96 lines (60 loc) · 1.5 KB

Util.md

File metadata and controls

96 lines (60 loc) · 1.5 KB

Module Control.Error.Util

Use these functions to convert between Maybe, Either, MaybeT, and ExceptT.

hush

hush :: forall a b. Either a b -> Maybe b

Suppress the Left value of an Either

hushT

hushT :: forall a b m. Monad m => ExceptT a m b -> MaybeT m b

Suppress the Left value of an ExceptT

note

note :: forall a b. a -> Maybe b -> Either a b

Tag the Nothing value of a Maybe

noteT

noteT :: forall a b m. Monad m => a -> MaybeT m b -> ExceptT a m b

Tag the Nothing value of a MaybeT

hoistMaybe

hoistMaybe :: forall b m. Monad m => Maybe b -> MaybeT m b

Lift a Maybe to the MaybeT monad

exceptNoteM

exceptNoteM :: forall a e m. Applicative m => Maybe a -> e -> ExceptT e m a

Convert a Maybe value into the ExceptT monad

(??)

infixl 9 exceptNoteM as ??

exceptNoteA

exceptNoteA :: forall a e m. Apply m => m (Maybe a) -> e -> ExceptT e m a

Convert an applicative Maybe value into the ExceptT monad

(!?)

infixl 9 exceptNoteA as !?

bool

bool :: forall a. a -> a -> Boolean -> a

Case analysis for the Boolean type

fromMaybe'

fromMaybe' :: forall a. Maybe a -> a -> a

An infix form of fromMaybe with arguments flipped.

(?:)

infixl 9 fromMaybe' as ?: