@@ -1,10 +1,16 @@
1-- Copyright Corey O'Connor
1-- Copyright Corey O'Connor
2-- General philosophy is: MonadIO is for equations exposed to clients.
2-- General philosophy is: MonadIO is for equations exposed to clients.
3{-# LANGUAGE BangPatterns #-}
4{-# LANGUAGE BangPatterns #-}
4{-# LANGUAGE RankNTypes #-}
5{-# LANGUAGE RankNTypes #-}
5{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE GADTs #-}
7{-# LANGUAGE GADTs #-}
7{-# LANGUAGE FlexibleContexts #-}
8{-# LANGUAGE FlexibleContexts #-}
10+#ifndef MIN_VERSION_base
11+#defined MIN_VERSION_base(x,y,z) 1
8module Graphics.Vty.Output.Interface
14module Graphics.Vty.Output.Interface
@@ -23,15 +29,18 @@ import Control.Monad.Trans
24import qualified Data.ByteString as BS
30import qualified Data.ByteString as BS
25import Data.IORef
31import Data.IORef
26−import Data.Monoid (mempty, mappend)
27import qualified Data.Text.Encoding as T
32import qualified Data.Text.Encoding as T
28import qualified Data.Text.Lazy as TL
33import qualified Data.Text.Lazy as TL
29import qualified Data.Vector as Vector
34import qualified Data.Vector as Vector
36+#if !(MIN_VERSION_base(4,8,0))
37+import Data.Monoid (mempty, mappend)
31data Output = Output
40data Output = Output
32 { -- | Text identifier for the output device. Used for debugging.
41 { -- | Text identifier for the output device. Used for debugging.
33 terminalID :: String
42 terminalID :: String
34− , releaseTerminal :: MonadIO m => m ()
43+ , releaseTerminal :: forall m. MonadIO m => m ()
35 -- | Clear the display and initialize the terminal to some initial display state.
44 -- | Clear the display and initialize the terminal to some initial display state.
37 -- The expectation of a program is that the display starts in some initial state.
46 -- The expectation of a program is that the display starts in some initial state.
@@ -46,12 +55,12 @@ data Output = Output
47 -- - The previous state cannot be determined
56 -- - The previous state cannot be determined
48 -- - When exclusive access to a display is released the display returns to the previous state.
57 -- - When exclusive access to a display is released the display returns to the previous state.
49− , reserveDisplay :: MonadIO m => m ()
58+ , reserveDisplay :: forall m. MonadIO m => m ()
50 -- | Return the display to the state before `reserveDisplay`
59 -- | Return the display to the state before `reserveDisplay`
51 -- If no previous state then set the display state to the initial state.
60 -- If no previous state then set the display state to the initial state.
52− , releaseDisplay :: MonadIO m => m ()
61+ , releaseDisplay :: forall m. MonadIO m => m ()
53 -- | Returns the current display bounds.
62 -- | Returns the current display bounds.
54− , displayBounds :: MonadIO m => m DisplayRegion
63+ , displayBounds :: forall m. MonadIO m => m DisplayRegion
55 -- | Output the byte string to the terminal device.
64 -- | Output the byte string to the terminal device.
56 , outputByteBuffer :: BS.ByteString -> IO ()
65 , outputByteBuffer :: BS.ByteString -> IO ()
57 -- | Maximum number of colors supported by the context.
66 -- | Maximum number of colors supported by the context.
@@ -62,7 +71,7 @@ data Output = Output
62 -- | Acquire display access to the given region of the display.
71 -- | Acquire display access to the given region of the display.
63 -- Currently all regions have the upper left corner of (0,0) and the lower right corner at
72 -- Currently all regions have the upper left corner of (0,0) and the lower right corner at
64 -- (max displayWidth providedWidth, max displayHeight providedHeight)
73 -- (max displayWidth providedWidth, max displayHeight providedHeight)
65− , mkDisplayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
74+ , mkDisplayContext :: forall m. MonadIO m => Output -> DisplayRegion -> m DisplayContext
68displayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
77displayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext