main :: IO ()
main = do
  args <- getArgs
  if length args < 2 then
    putStrLn "Usage: crossword-helper $CROSS_FILE $OUTPUT_PREFIX"
  else do
    let [filePath, outputName] = args
    rawData <- readFile filePath
    let blankCrossword = constructCrossword (splitOn "\n" rawData)
    filledCrossword <- fillAll blankCrossword
    let puzzleFile = (outputName ++ ".tex")
    let solutionFile = (outputName ++ "-solution.tex")

    writeFile puzzleFile (latexUnsolved filledCrossword)
    writeFile solutionFile (latexSolution filledCrossword)

    void $ system $ "open " <> puzzleFile
    void $ system $ "open " <> solutionFile
main :: IO ()
main = do
  args <- getArgs
  if length args < 2 then
    putStrLn "Usage: crossword-helper $CROSS_FILE $OUTPUT_PREFIX"
  else do
    let [filePath, outputName] = args
    rawData <- readFile filePath
    let blankCrossword = constructCrossword (splitOn "\n" rawData)
    filledCrossword <- fillAll blankCrossword
    let puzzleFile = (outputName ++ ".tex")
    let solutionFile = (outputName ++ "-solution.tex")

    writeFile puzzleFile (latexUnsolved filledCrossword)
    writeFile solutionFile (latexSolution filledCrossword)

    void $ system $ "open " <> puzzleFile
    void $ system $ "open " <> solutionFile
main = do
  args <- getArgs
  if length args < 2 then
    putStrLn "Usage: crossword-helper $CROSS_FILE $OUTPUT_PREFIX"
  else do
    let [filePath, outputName] = args
    rawData <- readFile filePath
    let blankCrossword = constructCrossword (splitOn "\n" rawData)
    filledCrossword <- fillAll blankCrossword
    let puzzleFile = (outputName ++ ".tex")
    let solutionFile = (outputName ++ "-solution.tex")

    writeFile puzzleFile (latexUnsolved filledCrossword)
    writeFile solutionFile (latexSolution filledCrossword)

    void $ system $ "open " <> puzzleFile
    void $ system $ "open " <> solutionFile