success-0.2.6: A version of Either specialised for encoding of success or failure

Safe Haskell | None
Language | Haskell2010

Success.Pure

Contents

- Creation
- Execution

Description

The types and functions are trivial and self-descriptive, hence this sentence is the sole documentation you get on them.

Synopsis

- data Success a b
- nothing :: Success a b
- failure :: a -> Success a b
- success :: b -> Success a b
- asEither :: Success a b -> Either (Maybe a) b
- asMaybe :: Success a b -> Maybe b

# Documentation

data Success a b #

Instances

Monad (Success a) # |
Methods (>>=) :: Success a a -> (a -> Success a b) -> Success a b # (>>) :: Success a a -> Success a b -> Success a b # return :: a -> Success a a # fail :: String -> Success a a #
Functor (Success a) # |
Methods fmap :: (a -> b) -> Success a a -> Success a b # (<$) :: a -> Success a b -> Success a a #
Applicative (Success a) # |
Methods pure :: a -> Success a a # (<*>) :: Success a (a -> b) -> Success a a -> Success a b # (*>) :: Success a a -> Success a b -> Success a b # (<*) :: Success a a -> Success a b -> Success a a #
Foldable (Success a) # |
Methods fold :: Monoid m => Success a m -> m # foldMap :: Monoid m => (a -> m) -> Success a a -> m # foldr :: (a -> b -> b) -> b -> Success a a -> b # foldr' :: (a -> b -> b) -> b -> Success a a -> b # foldl :: (b -> a -> b) -> b -> Success a a -> b # foldl' :: (b -> a -> b) -> b -> Success a a -> b # foldr1 :: (a -> a -> a) -> Success a a -> a # foldl1 :: (a -> a -> a) -> Success a a -> a # toList :: Success a a -> [a] # null :: Success a a -> Bool # length :: Success a a -> Int # elem :: Eq a => a -> Success a a -> Bool # maximum :: Ord a => Success a a -> a # minimum :: Ord a => Success a a -> a # sum :: Num a => Success a a -> a # product :: Num a => Success a a -> a #
Traversable (Success a) # |
Methods traverse :: Applicative f => (a -> f b) -> Success a a -> f (Success a b) # sequenceA :: Applicative f => Success a (f a) -> f (Success a a) # mapM :: Monad m => (a -> m b) -> Success a a -> m (Success a b) # sequence :: Monad m => Success a (m a) -> m (Success a a) #
Alternative (Success a) # |
Methods empty :: Success a a # (<|>) :: Success a a -> Success a a -> Success a a # some :: Success a a -> Success a [a] # many :: Success a a -> Success a [a] #
MonadPlus (Success a) # |
Methods mzero :: Success a a # mplus :: Success a a -> Success a a -> Success a a #
MonadError (Maybe a) (Success a) # |
Methods throwError :: Maybe a -> Success a a # catchError :: Success a a -> (Maybe a -> Success a a) -> Success a a #
(Show a, Show b) => Show (Success a b) # |
Methods showsPrec :: Int -> Success a b -> ShowS # show :: Success a b -> String # showList :: [Success a b] -> ShowS #

# Creation

nothing :: Success a b #

failure :: a -> Success a b #

success :: b -> Success a b #

# Execution

asEither :: Success a b -> Either (Maybe a) b #

asMaybe :: Success a b -> Maybe b #