fragr-0.1.0.0: app/Main.hs
{-|
Demo entry point.
Builds the example frame graph, then per the chosen subcommand dumps it as
Graphviz DOT, dumps it as viewer JSON, or executes two frames against one
staging pool, rebuilding the graph each frame.
-}
module Main (main) where
import Data.Foldable (for_)
import Data.Text.IO qualified as Text.IO
import Fragr qualified as FG
import Fragr.Snapshot.Dot qualified as Dot
import Fragr.Snapshot.JSON qualified as Json
import App.Demo (buildDemo, newStagingPool)
import App.Options (Command (..), parseCommand)
main :: IO ()
main = do
cmd <- parseCommand
case cmd of
Dot opts -> buildDemo >>= Dot.dumpWith opts >>= Text.IO.putStrLn
Json -> buildDemo >>= Json.dump >>= Text.IO.putStrLn
Execute -> do
pool <- newStagingPool
for_ [1 :: Int, 2] \frame -> do
putStrLn ("frame " <> show frame <> ":")
g <- buildDemo
FG.execute g () pool