summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2023-07-09 10:59:35 +0200
committerTom Smeding <tom@tomsmeding.com>2023-07-09 10:59:35 +0200
commit2febe6dec2ae127e0022f2c78c56c19d03e2cadc (patch)
treeb0943dc2a28b055f441c8f8bb422c4230433097e
parent4e5590d148a7f2b517dce18c231b9d4cb0b1d19f (diff)
Fix deprecation warnings
-rw-r--r--src/System/IO/Terminal/Render.hs9
-rw-r--r--src/Utils/Time.hs6
-rw-r--r--terminal-io.cabal2
3 files changed, 3 insertions, 14 deletions
diff --git a/src/System/IO/Terminal/Render.hs b/src/System/IO/Terminal/Render.hs
index 6939c9f..86b5cb3 100644
--- a/src/System/IO/Terminal/Render.hs
+++ b/src/System/IO/Terminal/Render.hs
@@ -49,7 +49,6 @@ module System.IO.Terminal.Render
,module System.IO.Terminal.Characters)
where
-import Control.Concurrent
import Control.Monad.State.Strict
import Data.Array.IO
import Data.Colour.SRGB hiding (RGB)
@@ -131,12 +130,8 @@ withRender act = do
whenM (liftIO $ not <$> hIsTerminalDevice stdout) $
liftIO $ die "ERROR: Stdout is not connected to a terminal!"
- liftIO $ A.hSupportsANSIWithoutEmulation stdout >>= \case
- Just True -> return ()
- Just False -> die "ERROR: Terminal is not capable of interpreting ANSI escape sequences!"
- Nothing -> do
- hPutStrLn stderr "WARNING: Cannot determine terminal capabilities; continuing anyway..."
- threadDelay 1000000
+ liftIO $ whenM (not <$> A.hSupportsANSI stdout) $
+ die "ERROR: Terminal is not capable of interpreting ANSI escape sequences!"
liftIO IO.toAlternateScreen
liftIO A.clearScreen
diff --git a/src/Utils/Time.hs b/src/Utils/Time.hs
index 2139c53..8931afe 100644
--- a/src/Utils/Time.hs
+++ b/src/Utils/Time.hs
@@ -8,10 +8,8 @@ Portability : POSIX, macOS, Windows
-}
module Utils.Time where
-import Data.Time.Clock
import Data.Time.Clock.System hiding (getSystemTime)
import qualified Data.Time.Clock.System as Sys
-import Data.Time.Format
-- | A timestamp in milliseconds.
@@ -37,7 +35,3 @@ getSystemTime = TimeStamp . systemToMS <$> Sys.getSystemTime
where
systemToMS tm = let MkSystemTime s ns = truncateSystemTimeLeapSecond tm
in fromIntegral s * 1000 + fromIntegral ns `div` 1000000
-
--- | Show a UTCTime in ISO-8601 format.
-iso8601Show :: UTCTime -> String
-iso8601Show = formatTime defaultTimeLocale (iso8601DateFormat (Just "%H:%M:%S"))
diff --git a/terminal-io.cabal b/terminal-io.cabal
index 531dc9d..f4ce793 100644
--- a/terminal-io.cabal
+++ b/terminal-io.cabal
@@ -34,7 +34,7 @@ library
Utils.Time
build-depends:
base >= 4 && < 5,
- ansi-terminal,
+ ansi-terminal >= 1.0,
array,
colour,
containers,