Use terminal-size library

It still doesn't work yet in GHCID or GHCIWatch, but it seems more likely to, and it runs a lot faster.
This commit is contained in:
George Thomas 2026-01-06 23:05:10 +00:00
parent 98acc016a6
commit 83b14ed6ed
2 changed files with 3 additions and 2 deletions

View File

@ -16,11 +16,11 @@ import Puzzles.Day6 qualified as Day6
import Puzzles.Day7 qualified as Day7 import Puzzles.Day7 qualified as Day7
import Puzzles.Day8 qualified as Day8 import Puzzles.Day8 qualified as Day8
import Puzzles.Day9 qualified as Day9 import Puzzles.Day9 qualified as Day9
import System.Console.ANSI (getTerminalSize) import System.Console.Terminal.Size qualified as Terminal.Size
main :: IO () main :: IO ()
main = do main = do
-- terminalWidth <- fmap snd <$> getTerminalSize -- TODO this doesn't work in GHCID or GHCIWatch... -- terminalWidth <- fmap Terminal.Size.width <$> Terminal.Size.size -- TODO this doesn't work in GHCID or GHCIWatch...
terminalWidth <- pure $ Just 60 terminalWidth <- pure $ Just 60
putStrLn $ drawTree $ show <$> getTestTree tests putStrLn $ drawTree $ show <$> getTestTree tests
TL.putStrLn . displayTestResultsConsole terminalWidth =<< runTests () tests TL.putStrLn . displayTestResultsConsole terminalWidth =<< runTests () tests

View File

@ -68,6 +68,7 @@ executable aoc
safe, safe,
stm, stm,
streams, streams,
terminal-size,
text, text,
time, time,
transformers, transformers,