{-# LANGUAGE MultiWayIf #-}
-- |

module Test.Sandwich.Formatters.TerminalUI.Filter (
  filterRunTree
  , treeToList
  ) where

import Control.Monad
import Control.Monad.Trans.Reader
import Data.Function
import qualified Data.List as L
import Test.Sandwich.Formatters.TerminalUI.Types
import Test.Sandwich.RunTree
import Test.Sandwich.Types.RunTree

filterRunTree :: Int -> [RunNodeFixed context] -> [RunNodeFixed context]
filterRunTree :: forall context.
Int -> [RunNodeFixed context] -> [RunNodeFixed context]
filterRunTree Int
visibilityThreshold [RunNodeFixed context]
rtsFixed = [RunNodeFixed context]
rtsFixed
  forall a b. a -> (a -> b) -> b
& forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon (Int -> RunNodeCommonFixed -> RunNodeCommonFixed
hideIfThresholdAbove Int
visibilityThreshold))
  forall a b. a -> (a -> b) -> b
& forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall context s l.
RunNodeWithStatus context s l Bool
-> RunNodeWithStatus context s l Bool
hideClosed

mapCommon :: (RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t) -> RunNodeWithStatus context s l t -> RunNodeWithStatus context s l t
mapCommon :: forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f node :: RunNodeWithStatus context s l t
node@(RunNodeIt {}) = RunNodeWithStatus context s l t
node { runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeCommon = RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f (forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node) }
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f (RunNodeIntroduce {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
ExampleT context IO intro
RunNodeCommonWithStatus s l t
intro -> ExampleT context IO ()
runNodeCleanup :: ()
runNodeAlloc :: ()
runNodeChildrenAugmented :: ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..}) = RunNodeIntroduce { runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeCommon = RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f RunNodeCommonWithStatus s l t
runNodeCommon
                                                       , runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f) [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented
                                                       , 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
.. }
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f (RunNodeIntroduceWith {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
RunNodeCommonWithStatus s l t
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..}) = RunNodeIntroduceWith { runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeCommon = RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f RunNodeCommonWithStatus s l t
runNodeCommon
                                                               , runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f) [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented
                                                               , (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 ()
.. }
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f RunNodeWithStatus context s l t
node = RunNodeWithStatus context s l t
node { runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeCommon = RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f (forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node)
                        , runNodeChildren :: [RunNodeWithStatus context s l t]
runNodeChildren = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t
f) (forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l t
node) }


hideIfThresholdAbove :: Int -> RunNodeCommonFixed -> RunNodeCommonFixed
hideIfThresholdAbove :: Int -> RunNodeCommonFixed -> RunNodeCommonFixed
hideIfThresholdAbove Int
visibilityThreshold node :: RunNodeCommonFixed
node@(RunNodeCommonWithStatus {Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
Seq LogEntry
Status
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 :: Seq LogEntry
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeStatus :: Status
runTreeOpen :: Bool
runTreeToggled :: Bool
runTreeAncestors :: Seq Int
runTreeId :: Int
runTreeLabel :: String
..}) =
  if | Int
runTreeVisibilityLevel forall a. Ord a => a -> a -> Bool
<= Int
visibilityThreshold -> RunNodeCommonFixed
node { runTreeVisible :: Bool
runTreeVisible = Bool
True }
     | Bool
otherwise -> RunNodeCommonFixed
node { runTreeVisible :: Bool
runTreeVisible = Bool
False
                         , runTreeOpen :: Bool
runTreeOpen = Bool
True -- Must be open so children have a chance to be seen
                         }

markClosed :: RunNodeCommonWithStatus s l Bool -> RunNodeCommonWithStatus s l Bool
markClosed :: forall s l.
RunNodeCommonWithStatus s l Bool
-> RunNodeCommonWithStatus s l Bool
markClosed node :: RunNodeCommonWithStatus s l Bool
node@(RunNodeCommonWithStatus {s
l
Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
runTreeLoc :: Maybe SrcLoc
runTreeLogs :: l
runTreeRecordTime :: Bool
runTreeVisibilityLevel :: Int
runTreeFolder :: Maybe String
runTreeVisible :: Bool
runTreeStatus :: s
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
..}) = RunNodeCommonWithStatus s l Bool
node { runTreeVisible :: Bool
runTreeVisible = Bool
False }

