{-# 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 ((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
$cfold :: forall m. Monoid m => Outcome m -> m
fold :: forall m. Monoid m => Outcome m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Outcome a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Outcome a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Outcome a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Outcome a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Outcome a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Outcome a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Outcome a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Outcome a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Outcome a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Outcome a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Outcome a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Outcome a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Outcome a -> a
foldr1 :: forall a. (a -> a -> a) -> Outcome a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Outcome a -> a
foldl1 :: forall a. (a -> a -> a) -> Outcome a -> a
$ctoList :: forall a. Outcome a -> [a]
toList :: forall a. Outcome a -> [a]
$cnull :: forall a. Outcome a -> Bool
null :: forall a. Outcome a -> Bool
$clength :: forall a. Outcome a -> Int
length :: forall a. Outcome a -> Int
$celem :: forall a. Eq a => a -> Outcome a -> Bool
elem :: forall a. Eq a => a -> Outcome a -> Bool
$cmaximum :: forall a. Ord a => Outcome a -> a
maximum :: forall a. Ord a => Outcome a -> a
$cminimum :: forall a. Ord a => Outcome a -> a
minimum :: forall a. Ord a => Outcome a -> a
$csum :: forall a. Num a => Outcome a -> a
sum :: forall a. Num a => Outcome a -> a
$cproduct :: forall a. Num a => Outcome a -> a
product :: forall a. Num a => Outcome a -> a
Foldable, (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
$cfmap :: forall a b. (a -> b) -> Outcome a -> Outcome b
fmap :: forall a b. (a -> b) -> Outcome a -> Outcome b
$c<$ :: forall a b. a -> Outcome b -> Outcome a
<$ :: forall a b. a -> Outcome b -> Outcome a
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
$cshowsPrec :: forall a. Show a => Int -> Outcome a -> ShowS
showsPrec :: Int -> Outcome a -> ShowS
$cshow :: forall a. Show a => Outcome a -> String
show :: Outcome a -> String
$cshowList :: forall a. Show a => [Outcome a] -> ShowS
showList :: [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
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)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Outcome a -> f (Outcome b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Outcome a -> f (Outcome b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Outcome (f a) -> f (Outcome a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Outcome (f a) -> f (Outcome a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Outcome a -> m (Outcome b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Outcome a -> m (Outcome b)
$csequence :: forall (m :: * -> *) a. Monad m => Outcome (m a) -> m (Outcome a)
sequence :: forall (m :: * -> *) a. Monad m => Outcome (m a) -> m (Outcome a)
Traversable)