 ()
main = do
  args ← getArgs
  if length args == 0 then putStrLn "No file name specified" >> return ()
  else do
    let filename = head args
    file ← openFile filename ReadMode
    input ← hGetContents file
    case generateParser (encodeString $ basename $ decodeString filename) input of
      Left err → putStrLn err
      Right res → putStrLn res

main :: IO ()
main = do
  args ← getArgs
  if length args == 0 then putStrLn "No file name specified" >> return ()
  else do
    let filename = head args
    file ← openFile filename ReadMode
    input ← hGetContents file
    case generateParser (encodeString $ basename $ decodeString filename) input of
      Left err → putStrLn err
      Right res → putStrLn res
main = do
  args ← getArgs
  if length args == 0 then putStrLn "No file name specified" >> return ()
  else do
    let filename = head args
    file ← openFile filename ReadMode
    input ← hGetContents file
    case generateParser (encodeString $ basename $ decodeString filename) input of
      Left err → putStrLn err
      Right res → putStrLn res