2020-02-15 11:21:55 +03:00
|
|
|
{-|
|
|
|
|
Terminal Driver
|
|
|
|
-}
|
|
|
|
module Urbit.Vere.Term.Render
|
2020-03-23 23:35:50 +03:00
|
|
|
( clearScreen
|
2020-02-19 19:01:51 +03:00
|
|
|
, clearLine
|
|
|
|
, cursorRight
|
|
|
|
, cursorLeft
|
|
|
|
, soundBell
|
2020-02-15 11:21:55 +03:00
|
|
|
) where
|
|
|
|
|
|
|
|
import ClassyPrelude
|
|
|
|
|
2020-03-23 23:35:50 +03:00
|
|
|
import qualified System.Console.ANSI as ANSI
|
2020-02-15 11:21:55 +03:00
|
|
|
|
|
|
|
|
2020-02-19 19:27:23 +03:00
|
|
|
-- Types -----------------------------------------------------------------------
|
2020-02-15 11:21:55 +03:00
|
|
|
|
2020-09-25 02:43:03 +03:00
|
|
|
clearScreen :: MonadIO m => m ()
|
2020-02-19 19:27:23 +03:00
|
|
|
clearScreen = liftIO $ ANSI.clearScreen
|
2020-02-19 19:01:51 +03:00
|
|
|
|
2020-09-25 02:43:03 +03:00
|
|
|
clearLine :: MonadIO m => m ()
|
2020-02-19 19:27:23 +03:00
|
|
|
clearLine = liftIO $ ANSI.clearLine
|
2020-02-19 19:01:51 +03:00
|
|
|
|
2020-09-25 02:43:03 +03:00
|
|
|
soundBell :: MonadIO m => m ()
|
2020-02-19 19:27:23 +03:00
|
|
|
soundBell = liftIO $ putStr "\a"
|
2020-02-19 19:01:51 +03:00
|
|
|
|
2020-09-25 02:43:03 +03:00
|
|
|
cursorLeft :: MonadIO m => Int -> m ()
|
2020-02-19 19:27:23 +03:00
|
|
|
cursorLeft = liftIO . ANSI.cursorBackward
|
2020-02-19 19:01:51 +03:00
|
|
|
|
2020-09-25 02:43:03 +03:00
|
|
|
cursorRight :: MonadIO m => Int -> m ()
|
2020-02-19 19:27:23 +03:00
|
|
|
cursorRight = liftIO . ANSI.cursorForward
|