primus-0.3.0.0: nonempty and positive functions
Copyright(c) Grant Weyburne 2022
LicenseBSD-3
Safe HaskellSafe-Inferred
LanguageHaskell2010

Primus.Bool

Description

 
Synopsis

builders

boolMaybe :: (a -> Bool) -> (a -> b) -> a -> Maybe b Source #

create a Maybe using a predicate and a function for the success case predicate appears first unlike bool

boolEither :: (a -> Bool) -> (a -> e) -> (a -> b) -> a -> Either e b Source #

create a Either using a predicate and functions for the failure and success case predicates appear first unlike bool

boolThese :: (a -> Bool) -> (a -> Bool) -> (a -> e) -> (a -> b) -> a -> These e b Source #

create a These using two predicates and functions for the This case and That case False + * == This (a -> e) True + False == That (a -> b) True + True == These (a -> e) (a -> b) -- "a" effectively appears twice

predicates appear first unlike bool

boolThese' :: (a -> Bool) -> (a -> Bool) -> (a -> e) -> (a -> b) -> ((e, b) -> a -> (e, b)) -> a -> These e b Source #

similar to boolThese but allows you to override the These case

predicates appear first unlike bool

monadic functions

boolM :: Monad m => m Bool -> m a -> m a -> m a Source #

monadic version of bool predicate appears first unlike bool

unlessMB :: Applicative m => (a -> Bool) -> a -> (a -> m ()) -> m () Source #

unless but makes the "a" parameter available to the callback

whenMB :: Applicative m => (a -> Bool) -> a -> (a -> m ()) -> m () Source #

when but makes the "a" parameter available to the callback