@@ -38,6 +38,7 @@ import Graphics.Vty.Output.TerminfoBased as TerminfoBased
39import Blaze.ByteString.Builder (writeToByteString)
39import Blaze.ByteString.Builder (writeToByteString)
41+import Control.Monad.Fail (MonadFail)
41import Control.Monad.Trans
42import Control.Monad.Trans
43import Data.List (isPrefixOf)
44import Data.List (isPrefixOf)
@@ -84,7 +85,7 @@ outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig
84-- Currently, the only way to set the cursor position to a given
85-- Currently, the only way to set the cursor position to a given
85-- character coordinate is to specify the coordinate in the Picture
86-- character coordinate is to specify the coordinate in the Picture
86-- instance provided to 'outputPicture' or 'refresh'.
87-- instance provided to 'outputPicture' or 'refresh'.
87−setCursorPos :: MonadIO m => Output -> Int -> Int -> m ()
88+setCursorPos :: (MonadIO m, MonadFail m) => Output -> Int -> Int -> m ()
88setCursorPos t x y = do
89setCursorPos t x y = do
89 bounds <- displayBounds t
90 bounds <- displayBounds t
90 when (x >= 0 && x < regionWidth bounds && y >= 0 && y < regionHeight bounds) $ do
91 when (x >= 0 && x < regionWidth bounds && y >= 0 && y < regionHeight bounds) $ do
@@ -92,14 +93,14 @@ setCursorPos t x y = do
92 liftIO $ outputByteBuffer t $ writeToByteString $ writeMoveCursor dc x y
93 liftIO $ outputByteBuffer t $ writeToByteString $ writeMoveCursor dc x y
94-- | Hides the cursor.
95-- | Hides the cursor.
95−hideCursor :: MonadIO m => Output -> m ()
96+hideCursor :: (MonadIO m, MonadFail m) => Output -> m ()
96hideCursor t = do
97hideCursor t = do
97 bounds <- displayBounds t
98 bounds <- displayBounds t
98 dc <- displayContext t bounds
99 dc <- displayContext t bounds
99 liftIO $ outputByteBuffer t $ writeToByteString $ writeHideCursor dc
100 liftIO $ outputByteBuffer t $ writeToByteString $ writeHideCursor dc
101-- | Shows the cursor.
102-- | Shows the cursor.
102−showCursor :: MonadIO m => Output -> m ()
103+showCursor :: (MonadIO m, MonadFail m) => Output -> m ()
103showCursor t = do
104showCursor t = do
104 bounds <- displayBounds t
105 bounds <- displayBounds t
105 dc <- displayContext t bounds
106 dc <- displayContext t bounds