{-# LANGUAGE RankNTypes #-}

module Test.Sandwich.RunTree where

import Control.Concurrent.STM
import Test.Sandwich.Types.RunTree
import Test.Sandwich.Types.Spec


extractValues :: (forall context. RunNodeWithStatus context s l t -> a) -> RunNodeWithStatus context s l t -> [a]
extractValues :: forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> a)
-> RunNodeWithStatus context s l t -> [a]
extractValues forall context. RunNodeWithStatus context s l t -> a
f node :: RunNodeWithStatus context s l t
node@(RunNodeIt {}) = [forall context. RunNodeWithStatus context s l t -> a
f RunNodeWithStatus context s l t
node]
extractValues forall context. RunNodeWithStatus context s l t -> a
f node :: RunNodeWithStatus context s l t
node@(RunNodeIntroduce {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: ()
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented}) = (forall context. RunNodeWithStatus context s l t -> a
f RunNodeWithStatus context s l t
node) forall a. a -> [a] -> [a]
: (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> a)
-> RunNodeWithStatus context s l t -> [a]
extractValues forall context. RunNodeWithStatus context s l t -> a
f) [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented)
extractValues forall context. RunNodeWithStatus context s l t -> a
f node :: RunNodeWithStatus context s l t
node@(RunNodeIntroduceWith {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: ()
runNodeChildrenAugmented}) = (forall context. RunNodeWithStatus context s l t -> a
f RunNodeWithStatus context s l t
node) forall a. a -> [a] -> [a]
: (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> a)
-> RunNodeWithStatus context s l t -> [a]
extractValues forall context. RunNodeWithStatus context s l t -> a
f) [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented)
extractValues forall context. RunNodeWithStatus context s l t -> a
f RunNodeWithStatus context s l t
node = (forall context. RunNodeWithStatus context s l t -> a
f RunNodeWithStatus context s l t
node) forall a. a -> [a] -> [a]
: (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> a)
-> RunNodeWithStatus context s l t -> [a]
extractValues forall context. RunNodeWithStatus context s l t -> a
f) (forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l t
node))

extractValuesControlRecurse :: (forall context. RunNodeWithStatus context s l t -> (Bool, a)) -> RunNodeWithStatus context s l t -> [a]
extractValuesControlRecurse :: forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> (Bool, a))
-> RunNodeWithStatus context s l t -> [a]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f node :: RunNodeWithStatus context s l t
node@(RunNodeIt {}) = [forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall context. RunNodeWithStatus context s l t -> (Bool, a)
f RunNodeWithStatus context s l t
node]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f node :: RunNodeWithStatus context s l t
node@(RunNodeIntroduce {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: ()
runNodeChildrenAugmented}) = case forall context. RunNodeWithStatus context s l t -> (Bool, a)
f RunNodeWithStatus context s l t
node of
  (Bool
True, a
x) -> a
x forall a. a -> [a] -> [a]
: (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> (Bool, a))
-> RunNodeWithStatus context s l t -> [a]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f) [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented)
  (Bool
False, a
x) -> [a
x]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f node :: RunNodeWithStatus context s l t
node@(RunNodeIntroduceWith {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented :: ()
runNodeChildrenAugmented}) = case forall context. RunNodeWithStatus context s l t -> (Bool, a)
f RunNodeWithStatus context s l t
node of
  (Bool
True, a
x) -> a
x forall a. a -> [a] -> [a]
: (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> (Bool, a))
-> RunNodeWithStatus context s l t -> [a]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f) [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented)
  (Bool
False, a
x) -> [a
x]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f RunNodeWithStatus context s l t
node = case forall context. RunNodeWithStatus context s l t -> (Bool, a)
f RunNodeWithStatus context s l t
node of
  (Bool
True, a
x) -> a
x forall a. a -> [a] -> [a]
: (forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> (Bool, a))
-> RunNodeWithStatus context s l t -> [a]
extractValuesControlRecurse forall context. RunNodeWithStatus context s l t -> (Bool, a)
f) (forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l t
node))
  (Bool
False, a
x) -> [a
x]

getCommons :: RunNodeWithStatus context s l t -> [RunNodeCommonWithStatus s l t]
getCommons :: forall context s l t.
RunNodeWithStatus context s l t -> [RunNodeCommonWithStatus s l t]
getCommons = forall s l t a context.
(forall context. RunNodeWithStatus context s l t -> a)
-> RunNodeWithStatus context s l t -> [a]
extractValues forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon

fixRunTree :: RunNode context -> STM (RunNodeFixed context)
fixRunTree :: forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree node :: RunNode context
node@(forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon -> (RunNodeCommonWithStatus {Bool
Int
String
Maybe String
Maybe SrcLoc
Var Bool
Var (Seq LogEntry)
Var Status
Seq Int
runTreeLoc :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe SrcLoc
runTreeLogs :: forall s l t. RunNodeCommonWithStatus s l t -> l
runTreeRecordTime :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisibilityLevel :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeFolder :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe String
runTreeVisible :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeStatus :: forall s l t. RunNodeCommonWithStatus s l t -> s
runTreeOpen :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeToggled :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeAncestors :: forall s l t. RunNodeCommonWithStatus s l t -> Seq Int
runTreeId :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeLabel :: forall s l t. RunNodeCommonWithStatus s l t -> String
runTreeLoc :: Maybe SrcLoc
runTreeLogs :: Var (Seq LogEntry)
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeStatus :: Var Status
runTreeOpen :: Var Bool
runTreeToggled :: Var Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
..})) = do
  Status
status <- forall a. TVar a -> STM a
readTVar Var Status
runTreeStatus
  Seq LogEntry
logs <- forall a. TVar a -> STM a
readTVar Var (Seq LogEntry)
runTreeLogs
  Bool
toggled <- forall a. TVar a -> STM a
readTVar Var Bool
runTreeToggled
  Bool
open <- forall a. TVar a -> STM a
readTVar Var Bool
runTreeOpen

  let common' :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common' = RunNodeCommonWithStatus {
        runTreeStatus :: Status
runTreeStatus = Status
status
        , runTreeLogs :: Seq LogEntry
runTreeLogs = Seq LogEntry
logs
        , runTreeToggled :: Bool
runTreeToggled = Bool
toggled
        , runTreeOpen :: Bool
runTreeOpen = Bool
open
        , Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
runTreeLoc :: Maybe SrcLoc
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
runTreeLoc :: Maybe SrcLoc
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
..
        }

  case RunNode context
node of
    RunNodeBefore {[RunNode context]
ExampleT context IO ()
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeBefore :: forall s l t context.
RunNodeWithStatus context s l t -> ExampleT context IO ()
runNodeBefore :: ExampleT context IO ()
runNodeChildren :: [RunNode context]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNodeFixed context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNode context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeBefore { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildren :: [RunNodeFixed context]
runNodeChildren=[RunNodeFixed context]
children, ExampleT context IO ()
runNodeBefore :: ExampleT context IO ()
runNodeBefore :: ExampleT context IO ()
.. }
    RunNodeAfter {[RunNode context]
ExampleT context IO ()
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeAfter :: forall s l t context.
RunNodeWithStatus context s l t -> ExampleT context IO ()
runNodeAfter :: ExampleT context IO ()
runNodeChildren :: [RunNode context]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNodeFixed context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNode context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeAfter { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildren :: [RunNodeFixed context]
runNodeChildren=[RunNodeFixed context]
children, ExampleT context IO ()
runNodeAfter :: ExampleT context IO ()
runNodeAfter :: ExampleT context IO ()
.. }
    RunNodeIntroduce {[RunNodeWithStatus
   (LabelValue lab intro :> context)
   (Var Status)
   (Var (Seq LogEntry))
   (Var Bool)]
ExampleT context IO intro
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
intro -> ExampleT context IO ()
runNodeCleanup :: ()
runNodeAlloc :: ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeChildrenAugmented :: [RunNodeWithStatus
   (LabelValue lab intro :> context)
   (Var Status)
   (Var (Seq LogEntry))
   (Var Bool)]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
..} -> do
      [RunNodeFixed (LabelValue lab intro :> context)]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNodeWithStatus
   (LabelValue lab intro :> context)
   (Var Status)
   (Var (Seq LogEntry))
   (Var Bool)]
runNodeChildrenAugmented
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeIntroduce { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildrenAugmented :: [RunNodeFixed (LabelValue lab intro :> context)]
runNodeChildrenAugmented=[RunNodeFixed (LabelValue lab intro :> context)]
children, ExampleT context IO intro
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
.. }
    RunNodeIntroduceWith {[RunNodeWithStatus
   (LabelValue lab intro :> context)
   (Var Status)
   (Var (Seq LogEntry))
   (Var Bool)]
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeChildrenAugmented :: [RunNodeWithStatus
   (LabelValue lab intro :> context)
   (Var Status)
   (Var (Seq LogEntry))
   (Var Bool)]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
..} -> do
      [RunNodeFixed (LabelValue lab intro :> context)]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNodeWithStatus
   (LabelValue lab intro :> context)
   (Var Status)
   (Var (Seq LogEntry))
   (Var Bool)]
