{-# 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
  [RunNodeFixed context]
-> ([RunNodeFixed context] -> [RunNodeFixed context])
-> [RunNodeFixed context]
forall a b. a -> (a -> b) -> b
& (RunNodeFixed context -> RunNodeFixed context)
-> [RunNodeFixed context] -> [RunNodeFixed context]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((RunNodeCommonWithStatus Status (Seq LogEntry) Bool
 -> RunNodeCommonWithStatus Status (Seq LogEntry) Bool)
-> RunNodeFixed context -> RunNodeFixed context
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
-> RunNodeCommonWithStatus Status (Seq LogEntry) Bool
-> RunNodeCommonWithStatus Status (Seq LogEntry) Bool
hideIfThresholdAbove Int
visibilityThreshold))
  [RunNodeFixed context]
-> ([RunNodeFixed context] -> [RunNodeFixed context])
-> [RunNodeFixed context]
forall a b. a -> (a -> b) -> b
& (RunNodeFixed context -> RunNodeFixed context)
-> [RunNodeFixed context] -> [RunNodeFixed context]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap RunNodeFixed context -> RunNodeFixed context
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 = f (runNodeCommon 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 ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeChildrenAugmented :: ()
runNodeAlloc :: ()
runNodeCleanup :: ()
..}) = 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 = (RunNodeWithStatus (LabelValue lab intro :> context) s l t
 -> RunNodeWithStatus (LabelValue lab intro :> context) s l t)
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus (LabelValue lab intro :> context) s l t
-> RunNodeWithStatus (LabelValue lab intro :> context) s l t
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 ()
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
.. }
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 ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeIntroduceAction :: ()
..}) = 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 = (RunNodeWithStatus (LabelValue lab intro :> context) s l t
 -> RunNodeWithStatus (LabelValue lab intro :> context) s l t)
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((RunNodeCommonWithStatus s l t -> RunNodeCommonWithStatus s l t)
-> RunNodeWithStatus (LabelValue lab intro :> context) s l t
-> RunNodeWithStatus (LabelValue lab intro :> context) s l t
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 = f (runNodeCommon node)
                        , runNodeChildren = fmap (mapCommon f) (runNodeChildren node) }


hideIfThresholdAbove :: Int -> RunNodeCommonFixed -> RunNodeCommonFixed
hideIfThresholdAbove :: Int
-> RunNodeCommonWithStatus Status (Seq LogEntry) Bool
-> RunNodeCommonWithStatus Status (Seq LogEntry) Bool
hideIfThresholdAbove Int
visibilityThreshold node :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool
node@(RunNodeCommonWithStatus {Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
Seq LogEntry
Status
runTreeLabel :: String
runTreeId :: Int
runTreeAncestors :: Seq Int
runTreeToggled :: Bool
runTreeOpen :: Bool
runTreeStatus :: Status
runTreeVisible :: Bool
runTreeFolder :: Maybe String
runTreeVisibilityLevel :: Int
runTreeRecordTime :: Bool
runTreeLogs :: Seq LogEntry
runTreeLoc :: Maybe SrcLoc
runTreeLabel :: forall s l t. RunNodeCommonWithStatus s l t -> String
runTreeId :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeAncestors :: forall s l t. RunNodeCommonWithStatus s l t -> Seq Int
runTreeToggled :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeStatus :: forall s l t. RunNodeCommonWithStatus s l t -> s
runTreeVisible :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeFolder :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe String
runTreeVisibilityLevel :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeRecordTime :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeLogs :: forall s l t. RunNodeCommonWithStatus s l t -> l
runTreeLoc :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe SrcLoc
..}) =
  if | Int
runTreeVisibilityLevel Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
visibilityThreshold -> RunNodeCommonWithStatus Status (Seq LogEntry) Bool
node { runTreeVisible = True }
     | Bool
