on master help sign in
Clean up warnings when compiling on 7.10
8217bd7Eric Mertens
src/Data/Terminfo/Eval.hs+11−2
@@ -1,7 +1,13 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE NoMonomorphismRestriction #-}
3{-# LANGUAGE NoMonomorphismRestriction #-}
3{-# OPTIONS_GHC -funbox-strict-fields #-}
4{-# OPTIONS_GHC -funbox-strict-fields #-}
4{-# OPTIONS_HADDOCK hide #-}
5{-# OPTIONS_HADDOCK hide #-}
6+
7+#ifndef MIN_VERSION_base
8+#defined MIN_VERSION_base(x,y,z) 1
9+#endif
10+
5{- Evaluates the paramaterized terminfo string capability with the given parameters.
11{- Evaluates the paramaterized terminfo string capability with the given parameters.
6 -
12 -
7 -}
13 -}
@@ -17,11 +23,14 @@ import Control.Monad.State.Strict
17import Control.Monad.Writer
23import Control.Monad.Writer
18
24
19import Data.Bits ((.|.), (.&.), xor)
25import Data.Bits ((.|.), (.&.), xor)
20−import Data.List
26+import Data.List
21−import Data.Word
22
27
23import qualified Data.Vector.Unboxed as Vector
28import qualified Data.Vector.Unboxed as Vector
24
29
30+#if !(MIN_VERSION_base(4,8,0))
31+import Data.Word
32+#endif
33+
25-- | capability evaluator state
34-- | capability evaluator state
26data EvalState = EvalState
35data EvalState = EvalState
27 { evalStack :: ![CapParam]
36 { evalStack :: ![CapParam]
src/Data/Terminfo/Parse.hs+10−1
@@ -1,8 +1,14 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE BangPatterns #-}
2{-# OPTIONS_HADDOCK hide #-}
3{-# OPTIONS_HADDOCK hide #-}
3{-# LANGUAGE NoMonomorphismRestriction #-}
4{-# LANGUAGE NoMonomorphismRestriction #-}
4{-# LANGUAGE NamedFieldPuns #-}
5{-# LANGUAGE NamedFieldPuns #-}
5{-# OPTIONS_GHC -funbox-strict-fields -O #-}
6{-# OPTIONS_GHC -funbox-strict-fields -O #-}
7+
8+#ifndef MIN_VERSION_base
9+#defined MIN_VERSION_base(x,y,z) 1
10+#endif
11+
6module Data.Terminfo.Parse ( module Data.Terminfo.Parse
12module Data.Terminfo.Parse ( module Data.Terminfo.Parse
7 , Text.Parsec.ParseError
13 , Text.Parsec.ParseError
8 )
14 )
@@ -11,7 +17,6 @@ module Data.Terminfo.Parse ( module Data.Terminfo.Parse
11import Control.Monad ( liftM )
17import Control.Monad ( liftM )
12import Control.DeepSeq
18import Control.DeepSeq
13
19
14−import Data.Monoid
15import Data.Word
20import Data.Word
16import qualified Data.Vector.Unboxed as Vector
21import qualified Data.Vector.Unboxed as Vector
17
22
@@ -19,6 +24,10 @@ import Numeric (showHex)
19
24
20import Text.Parsec
25import Text.Parsec
21
26
27+#if !(MIN_VERSION_base(4,8,0))
28+import Data.Monoid
29+#endif
30+
22data CapExpression = CapExpression
31data CapExpression = CapExpression
23 { capOps :: !CapOps
32 { capOps :: !CapOps
24 , capBytes :: !(Vector.Vector Word8)
33 , capBytes :: !(Vector.Vector Word8)
src/Graphics/Vty/Attributes.hs+10−1
@@ -1,6 +1,12 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE StandaloneDeriving #-}
2{-# LANGUAGE StandaloneDeriving #-}
2{-# LANGUAGE GADTs #-}
3{-# LANGUAGE GADTs #-}
3{-# LANGUAGE RankNTypes #-}
4{-# LANGUAGE RankNTypes #-}
5+
6+#ifndef MIN_VERSION_base
7+#defined MIN_VERSION_base(x,y,z) 1
8+#endif
9+
4-- | Display attributes
10-- | Display attributes
5--
11--
6-- Typically the values 'defAttr' or 'currentAttr' are modified to form attributes:
12-- Typically the values 'defAttr' or 'currentAttr' are modified to form attributes:
@@ -33,12 +39,15 @@ module Graphics.Vty.Attributes ( module Graphics.Vty.Attributes
33
39
34import Data.Bits
40import Data.Bits
35import Data.Default
41import Data.Default
36−import Data.Monoid
37import Data.Word
42import Data.Word
38
43
39import Graphics.Vty.Attributes.Color
44import Graphics.Vty.Attributes.Color
40import Graphics.Vty.Attributes.Color240
45import Graphics.Vty.Attributes.Color240
41
46
47+#if !(MIN_VERSION_base(4,8,0))
48+import Data.Monoid
49+#endif
50+
42-- | A display attribute defines the Color and Style of all the characters rendered after the
51-- | A display attribute defines the Color and Style of all the characters rendered after the
43-- attribute is applied.
52-- attribute is applied.
44--
53--
src/Graphics/Vty/DisplayAttributes.hs+9
@@ -1,12 +1,21 @@
1-- Copyright 2009-2010 Corey O'Connor
1-- Copyright 2009-2010 Corey O'Connor
2+{-# LANGUAGE CPP #-}
2{-# LANGUAGE BangPatterns #-}
3{-# LANGUAGE BangPatterns #-}
4+
5+#ifndef MIN_VERSION_base
6+#defined MIN_VERSION_base(x,y,z) 1
7+#endif
8+
3module Graphics.Vty.DisplayAttributes
9module Graphics.Vty.DisplayAttributes
4 where
10 where
5
11
6import Graphics.Vty.Attributes
12import Graphics.Vty.Attributes
7
13
8import Data.Bits ((.&.))
14import Data.Bits ((.&.))
15+
16+#if !(MIN_VERSION_base(4,8,0))
9import Data.Monoid (Monoid(..), mconcat)
17import Data.Monoid (Monoid(..), mconcat)
18+#endif
10
19
11-- | Given the previously applied display attributes as a FixedAttr and the current display
20-- | Given the previously applied display attributes as a FixedAttr and the current display
12-- attributes as an Attr produces a FixedAttr that represents the current display attributes. This
21-- attributes as an Attr produces a FixedAttr that represents the current display attributes. This
src/Graphics/Vty/Image/Internal.hs+10−1
@@ -1,5 +1,11 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE NamedFieldPuns #-}
2{-# LANGUAGE NamedFieldPuns #-}
2{-# OPTIONS_HADDOCK hide #-}
3{-# OPTIONS_HADDOCK hide #-}
4+
5+#ifndef MIN_VERSION_base
6+#defined MIN_VERSION_base(x,y,z) 1
7+#endif
8+
3module Graphics.Vty.Image.Internal where
9module Graphics.Vty.Image.Internal where
4
10
5import Graphics.Vty.Attributes
11import Graphics.Vty.Attributes
@@ -7,9 +13,12 @@ import Graphics.Text.Width
7
13
8import Control.DeepSeq
14import Control.DeepSeq
9
15
10−import Data.Monoid
11import qualified Data.Text.Lazy as TL
16import qualified Data.Text.Lazy as TL
12
17
18+#if !(MIN_VERSION_base(4,8,0))
19+import Data.Monoid
20+#endif
21+
13-- | A display text is a Data.Text.Lazy
22-- | A display text is a Data.Text.Lazy
14--
23--
15-- TODO(corey): hm. there is an explicit equation for each type which goes to a lazy text. Each
24-- TODO(corey): hm. there is an explicit equation for each type which goes to a lazy text. Each
src/Graphics/Vty/Inline.hs+11−2
@@ -24,7 +24,13 @@
24-- 'putAttrChange'
24-- 'putAttrChange'
25--
25--
26-- Copyright 2009-2010 Corey O'Connor
26-- Copyright 2009-2010 Corey O'Connor
27+{-# LANGUAGE CPP #-}
27{-# LANGUAGE BangPatterns #-}
28{-# LANGUAGE BangPatterns #-}
29+
30+#ifndef MIN_VERSION_base
31+#defined MIN_VERSION_base(x,y,z) 1
32+#endif
33+
28module Graphics.Vty.Inline ( module Graphics.Vty.Inline
34module Graphics.Vty.Inline ( module Graphics.Vty.Inline
29 , withVty
35 , withVty
30 )
36 )
@@ -37,15 +43,18 @@ import Graphics.Vty.Output.Interface
37
43
38import Blaze.ByteString.Builder (writeToByteString)
44import Blaze.ByteString.Builder (writeToByteString)
39
45
40−import Control.Applicative
41import Control.Monad.State.Strict
46import Control.Monad.State.Strict
42
47
43import Data.Bits ( (.&.), complement )
48import Data.Bits ( (.&.), complement )
44import Data.IORef
49import Data.IORef
45−import Data.Monoid ( mappend )
46
50
47import System.IO
51import System.IO
48
52
53+#if !(MIN_VERSION_base(4,8,0))
54+import Control.Applicative
55+import Data.Monoid ( mappend )
56+#endif
57+
49type InlineM v = State Attr v
58type InlineM v = State Attr v
50
59
51-- | Set the background color to the provided 'Color'
60-- | Set the background color to the provided 'Color'
src/Graphics/Vty/Inline/Unsafe.hs+9−2
@@ -1,11 +1,14 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2{-# OPTIONS_HADDOCK hide #-}
2{-# OPTIONS_HADDOCK hide #-}
3+
4+#ifndef MIN_VERSION_base
5+#defined MIN_VERSION_base(x,y,z) 1
6+#endif
7+
3module Graphics.Vty.Inline.Unsafe where
8module Graphics.Vty.Inline.Unsafe where
4
9
5import Graphics.Vty
10import Graphics.Vty
6
11
7−import Control.Applicative
8−
9import Data.Default
12import Data.Default
10import Data.Monoid
13import Data.Monoid
11import Data.IORef
14import Data.IORef
@@ -18,6 +21,10 @@ import System.IO.Unsafe
18
21
19import System.Posix.IO (handleToFd)
22import System.Posix.IO (handleToFd)
20
23
24+#if !(MIN_VERSION_base(4,8,0))
25+import Control.Applicative
26+#endif
27+
21globalVty :: IORef (Maybe Vty)
28globalVty :: IORef (Maybe Vty)
22{-# NOINLINE globalVty #-}
29{-# NOINLINE globalVty #-}
23globalVty = unsafePerformIO $ newIORef Nothing
30globalVty = unsafePerformIO $ newIORef Nothing
src/Graphics/Vty/Input.hs+11−3
@@ -1,4 +1,10 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
3+
4+#ifndef MIN_VERSION_base
5+#defined MIN_VERSION_base(x,y,z) 1
6+#endif
7+
2-- | The input layer for VTY. This provides methods for initializing an 'Input' structure which can
8-- | The input layer for VTY. This provides methods for initializing an 'Input' structure which can
3-- then be used to read 'Event's from the terminal.
9-- then be used to read 'Event's from the terminal.
4--
10--
@@ -133,12 +139,14 @@ import Graphics.Vty.Input.Terminfo
133import Control.Concurrent
139import Control.Concurrent
134import Control.Lens
140import Control.Lens
135
141
136−import Data.Functor ((<$>))
137−import Data.Monoid
138−
139import qualified System.Console.Terminfo as Terminfo
142import qualified System.Console.Terminfo as Terminfo
140import System.Posix.Signals.Exts
143import System.Posix.Signals.Exts
141
144
145+#if !(MIN_VERSION_base(4,8,0))
146+import Data.Functor ((<$>))
147+import Data.Monoid
148+#endif
149+
142-- | Set up the terminal with file descriptor `inputFd` for input. Returns a 'Input'.
150-- | Set up the terminal with file descriptor `inputFd` for input. Returns a 'Input'.
143--
151--
144-- The table used to determine the 'Events' to produce for the input bytes comes from
152-- The table used to determine the 'Events' to produce for the input bytes comes from
src/Graphics/Vty/Output.hs+9−2
@@ -1,5 +1,11 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE RecordWildCards #-}
2{-# LANGUAGE NamedFieldPuns #-}
3{-# LANGUAGE NamedFieldPuns #-}
4+
5+#ifndef MIN_VERSION_base
6+#defined MIN_VERSION_base(x,y,z) 1
7+#endif
8+
3-- | Output interface.
9-- | Output interface.
4--
10--
5-- Access to the current terminal or a specific terminal device.
11-- Access to the current terminal or a specific terminal device.
@@ -40,10 +46,11 @@ import Blaze.ByteString.Builder (writeToByteString)
40
46
41import Control.Monad.Trans
47import Control.Monad.Trans
42
48
43−import Data.Monoid (mappend)
44import Data.List (isPrefixOf)
49import Data.List (isPrefixOf)
45
50
46−import System.Posix.Env (getEnv)
51+#if !(MIN_VERSION_base(4,8,0))
52+import Data.Monoid (mappend)
53+#endif
47
54
48-- | Returns a `Output` for the terminal specified in `Config`
55-- | Returns a `Output` for the terminal specified in `Config`
49--
56--
src/Graphics/Vty/Output/Interface.hs+15−6
@@ -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 CPP #-}
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 #-}
9+
10+#ifndef MIN_VERSION_base
11+#defined MIN_VERSION_base(x,y,z) 1
12+#endif
13+
8module Graphics.Vty.Output.Interface
14module Graphics.Vty.Output.Interface
9where
15where
10
16
@@ -23,15 +29,18 @@ import Control.Monad.Trans
23
29
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
30
35
36+#if !(MIN_VERSION_base(4,8,0))
37+import Data.Monoid (mempty, mappend)
38+#endif
39+
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.
36 --
45 --
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
46 --
55 --
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
66 }
75 }
67
76
68displayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
77displayContext :: MonadIO m => Output -> DisplayRegion -> m DisplayContext
src/Graphics/Vty/Output/TerminfoBased.hs+10−2
@@ -3,6 +3,11 @@
3{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# OPTIONS_GHC -D_XOPEN_SOURCE=500 -fno-warn-warnings-deprecations #-}
4{-# OPTIONS_GHC -D_XOPEN_SOURCE=500 -fno-warn-warnings-deprecations #-}
5{-# CFILES gwinsz.c #-}
5{-# CFILES gwinsz.c #-}
6+
7+#ifndef MIN_VERSION_base
8+#defined MIN_VERSION_base(x,y,z) 1
9+#endif
10+
6-- | Terminfo based terminal handling.
11-- | Terminfo based terminal handling.
7--
12--
8-- The color handling assumes tektronix like. No HP support provided. If the terminal is not one I
13-- The color handling assumes tektronix like. No HP support provided. If the terminal is not one I
@@ -28,10 +33,8 @@ import Blaze.ByteString.Builder (Write, writeToByteString)
28import Control.Monad.Trans
33import Control.Monad.Trans
29
34
30import Data.Bits ((.&.))
35import Data.Bits ((.&.))
31−import Data.Foldable (foldMap)
32import Data.IORef
36import Data.IORef
33import Data.Maybe (isJust, isNothing, fromJust)
37import Data.Maybe (isJust, isNothing, fromJust)
34−import Data.Monoid
35import Data.Word
38import Data.Word
36
39
37import Foreign.C.Types ( CInt(..), CLong(..) )
40import Foreign.C.Types ( CInt(..), CLong(..) )
@@ -42,6 +45,11 @@ import qualified System.Console.Terminfo as Terminfo
42import System.Posix.IO (fdWriteBuf)
45import System.Posix.IO (fdWriteBuf)
43import System.Posix.Types (Fd(..))
46import System.Posix.Types (Fd(..))
44
47
48+#if !(MIN_VERSION_base(4,8,0))
49+import Data.Foldable (foldMap)
50+import Data.Monoid
51+#endif
52+
45data TerminfoCaps = TerminfoCaps
53data TerminfoCaps = TerminfoCaps
46 { smcup :: Maybe CapExpression
54 { smcup :: Maybe CapExpression
47 , rmcup :: Maybe CapExpression
55 , rmcup :: Maybe CapExpression
src/Graphics/Vty/Output/XTermColor.hs+11−3
@@ -1,3 +1,9 @@
1+{-# LANGUAGE CPP #-}
2+
3+#ifndef MIN_VERSION_base
4+#defined MIN_VERSION_base(x,y,z) 1
5+#endif
6+
1-- Copyright 2009-2010 Corey O'Connor
7-- Copyright 2009-2010 Corey O'Connor
2module Graphics.Vty.Output.XTermColor ( reserveTerminal )
8module Graphics.Vty.Output.XTermColor ( reserveTerminal )
3 where
9 where
@@ -8,15 +14,17 @@ import qualified Graphics.Vty.Output.TerminfoBased as TerminfoBased
8import Blaze.ByteString.Builder (writeToByteString)
14import Blaze.ByteString.Builder (writeToByteString)
9import Blaze.ByteString.Builder.Word (writeWord8)
15import Blaze.ByteString.Builder.Word (writeWord8)
10
16
11−import Control.Applicative
12import Control.Monad (void)
17import Control.Monad (void)
13import Control.Monad.Trans
18import Control.Monad.Trans
14
19
15−import Data.Foldable (foldMap)
16−
17import System.Posix.IO (fdWrite)
20import System.Posix.IO (fdWrite)
18import System.Posix.Types (Fd)
21import System.Posix.Types (Fd)
19
22
23+#if !(MIN_VERSION_base(4,8,0))
24+import Control.Applicative
25+import Data.Foldable (foldMap)
26+#endif
27+
20-- | Initialize the display to UTF-8.
28-- | Initialize the display to UTF-8.
21reserveTerminal :: ( Applicative m, MonadIO m ) => String -> Fd -> m Output
29reserveTerminal :: ( Applicative m, MonadIO m ) => String -> Fd -> m Output
22reserveTerminal variant outFd = liftIO $ do
30reserveTerminal variant outFd = liftIO $ do
src/Graphics/Vty/PictureToSpans.hs+9−1
@@ -5,6 +5,11 @@
5{-# LANGUAGE NamedFieldPuns #-}
5{-# LANGUAGE NamedFieldPuns #-}
6{-# LANGUAGE RankNTypes #-}
6{-# LANGUAGE RankNTypes #-}
7{-# LANGUAGE TemplateHaskell #-}
7{-# LANGUAGE TemplateHaskell #-}
8+
9+#ifndef MIN_VERSION_base
10+#defined MIN_VERSION_base(x,y,z) 1
11+#endif
12+
8{- | Transforms an image into rows of operations.
13{- | Transforms an image into rows of operations.
9 -}
14 -}
10module Graphics.Vty.PictureToSpans where
15module Graphics.Vty.PictureToSpans where
@@ -27,12 +32,15 @@ import Control.Monad.ST.Strict
27#endif
32#endif
28
33
29import qualified Data.Vector as Vector hiding ( take, replicate )
34import qualified Data.Vector as Vector hiding ( take, replicate )
30−import Data.Monoid (mappend)
31import Data.Vector.Mutable ( MVector(..))
35import Data.Vector.Mutable ( MVector(..))
32import qualified Data.Vector.Mutable as MVector
36import qualified Data.Vector.Mutable as MVector
33
37
34import qualified Data.Text.Lazy as TL
38import qualified Data.Text.Lazy as TL
35
39
40+#if !(MIN_VERSION_base(4,8,0))
41+import Data.Monoid (mappend)
42+#endif
43+
36type MRowOps s = MVector s SpanOps
44type MRowOps s = MVector s SpanOps
37
45
38type MSpanOps s = MVector s SpanOp
46type MSpanOps s = MVector s SpanOp