hideClosed :: RunNodeWithStatus context s l Bool -> RunNodeWithStatus context s l Bool
hideClosed :: forall context s l.
RunNodeWithStatus context s l Bool
-> RunNodeWithStatus context s l Bool
hideClosed node :: RunNodeWithStatus context s l Bool
node@(RunNodeIt {}) = RunNodeWithStatus context s l Bool
node
hideClosed (RunNodeIntroduce {[RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
ExampleT context IO intro
RunNodeCommonWithStatus s l Bool
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeCleanup :: ()
runNodeAlloc :: ()
runNodeChildrenAugmented :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..})
  | forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen RunNodeCommonWithStatus s l Bool
runNodeCommon = RunNodeIntroduce { runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall context s l.
RunNodeWithStatus context s l Bool
-> RunNodeWithStatus context s l Bool
hideClosed [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented, ExampleT context IO intro
RunNodeCommonWithStatus s l Bool
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCommon :: RunNodeCommonWithStatus s l Bool
.. }
  | Bool
otherwise = RunNodeIntroduce { runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon forall s l.
RunNodeCommonWithStatus s l Bool
-> RunNodeCommonWithStatus s l Bool
markClosed) [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented, ExampleT context IO intro
RunNodeCommonWithStatus s l Bool
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCommon :: RunNodeCommonWithStatus s l Bool
.. }
hideClosed (RunNodeIntroduceWith {[RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
RunNodeCommonWithStatus s l Bool
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: ()
runNodeChildrenAugmented :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..})
  | forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen RunNodeCommonWithStatus s l Bool
runNodeCommon = RunNodeIntroduceWith { runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall context s l.
RunNodeWithStatus context s l Bool
-> RunNodeWithStatus context s l Bool
hideClosed [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented, RunNodeCommonWithStatus s l Bool
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
.. }
  | Bool
otherwise = RunNodeIntroduceWith { runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon forall s l.
RunNodeCommonWithStatus s l Bool
-> RunNodeCommonWithStatus s l Bool
markClosed) [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented, RunNodeCommonWithStatus s l Bool
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
.. }
hideClosed RunNodeWithStatus context s l Bool
node
  | forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen (forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l Bool
node) = RunNodeWithStatus context s l Bool
node { runNodeChildren :: [RunNodeWithStatus context s l Bool]
runNodeChildren = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall context s l.
RunNodeWithStatus context s l Bool
-> RunNodeWithStatus context s l Bool
hideClosed (forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l Bool
node) }
  | Bool
otherwise = RunNodeWithStatus context s l Bool
node { runNodeChildren :: [RunNodeWithStatus context s l Bool]
runNodeChildren = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall s l t context.
(RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus context s l t
-> RunNodeWithStatus context s l t
mapCommon forall s l.
RunNodeCommonWithStatus s l Bool
-> RunNodeCommonWithStatus s l Bool
markClosed) (forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l Bool
node) }


treeToList :: (RunNodeFixed context, RunNode context) -> [MainListElem]
treeToList :: forall context.
(RunNodeFixed context, RunNode context) -> [MainListElem]
treeToList (RunNodeFixed context
nodeFixed, RunNode context
node) = forall a b. [a] -> [b] -> [(a, b)]
L.zip (forall r a. Reader r a -> r -> a
runReader (forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth' RunNodeFixed context
nodeFixed) Int
0) (forall context s l t.
RunNodeWithStatus context s l t -> [RunNodeCommonWithStatus s l t]
getCommons RunNode context
node)
  forall a b. a -> (a -> b) -> b
& forall a. (a -> Bool) -> [a] -> [a]
L.filter (RunNodeCommonFixed -> Bool
isVisible forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> a
fst)
  forall a b. a -> (a -> b) -> b
& forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((RunNodeCommonFixed, Int),
 RunNodeCommonWithStatus
   (Var Status) (Var (Seq LogEntry)) (Var Bool))
-> MainListElem
commonToMainListElem
  where

    isVisible :: RunNodeCommonFixed -> Bool
    isVisible :: RunNodeCommonFixed -> Bool
isVisible (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
..}) = Bool
runTreeVisible

    commonToMainListElem :: ((RunNodeCommonFixed, Int), RunNodeCommon) -> MainListElem
    commonToMainListElem :: ((RunNodeCommonFixed, Int),
 RunNodeCommonWithStatus
   (Var Status) (Var (Seq LogEntry)) (Var Bool))
-> MainListElem
commonToMainListElem ((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
..}, Int
depth), RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common) = MainListElem {
      label :: String
label = String
runTreeLabel
      , depth :: Int
depth = Int
depth
      , toggled :: Bool
toggled = Bool
runTreeToggled
      , open :: Bool
open = Bool
runTreeOpen
      , status :: Status
status = Status
runTreeStatus
      , logs :: Seq LogEntry
logs = Seq LogEntry
runTreeLogs
      , visibilityLevel :: Int
visibilityLevel = Int
runTreeVisibilityLevel
      , folderPath :: Maybe String
folderPath = Maybe String
runTreeFolder
      , node :: RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
node = RunNodeCommonWithStatus
  (Var Status) (Var (Seq LogEntry)) (Var Bool)
common
      , ident :: Int
ident = Int
runTreeId
      }

getCommonsWithVisibleDepth' :: RunNodeWithStatus context s l t -> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth' :: forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth' node :: RunNodeWithStatus context s l t
node@(RunNodeIt {}) = forall (m :: * -> *) r. Monad m => ReaderT r m r
ask forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> forall (m :: * -> *) a. Monad m => a -> m a
return [(forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node, Int
vd)]
getCommonsWithVisibleDepth' (RunNodeIntroduce {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
ExampleT context IO intro
RunNodeCommonWithStatus s l t
intro -> ExampleT context IO ()
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeCleanup :: ()
runNodeAlloc :: ()
runNodeChildrenAugmented :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..}) = do
  let context :: ReaderT Int m a -> ReaderT Int m a
