module Data.TestGraph

import Prelude
import Data.Graph
import Node

main : IO Unit
main = do
  let (_ :: fn :: Nil) = getArgs | args => putStrLn "bad args \{show args}"
  (Right text) <- readFile fn | Left err => putStrLn "Can't read \{fn}: \{show err}"
  let graph = mapMaybe readLine $ split text "\n"
  debugLog graph
  let result = tarjan graph
  debugLog result
  where
    readLine : String → Maybe (String × List String)
    readLine line = case split line " " of
      ("" :: _) => Nothing
      (x :: rest) => Just (x, rest)
      _ => Nothing