otherwise -> RunNodeCommonWithStatus Status (Seq LogEntry) Bool
node { runTreeVisible = False
                         , runTreeOpen = 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
runTreeLabel :: forall s l t. RunNodeCommonWithStatus s l t -> String
runTreeId :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeAncestors :: forall s l t. RunNodeCommonWithStatus s l t -> Seq Int
runTreeToggled :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeStatus :: forall s l t. RunNodeCommonWithStatus s l t -> s
runTreeVisible :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeFolder :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe String
runTreeVisibilityLevel :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeRecordTime :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeLogs :: forall s l t. RunNodeCommonWithStatus s l t -> l
runTreeLoc :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe SrcLoc
runTreeLabel :: String
runTreeId :: Int
runTreeAncestors :: Seq Int
runTreeToggled :: Bool
runTreeOpen :: Bool
runTreeStatus :: s
runTreeVisible :: Bool
runTreeFolder :: Maybe String
runTreeVisibilityLevel :: Int
runTreeRecordTime :: Bool
runTreeLogs :: l
runTreeLoc :: Maybe SrcLoc
..}) = RunNodeCommonWithStatus s l Bool
node { runTreeVisible = 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 ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
runNodeAlloc :: ()
runNodeCleanup :: ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
..})
  | RunNodeCommonWithStatus s l Bool -> Bool
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 = (RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
 -> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool)
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
-> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
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 ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
.. }
  | Bool