context = if forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisible RunNodeCommonWithStatus s l t
runNodeCommon then (forall r (m :: * -> *) a.
(r -> r) -> ReaderT r m a -> ReaderT r m a
local (forall a. Num a => a -> a -> a
+Int
1)) else forall a. a -> a
id
  [(RunNodeCommonWithStatus s l t, Int)]
rest <- forall {m :: * -> *} {a}. ReaderT Int m a -> ReaderT Int m a
context forall a b. (a -> b) -> a -> b
$ (forall a. Monoid a => [a] -> a
mconcat forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth'
  forall (m :: * -> *) r. Monad m => ReaderT r m r
ask forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> forall (m :: * -> *) a. Monad m => a -> m a
return ((RunNodeCommonWithStatus s l t
runNodeCommon, Int
vd) forall a. a -> [a] -> [a]
: [(RunNodeCommonWithStatus s l t, Int)]
rest)
getCommonsWithVisibleDepth' (RunNodeIntroduceWith {[RunNodeWithStatus (LabelValue lab intro :> context) s l t]
RunNodeCommonWithStatus s l t
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeIntroduceAction :: ()
runNodeChildrenAugmented :: ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
..}) = do
  let context :: ReaderT Int m a -> ReaderT Int m a
context = if forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisible RunNodeCommonWithStatus s l t
runNodeCommon then (forall r (m :: * -> *) a.
(r -> r) -> ReaderT r m a -> ReaderT r m a
local (forall a. Num a => a -> a -> a
+Int
1)) else forall a. a -> a
id
  [(RunNodeCommonWithStatus s l t, Int)]
rest <- forall {m :: * -> *} {a}. ReaderT Int m a -> ReaderT Int m a
context forall a b. (a -> b) -> a -> b
$ (forall a. Monoid a => [a] -> a
mconcat forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeChildrenAugmented forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth'
  forall (m :: * -> *) r. Monad m => ReaderT r m r
ask forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> forall (m :: * -> *) a. Monad m => a -> m a
return ((RunNodeCommonWithStatus s l t
runNodeCommon, Int
vd) forall a. a -> [a] -> [a]
: [(RunNodeCommonWithStatus s l t, Int)]
rest)
getCommonsWithVisibleDepth' RunNodeWithStatus context s l t
node = do
  let context :: ReaderT Int m a -> ReaderT Int m a
context = if forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisible (forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node) then (forall r (m :: * -> *) a.
(r -> r) -> ReaderT r m a -> ReaderT r m a
local (forall a. Num a => a -> a -> a
+Int
1)) else forall a. a -> a
id
  [(RunNodeCommonWithStatus s l t, Int)]
rest <- forall {m :: * -> *} {a}. ReaderT Int m a -> ReaderT Int m a
context forall a b. (a -> b) -> a -> b
$ (forall a. Monoid a => [a] -> a
mconcat forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM (forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l t
node) forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth'
  forall (m :: * -> *) r. Monad m => ReaderT r m r
ask forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> forall (m :: * -> *) a. Monad m => a -> m a
return ((forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node, Int
vd) forall a. a -> [a] -> [a]
: [(RunNodeCommonWithStatus s l t, Int)]
rest)