{-# language Safe #-}

module LazyAsync.Types.Outcome where

import LazyAsync.Prelude (Foldable, Functor, Show, SomeException, Traversable)

-- | The result of a 'LazyAsync.LazyAsync' that is 'LazyAsync.Done' running
--
-- Obtained using 'LazyAsync.waitCatch'
data Outcome a =
    Failure SomeException -- ^ 💣 The 'LazyAsync.LazyAsync.LazyAsync' action threw an exception
  | Success a -- ^ ✅ The 'LazyAsync.LazyAsync.LazyAsync' action completed normally
    deriving (Outcome a -> Bool
(a -> m) -> Outcome a -> m
(a -> b -> b) -> b -> Outcome a -> b
(forall m. Monoid m => Outcome m -> m)
-> (forall m a. Monoid m => (a -> m) -> Outcome a -> m)
-> (forall m a. Monoid m => (a -> m) -> Outcome a -> m)
-> (forall a b. (a -> b -> b) -> b -> Outcome a -> b)
-> (forall a b. (a -> b -> b) -> b -> Outcome a -> b)
-> (forall b a. (b -> a -> b) -> b -> Outcome a -> b)
-> (forall b a. (b -> a -> b) -> b -> Outcome a -> b)
-> (forall a. (a -> a -> a) -> Outcome a -> a)
-> (forall a. (a -> a -> a) -> Outcome a -> a)
-> (forall a. Outcome a -> [a])
-> (forall a. Outcome a -> Bool)
-> (forall a. Outcome a -> Int)
-> (forall a. Eq a => a -> Outcome a -> Bool)
-> (forall a. Ord a => Outcome a -> a)
-> (forall a. Ord a => Outcome a -> a)
-> (forall a. Num a => Outcome a -> a)
-> (forall a. Num a => Outcome a -> a)
-> Foldable Outcome
forall a. Eq a => a -> Outcome a -> Bool
forall a. Num a => Outcome a -> a
forall a. Ord a => Outcome a -> a
forall m. Monoid m => Outcome m -> m
forall a. Outcome a -> Bool
forall a. Outcome a -> Int
forall a. Outcome a -> [a]
forall a. (a -> a -> a) -> Outcome a -> a
forall m a. Monoid m => (a -> m) -> Outcome a -> m
forall b a. (b -> a -> b) -> b -> Outcome a -> b
forall a b. (a -> b -> b) -> b -> Outcome a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Outcome a -> a
$cproduct :: forall a. Num a => Outcome a -> a
sum :: Outcome a -> a
$csum :: forall a. Num a => Outcome a -> a
minimum :: Outcome a -> a
$cminimum :: forall a. Ord a => Outcome a -> a
maximum :: Outcome a -> a
$cmaximum :: forall a. Ord a => Outcome a -> a
elem :: a -> Outcome a -> Bool
$celem :: forall a. Eq a => a -> Outcome a -> Bool
length :: Outcome a -> Int
$clength :: forall a. Outcome a -> Int
null :: Outcome a -> Bool
$cnull :: forall a. Outcome a -> Bool
toList :: Outcome a -> [a]
$ctoList :: forall a. Outcome a -> [a]
foldl1 :: (a -> a -> a) -> Outcome a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Outcome a -> a
foldr1 :: (a -> a -> a) -> Outcome a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Outcome a -> a
foldl' :: (b -> a -> b) -> b -> Outcome a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Outcome a -> b
foldl :: (b -> a -> b) -> b -> Outcome a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Outcome a -> b
foldr' :: (a -> b -> b) -> b -> Outcome a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Outcome a -> b
foldr :: (a -> b -> b) -> b -> Outcome a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Outcome a -> b
foldMap' :: (a -> m) -> Outcome a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Outcome a -> m
foldMap :: (a -> m) -> Outcome a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Outcome a -> m
fold :: Outcome m -> m
$cfold :: forall m. Monoid m => Outcome m -> m
Foldable, a -> Outcome b -> Outcome a
(a -> b) -> Outcome a -> Outcome b
(forall a b. (a -> b) -> Outcome a -> Outcome b)
-> (forall a b. a -> Outcome b -> Outcome a) -> Functor Outcome
forall a b. a -> Outcome b -> Outcome a
forall a b. (a -> b) -> Outcome a -> Outcome b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Outcome b -> Outcome a
$c<$ :: forall a b. a -> Outcome b -> Outcome a
fmap :: (a -> b) -> Outcome a -> Outcome b
$cfmap :: forall a b. (a -> b) -> Outcome a -> Outcome b
Functor, Int -> Outcome a -> ShowS
[Outcome a] -> ShowS
Outcome a -> String
(Int -> Outcome a -> ShowS)
-> (Outcome a -> String)
-> ([Outcome a] -> ShowS)
-> Show (Outcome a)
forall a. Show a => Int -> Outcome a -> ShowS
forall a. Show a => [Outcome a] -> ShowS
forall a. Show a => Outcome a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Outcome a] -> ShowS
$cshowList :: forall a. Show a => [Outcome a] -> ShowS
show :: Outcome a -> String
$cshow :: forall a. Show a => Outcome a -> String
showsPrec :: Int -> Outcome a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Outcome a -> ShowS
Show, Functor Outcome
Foldable Outcome
Functor Outcome
-> Foldable Outcome
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Outcome a -> f (Outcome b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Outcome (f a) -> f (Outcome a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Outcome a -> m (Outcome b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Outcome (m a) -> m (Outcome a))
-> Traversable Outcome
(a -> f b) -> Outcome a -> f (Outcome b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Outcome (m a) -> m (Outcome a)
forall (f :: * -> *) a.
Applicative f =>
Outcome (f a) -> f (Outcome a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Outcome a -> m (Outcome b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Outcome a -> f (Outcome b)
sequence :: Outcome (m a) -> m (Outcome a)
$csequence :: forall (m :: * -> *) a. Monad m => Outcome (m a) -> m (Outcome a)
mapM :: (a -> m b) -> Outcome a -> m (Outcome b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Outcome a -> m (Outcome b)
sequenceA :: Outcome (f a) -> f (Outcome a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Outcome (f a) -> f (Outcome a)
traverse :: (a -> f b) -> Outcome a -> f (Outcome b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Outcome a -> f (Outcome b)
$cp2Traversable :: Foldable Outcome
$cp1Traversable :: Functor Outcome
Traversable)