main :: IO ()
main = do
    args <- getArgs
    let (actions, _, _) = getOpt RequireOrder options args
    opts <- foldl (>>=) (return startOptions) actions
    let Options { optInput = input
                , optRootNodes = mRootNodes } = opts

    plan <- pack <$> input

    case eitherDecode plan of
        Left msg  -> putStrLn msg >> exitFailure
        Right dag -> do
            let rs' = fromMaybe (rootNodes dag) mRootNodes
            putStr $ renderVSLDot M.empty rs' (nodeMap (dag :: AlgebraDag TVSL))
main :: IO ()
main = do
    args <- getArgs
    let (actions, _, _) = getOpt RequireOrder options args
    opts <- foldl (>>=) (return startOptions) actions
    let Options { optInput = input
                , optRootNodes = mRootNodes } = opts

    plan <- pack <$> input

    case eitherDecode plan of
        Left msg  -> putStrLn msg >> exitFailure
        Right dag -> do
            let rs' = fromMaybe (rootNodes dag) mRootNodes
            putStr $ renderVSLDot M.empty rs' (nodeMap (dag :: AlgebraDag TVSL))
main = do
    args <- getArgs
    let (actions, _, _) = getOpt RequireOrder options args
    opts <- foldl (>>=) (return startOptions) actions
    let Options { optInput = input
                , optRootNodes = mRootNodes } = opts

    plan <- pack <$> input

    case eitherDecode plan of
        Left msg  -> putStrLn msg >> exitFailure
        Right dag -> do
            let rs' = fromMaybe (rootNodes dag) mRootNodes
            putStr $ renderVSLDot M.empty rs' (nodeMap (dag :: AlgebraDag TVSL))