From 83b14ed6edb6772df7c933df52c00b808bf2d993 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 6 Jan 2026 23:05:10 +0000 Subject: [PATCH] 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. --- haskell/Main.hs | 4 ++-- haskell/aoc.cabal | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/haskell/Main.hs b/haskell/Main.hs index bd3021d..d9c7ee2 100644 --- a/haskell/Main.hs +++ b/haskell/Main.hs @@ -16,11 +16,11 @@ import Puzzles.Day6 qualified as Day6 import Puzzles.Day7 qualified as Day7 import Puzzles.Day8 qualified as Day8 import Puzzles.Day9 qualified as Day9 -import System.Console.ANSI (getTerminalSize) +import System.Console.Terminal.Size qualified as Terminal.Size main :: IO () 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 putStrLn $ drawTree $ show <$> getTestTree tests TL.putStrLn . displayTestResultsConsole terminalWidth =<< runTests () tests diff --git a/haskell/aoc.cabal b/haskell/aoc.cabal index dd66f51..98838d3 100644 --- a/haskell/aoc.cabal +++ b/haskell/aoc.cabal @@ -68,6 +68,7 @@ executable aoc safe, stm, streams, + terminal-size, text, time, transformers,