runNodeChildrenAugmented
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeIntroduceWith { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildrenAugmented :: [RunNodeFixed (LabelValue lab intro :> context)]
runNodeChildrenAugmented=[RunNodeFixed (LabelValue lab intro :> context)]
children, (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
.. }
    RunNodeAround {[RunNode context]
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: forall s l t context.
RunNodeWithStatus context s l t
-> ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: ExampleT context IO [Result] -> ExampleT context IO ()
runNodeChildren :: [RunNode context]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNodeFixed context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNode context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeAround { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildren :: [RunNodeFixed context]
runNodeChildren=[RunNodeFixed context]
children, ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: ExampleT context IO [Result] -> ExampleT context IO ()
.. }
    RunNodeDescribe {[RunNode context]
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeChildren :: [RunNode context]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNodeFixed context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNode context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeDescribe { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildren :: [RunNodeFixed context]
runNodeChildren=[RunNodeFixed context]
children, .. }
    RunNodeParallel {[RunNode context]
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeChildren :: [RunNode context]
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNodeFixed context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNode context -> STM (RunNodeFixed context)
fixRunTree [RunNode context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeParallel { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', runNodeChildren :: [RunNodeFixed context]
runNodeChildren=[RunNodeFixed context]
children, .. }
    RunNodeIt {ExampleT context IO ()
RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeExample :: forall s l t context.
RunNodeWithStatus context s l t -> ExampleT context IO ()
runNodeExample :: ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..} -> do
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeIt { runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon=RunNodeCommonWithStatus Status (Seq LogEntry) Bool
common', ExampleT context IO ()
runNodeExample :: ExampleT context IO ()
runNodeExample :: ExampleT context IO ()
.. }

unFixRunTree :: RunNodeFixed context -> STM (RunNode context)
unFixRunTree :: forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree node :: RunNodeFixed context
node@(forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon -> (RunNodeCommonWithStatus {Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
Seq LogEntry
Status
runTreeLoc :: Maybe SrcLoc
runTreeLogs :: Seq LogEntry
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeStatus :: Status
runTreeOpen :: Bool
runTreeToggled :: Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
runTreeLoc :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe SrcLoc
runTreeLogs :: forall s l t. RunNodeCommonWithStatus s l t -> l
runTreeRecordTime :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisibilityLevel :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeFolder :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe String
runTreeVisible :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeStatus :: forall s l t. RunNodeCommonWithStatus s l t -> s
runTreeOpen :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeToggled :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeAncestors :: forall s l t. RunNodeCommonWithStatus s l t -> Seq Int
runTreeId :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeLabel :: forall s l t. RunNodeCommonWithStatus s l t -> String
..})) = do
  Var Status
status <- forall a. a -> STM (TVar a)
newTVar Status
runTreeStatus
  Var (Seq LogEntry)
logs <- forall a. a -> STM (TVar a)
newTVar Seq LogEntry
runTreeLogs
  Var Bool
toggled <- forall a. a -> STM (TVar a)
newTVar Bool
runTreeToggled
  Var Bool
open <- forall a. a -> STM (TVar a)
newTVar Bool
runTreeOpen

  let common' :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common' = RunNodeCommonWithStatus {
        runTreeStatus :: Var Status
runTreeStatus = Var Status
status
        , runTreeLogs :: Var (Seq LogEntry)
runTreeLogs = Var (Seq LogEntry)
logs
        , runTreeToggled :: Var Bool
runTreeToggled = Var Bool
toggled
        , runTreeOpen :: Var Bool
runTreeOpen = Var Bool
open
        , Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
runTreeLoc :: Maybe SrcLoc
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
runTreeLoc :: Maybe SrcLoc
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
..
        }

  case RunNodeFixed context
node of
    RunNodeBefore {[RunNodeFixed context]
ExampleT context IO ()
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeBefore :: ExampleT context IO ()
runNodeChildren :: [RunNodeFixed context]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeBefore :: forall s l t context.
RunNodeWithStatus context s l t -> ExampleT context IO ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNode context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeFixed context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeBefore { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildren :: [RunNode context]
runNodeChildren=[RunNode context]
children, ExampleT context IO ()
runNodeBefore :: ExampleT context IO ()
runNodeBefore :: ExampleT context IO ()
.. }
    RunNodeAfter {[RunNodeFixed context]
ExampleT context IO ()
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeAfter :: ExampleT context IO ()
runNodeChildren :: [RunNodeFixed context]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeAfter :: forall s l t context.
RunNodeWithStatus context s l t -> ExampleT context IO ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNode context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeFixed context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeAfter { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildren :: [RunNode context]
runNodeChildren=[RunNode context]
children, ExampleT context IO ()
runNodeAfter :: ExampleT context IO ()
runNodeAfter :: ExampleT context IO ()
.. }
    RunNodeIntroduce {[RunNodeWithStatus
   (LabelValue lab intro :> context) Status (Seq LogEntry) Bool]
ExampleT context IO intro
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeChildrenAugmented :: [RunNodeWithStatus
   (LabelValue lab intro :> context) Status (Seq LogEntry) Bool]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCleanup :: ()
runNodeAlloc :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
..} -> do
      [RunNode (LabelValue lab intro :> context)]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeWithStatus
   (LabelValue lab intro :> context) Status (Seq LogEntry) Bool]
runNodeChildrenAugmented
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeIntroduce { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildrenAugmented :: [RunNode (LabelValue lab intro :> context)]
runNodeChildrenAugmented=[RunNode (LabelValue lab intro :> context)]
children, ExampleT context IO intro
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
.. }
    RunNodeIntroduceWith {[RunNodeWithStatus
   (LabelValue lab intro :> context) Status (Seq LogEntry) Bool]
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeChildrenAugmented :: [RunNodeWithStatus
   (LabelValue lab intro :> context) Status (Seq LogEntry) Bool]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeIntroduceAction :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
..} -> do
      [RunNode (LabelValue lab intro :> context)]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeWithStatus
   (LabelValue lab intro :> context) Status (Seq LogEntry) Bool]
runNodeChildrenAugmented
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeIntroduceWith { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildrenAugmented :: [RunNode (LabelValue lab intro :> context)]
runNodeChildrenAugmented=[RunNode (LabelValue lab intro :> context)]
children, (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
.. }
    RunNodeAround {[RunNodeFixed context]
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: ExampleT context IO [Result] -> ExampleT context IO ()
runNodeChildren :: [RunNodeFixed context]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeActionWith :: forall s l t context.
RunNodeWithStatus context s l t
-> ExampleT context IO [Result] -> ExampleT context IO ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNode context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeFixed context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeAround { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildren :: [RunNode context]
runNodeChildren=[RunNode context]
children, ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: ExampleT context IO [Result] -> ExampleT context IO ()
runNodeActionWith :: ExampleT context IO [Result] -> ExampleT context IO ()
.. }
    RunNodeDescribe {[RunNodeFixed context]
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeChildren :: [RunNodeFixed context]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNode context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeFixed context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeDescribe { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildren :: [RunNode context]
runNodeChildren=[RunNode context]
children, .. }
    RunNodeParallel {[RunNodeFixed context]
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeChildren :: [RunNodeFixed context]
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildren :: forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
..} -> do
      [RunNode context]
children <- forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM forall context. RunNodeFixed context -> STM (RunNode context)
unFixRunTree [RunNodeFixed context]
runNodeChildren
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeParallel { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', runNodeChildren :: [RunNode context]
runNodeChildren=[RunNode context]
children, .. }
    RunNodeIt {ExampleT context IO ()
RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeExample :: ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
runNodeExample :: forall s l t context.
RunNodeWithStatus context s l t -> ExampleT context IO ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..} -> do
      forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ RunNodeIt { runNodeCommon :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
runNodeCommon=RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common', ExampleT context IO ()
runNodeExample :: ExampleT context IO ()
runNodeExample :: ExampleT context IO ()
.. }


isDone :: Status -> Bool
isDone :: Status -> Bool
isDone (Done {}) = Bool
True
isDone Status
_ = Bool
False

isRunning :: Status -> Bool
isRunning :: Status -> Bool
isRunning (Running {}) = Bool
True
isRunning Status
_ = Bool
False

isFailureStatus :: Status -> Bool
isFailureStatus :: Status -> Bool
isFailureStatus (Done UTCTime
_ UTCTime
_ Result
stat) = Result -> Bool
isFailure Result
stat
isFailureStatus Status
_ = Bool
False

isFailure :: Result -> Bool
isFailure :: Result -> Bool
isFailure (Failure (Pending {})) = Bool
False
isFailure (Failure {}) = Bool
True
isFailure Result
_ = Bool
False

isPending :: Result -> Bool
isPending :: Result -> Bool
isPending (Failure (Pending {})) = Bool
True
isPending Result
_ = Bool
False

whenFailure :: (Monad m) => Result -> (FailureReason -> m ()) -> m ()
whenFailure :: forall (m :: * -> *).
Monad m =>
Result -> (FailureReason -> m ()) -> m ()
whenFailure (Failure (Pending {})) FailureReason -> m ()
_ = forall (m :: * -> *) a. Monad m => a -> m a
return ()
whenFailure (Failure FailureReason
reason) FailureReason -> m ()
action = FailureReason -> m ()
action FailureReason
reason
whenFailure Result
_ FailureReason -> m ()
_ = forall (m :: * -> *) a. Monad m => a -> m a
return ()