An application needs to initialize shared state and start processes, but letting every process fork more threads can produce an uncontrolled number of them. AppL separates application orchestration from the logic run inside each process. section 9.1.3
AppL is a free-monadic language for initializing application state, declaring processes and their relationships, and managing configuration. It can run LangL scripts directly or fork them as processes. LangL holds the process logic—such as reading shared state, getting random values, and delaying—without an operation for forking child processes. AppL can contain domain logic, but keeping that logic in LangL preserves the separation. section 9.1.3
process :: LangL () -> AppL () process = forkProcess scenario :: LangL a -> AppL a scenario = evalLang app :: AppL () app = do ch <- evalLang (newVar []) process (forever (astronomer ch)) scenario (forever (trackingCenter ch))
In the application declaration, evalLang creates a shared variable, process forks an astronomer script, and scenario runs a tracking script. The scripts passed to process are LangL actions, not AppL actions. section 9.1.3
AppL also hosts broader initialization scenarios. A game-loading action can fetch a labyrinth and player position, create state variables, and return the resulting game state. Such actions can use throwException for domain-level failure and runSafely to return a failure as an Either value. section 15.2.3
White-box tests depend on the shape of an AppL action. Wrapping loading actions in runSafely moves their chains inside that operation, so mocks matched to the old sequence no longer reach the intended calls. The updated test uses a real runtime for selected operations and mocks the calls below them. section 15.2.3