otherwise = RunNodeIntroduce { runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented = (RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
 -> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool)
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((RunNodeCommonWithStatus s l Bool
 -> RunNodeCommonWithStatus s l Bool)
-> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
-> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
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 Bool
-> RunNodeCommonWithStatus s l Bool
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 ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
.. }
hideClosed (RunNodeIntroduceWith {[RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
RunNodeCommonWithStatus s l Bool
(intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
runNodeIntroduceAction :: ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
..})
  | RunNodeCommonWithStatus s l Bool -> Bool
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 = (RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
 -> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool)
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
-> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
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 ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
.. }
  | Bool
otherwise = RunNodeIntroduceWith { runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
runNodeChildrenAugmented = (RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
 -> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool)
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
-> [RunNodeWithStatus (LabelValue lab intro :> context) s l Bool]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((RunNodeCommonWithStatus s l Bool
 -> RunNodeCommonWithStatus s l Bool)
-> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
-> RunNodeWithStatus (LabelValue lab intro :> context) s l Bool
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 Bool
-> RunNodeCommonWithStatus s l Bool
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 ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
runNodeCommon :: RunNodeCommonWithStatus s l Bool
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
.. }
hideClosed RunNodeWithStatus context s l Bool
node
  | RunNodeCommonWithStatus s l Bool -> Bool
forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen (RunNodeWithStatus context s l Bool
-> RunNodeCommonWithStatus s l Bool
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 = fmap hideClosed (runNodeChildren node) }
  | Bool
otherwise = RunNodeWithStatus context s l Bool
node { runNodeChildren = fmap (mapCommon markClosed) (runNodeChildren node) }


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

    isVisible :: RunNodeCommonFixed -> Bool
    isVisible :: RunNodeCommonWithStatus Status (Seq LogEntry) Bool -> Bool
isVisible (RunNodeCommonWithStatus {Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
Seq LogEntry
Status
runTreeLabel :: forall s l t. RunNodeCommonWithStatus s l t -> String
runTreeId :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeAncestors :: forall s l t. RunNodeCommonWithStatus s l t -> Seq Int
runTreeToggled :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeStatus :: forall s l t. RunNodeCommonWithStatus s l t -> s
runTreeVisible :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeFolder :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe String
runTreeVisibilityLevel :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeRecordTime :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeLogs :: forall s l t. RunNodeCommonWithStatus s l t -> l
runTreeLoc :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe SrcLoc
runTreeLabel :: String
runTreeId :: Int
runTreeAncestors :: Seq Int
runTreeToggled :: Bool
runTreeOpen :: Bool
runTreeStatus :: Status
runTreeVisible :: Bool
runTreeFolder :: Maybe String
runTreeVisibilityLevel :: Int
runTreeRecordTime :: Bool
runTreeLogs :: Seq LogEntry
runTreeLoc :: Maybe SrcLoc
..}) = Bool
runTreeVisible

    commonToMainListElem :: ((RunNodeCommonFixed, Int), RunNodeCommon) -> MainListElem
    commonToMainListElem :: ((RunNodeCommonWithStatus Status (Seq LogEntry) Bool, Int),
 RunNodeCommonWithStatus
   (Var Status) (Var (Seq LogEntry)) (Var Bool))
-> MainListElem
commonToMainListElem ((RunNodeCommonWithStatus {Bool
Int
String
Maybe String
Maybe SrcLoc
Seq Int
Seq LogEntry
Status
runTreeLabel :: forall s l t. RunNodeCommonWithStatus s l t -> String
runTreeId :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeAncestors :: forall s l t. RunNodeCommonWithStatus s l t -> Seq Int
runTreeToggled :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeOpen :: forall s l t. RunNodeCommonWithStatus s l t -> t
runTreeStatus :: forall s l t. RunNodeCommonWithStatus s l t -> s
runTreeVisible :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeFolder :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe String
runTreeVisibilityLevel :: forall s l t. RunNodeCommonWithStatus s l t -> Int
runTreeRecordTime :: forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeLogs :: forall s l t. RunNodeCommonWithStatus s l t -> l
runTreeLoc :: forall s l t. RunNodeCommonWithStatus s l t -> Maybe SrcLoc
runTreeLabel :: String
runTreeId :: Int
runTreeAncestors :: Seq Int
runTreeToggled :: Bool
runTreeOpen :: Bool
runTreeStatus :: Status
runTreeVisible :: Bool
runTreeFolder :: Maybe String
runTreeVisibilityLevel :: Int
runTreeRecordTime :: Bool
runTreeLogs :: Seq LogEntry
runTreeLoc :: Maybe SrcLoc
..}, 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 {}) = ReaderT Int Identity Int
forall (m :: * -> *) r. Monad m => ReaderT r m r
ask ReaderT Int Identity Int
-> (Int
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b.
ReaderT Int Identity a
-> (a -> ReaderT Int Identity b) -> ReaderT Int Identity b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a. a -> ReaderT Int Identity a
forall (m :: * -> *) a. Monad m => a -> m a
return [(RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
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 ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
runNodeAlloc :: ()
runNodeCleanup :: ()
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeAlloc :: ExampleT context IO intro
runNodeCleanup :: intro -> ExampleT context IO ()
..}) = do
  let context :: ReaderT Int m a -> ReaderT Int m a
context = if RunNodeCommonWithStatus s l t -> Bool
forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisible RunNodeCommonWithStatus s l t
runNodeCommon then ((Int -> Int) -> ReaderT Int m a -> ReaderT Int m a
forall r (m :: * -> *) a.
(r -> r) -> ReaderT r m a -> ReaderT r m a
local (Int -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)) else ReaderT Int m a -> ReaderT Int m a
forall a. a -> a
id
  [(RunNodeCommonWithStatus s l t, Int)]
rest <- ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall {m :: * -> *} {a}. ReaderT Int m a -> ReaderT Int m a
context (ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
 -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b. (a -> b) -> a -> b
$ ([[(RunNodeCommonWithStatus s l t, Int)]]
-> [(RunNodeCommonWithStatus s l t, Int)]
forall a. Monoid a => [a] -> a
mconcat ([[(RunNodeCommonWithStatus s l t, Int)]]
 -> [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) (ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
 -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b. (a -> b) -> a -> b
$ [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
-> (RunNodeWithStatus (LabelValue lab intro :> context) s l t
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
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 RunNodeWithStatus (LabelValue lab intro :> context) s l t
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth'
  ReaderT Int Identity Int
forall (m :: * -> *) r. Monad m => ReaderT r m r
ask ReaderT Int Identity Int
-> (Int
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b.
ReaderT Int Identity a
-> (a -> ReaderT Int Identity b) -> ReaderT Int Identity b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a. a -> ReaderT Int Identity a
forall (m :: * -> *) a. Monad m => a -> m a
return ((RunNodeCommonWithStatus s l t
runNodeCommon, Int
vd) (RunNodeCommonWithStatus s l t, Int)
-> [(RunNodeCommonWithStatus s l t, Int)]
-> [(RunNodeCommonWithStatus s l t, Int)]
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 ()
runNodeCommon :: forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: ()
runNodeIntroduceAction :: ()
runNodeCommon :: RunNodeCommonWithStatus s l t
runNodeChildrenAugmented :: [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
runNodeIntroduceAction :: (intro -> ExampleT context IO [Result]) -> ExampleT context IO ()
..}) = do
  let context :: ReaderT Int m a -> ReaderT Int m a
context = if RunNodeCommonWithStatus s l t -> Bool
forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisible RunNodeCommonWithStatus s l t
runNodeCommon then ((Int -> Int) -> ReaderT Int m a -> ReaderT Int m a
forall r (m :: * -> *) a.
(r -> r) -> ReaderT r m a -> ReaderT r m a
local (Int -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)) else ReaderT Int m a -> ReaderT Int m a
forall a. a -> a
id
  [(RunNodeCommonWithStatus s l t, Int)]
rest <- ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall {m :: * -> *} {a}. ReaderT Int m a -> ReaderT Int m a
context (ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
 -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b. (a -> b) -> a -> b
$ ([[(RunNodeCommonWithStatus s l t, Int)]]
-> [(RunNodeCommonWithStatus s l t, Int)]
forall a. Monoid a => [a] -> a
mconcat ([[(RunNodeCommonWithStatus s l t, Int)]]
 -> [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) (ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
 -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b. (a -> b) -> a -> b
$ [RunNodeWithStatus (LabelValue lab intro :> context) s l t]
-> (RunNodeWithStatus (LabelValue lab intro :> context) s l t
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
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 RunNodeWithStatus (LabelValue lab intro :> context) s l t
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth'
  ReaderT Int Identity Int
forall (m :: * -> *) r. Monad m => ReaderT r m r
ask ReaderT Int Identity Int
-> (Int
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b.
ReaderT Int Identity a
-> (a -> ReaderT Int Identity b) -> ReaderT Int Identity b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a. a -> ReaderT Int Identity a
forall (m :: * -> *) a. Monad m => a -> m a
return ((RunNodeCommonWithStatus s l t
runNodeCommon, Int
vd) (RunNodeCommonWithStatus s l t, Int)
-> [(RunNodeCommonWithStatus s l t, Int)]
-> [(RunNodeCommonWithStatus s l t, Int)]
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 RunNodeCommonWithStatus s l t -> Bool
forall s l t. RunNodeCommonWithStatus s l t -> Bool
runTreeVisible (RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node) then ((Int -> Int) -> ReaderT Int m a -> ReaderT Int m a
forall r (m :: * -> *) a.
(r -> r) -> ReaderT r m a -> ReaderT r m a
local (Int -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)) else ReaderT Int m a -> ReaderT Int m a
forall a. a -> a
id
  [(RunNodeCommonWithStatus s l t, Int)]
rest <- ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall {m :: * -> *} {a}. ReaderT Int m a -> ReaderT Int m a
context (ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
 -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b. (a -> b) -> a -> b
$ ([[(RunNodeCommonWithStatus s l t, Int)]]
-> [(RunNodeCommonWithStatus s l t, Int)]
forall a. Monoid a => [a] -> a
mconcat ([[(RunNodeCommonWithStatus s l t, Int)]]
 -> [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) (ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
 -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b. (a -> b) -> a -> b
$ [RunNodeWithStatus context s l t]
-> (RunNodeWithStatus context s l t
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [[(RunNodeCommonWithStatus s l t, Int)]]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM (RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
forall s l t context.
RunNodeWithStatus context s l t
-> [RunNodeWithStatus context s l t]
runNodeChildren RunNodeWithStatus context s l t
node) RunNodeWithStatus context s l t
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall context s l t.
RunNodeWithStatus context s l t
-> Reader Int [(RunNodeCommonWithStatus s l t, Int)]
getCommonsWithVisibleDepth'
  ReaderT Int Identity Int
forall (m :: * -> *) r. Monad m => ReaderT r m r
ask ReaderT Int Identity Int
-> (Int
    -> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)])
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a b.
ReaderT Int Identity a
-> (a -> ReaderT Int Identity b) -> ReaderT Int Identity b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
vd -> [(RunNodeCommonWithStatus s l t, Int)]
-> ReaderT Int Identity [(RunNodeCommonWithStatus s l t, Int)]
forall a. a -> ReaderT Int Identity a
forall (m :: * -> *) a. Monad m => a -> m a
return ((RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
forall s l t context.
RunNodeWithStatus context s l t -> RunNodeCommonWithStatus s l t
runNodeCommon RunNodeWithStatus context s l t
node, Int
vd) (RunNodeCommonWithStatus s l t, Int)
-> [(RunNodeCommonWithStatus s l t, Int)]
-> [(RunNodeCommonWithStatus s l t, Int)]
forall a. a -> [a] -> [a]
: [(RunNodeCommonWithStatus s l t, Int)]
rest)