on master help sign in
cleanup a lot of warnings

Ignore-this: 2dc83fbcd2f197098d4c2e43a1411307 darcs-hash:20100905183826-f0a0d-a406de32e9bca359d303a6c67ffa2b32b09eceb1.gz

commit033acfa8b17dcf31b054e5bd210ebe865eaa9f45 authorcoreyoconnor <coreyoconnor@gmail.com> dateSun 5 Sep 2010, 11:38 (16 years ago) parentdd0b3f0
12 files changed+38−41
src/Data/Marshalling.hs−1 src/Data/Terminfo/Eval.hs+2−9 src/Data/Terminfo/Parse.hs+22−10 src/Graphics/Vty.hs−3 src/Graphics/Vty/DisplayAttributes.hs+1 src/Graphics/Vty/Image.hs+2−1 src/Graphics/Vty/Inline.hs−1 src/Graphics/Vty/LLInput.hs+6−7 src/Graphics/Vty/Span.hs+1−3 src/Graphics/Vty/Terminal.hs−1 src/Graphics/Vty/Terminal/Generic.hs−1 src/Graphics/Vty/Terminal/TerminfoBased.hs+4−4
src/Data/Marshalling.hs−1
@@ -16,7 +16,6 @@ import Data.Word
1616import Foreign.Ptr
1717import Foreign.ForeignPtr
1818import Foreign.Marshal
19−import Foreign.Marshal.Array
2019import Foreign.Storable
2120
2221type OutputBuffer = Ptr Word8
src/Data/Terminfo/Eval.hs+2−9
@@ -19,20 +19,13 @@ import Data.ByteString.Internal ( memcpy )
1919import Data.Marshalling
2020import Data.Terminfo.Parse
2121
22−import Control.DeepSeq
2322import Control.Monad.Identity
2423import Control.Monad.State.Strict
25−import Control.Monad.Trans
2624
27−import Data.Array.Unboxed
2825import Data.Bits ( (.|.), (.&.), xor )
2926import Data.List
3027
31−import Foreign.C.Types
32−import Foreign.Ptr
33−
3428import GHC.Prim
35−import GHC.Types
3629import GHC.Word
3730
3831data EvalState = EvalState
@@ -56,7 +49,7 @@ pop = do
5649{-# SPECIALIZE read_param :: Word -> EvalT IO CapParam #-}
5750read_param :: Monad m => Word -> EvalT m CapParam
5851read_param pn = do
59− EvalState _ _ !params <- get
52+ !params <- get >>= return . eval_params
6053 return $! genericIndex params pn
6154
6255{-# SPECIALIZE push :: CapParam -> EvalT IO () #-}
@@ -169,7 +162,7 @@ serialize_cap_ops out_ptr ops = foldM serialize_cap_op out_ptr ops
169162
170163serialize_cap_op :: OutputBuffer -> CapOp -> EvalT IO OutputBuffer
171164serialize_cap_op !out_ptr ( Bytes !offset !byte_count !next_offset ) = do
172− EvalState _ !cap _ <- get
165+ !cap <- get >>= return . eval_expression
173166 let ( !start_ptr, _ ) = cap_bytes cap
174167 !src_ptr = start_ptr `plusPtr` offset
175168 !out_ptr' = out_ptr `plusPtr` next_offset
src/Data/Terminfo/Parse.hs+22−10
@@ -12,9 +12,8 @@ module Data.Terminfo.Parse ( module Data.Terminfo.Parse
1212import Control.Applicative ( Applicative(..), pure, (<*>) )
1313import Control.Monad ( liftM )
1414import Control.Monad.Trans
15−import Control.Parallel.Strategies
15+import Control.DeepSeq
1616
17−import Data.Array.Unboxed
1817import Data.Monoid
1918import Data.Word
2019
@@ -35,8 +34,8 @@ data CapExpression = CapExpression
3534 }
3635
3736instance NFData CapExpression where
38− rnf (CapExpression ops !_bytes !_str !_c !_p_ops)
39− = rnf ops
37+ rnf (CapExpression ops !_bytes !str !c !p_ops)
38+ = rnf ops `seq` rnf str `seq` rnf c `seq` rnf p_ops
4039
4140type CapParam = Word
4241
@@ -59,17 +58,29 @@ data CapOp =
5958 deriving ( Show )
6059
6160instance NFData CapOp where
62− rnf ( Bytes offset count next_offset ) = rnf offset
63− rnf (PushParam !_pn) = ()
64− rnf (PushValue !_v) = ()
65− rnf (Conditional c_expr c_parts) = rnf c_expr >| rnf c_parts
66− rnf _ = ()
61+ rnf (Bytes offset _count next_offset) = rnf offset `seq` rnf next_offset
62+ rnf (PushParam pn) = rnf pn
63+ rnf (PushValue v) = rnf v
64+ rnf (Conditional c_expr c_parts) = rnf c_expr `seq` rnf c_parts
65+ rnf BitwiseOr = ()
66+ rnf BitwiseXOr = ()
67+ rnf BitwiseAnd = ()
68+ rnf ArithPlus = ()
69+ rnf ArithMinus = ()
70+ rnf CompareEq = ()
71+ rnf CompareLt = ()
72+ rnf CompareGt = ()
73+ rnf DecOut = ()
74+ rnf CharOut = ()
6775
6876type ParamOps = [ParamOp]
6977data ParamOp =
7078 IncFirstTwo
7179 deriving ( Show )
7280
81+instance NFData ParamOp where
82+ rnf IncFirstTwo = ()
83+
7384parse_cap_expression :: ( Applicative m
7485 , MonadIO m
7586 )
@@ -84,6 +95,7 @@ parse_cap_expression cap_string =
8495 Left e -> return $ Left e
8596 Right build_results -> pure Right <*> construct_cap_expression cap_string build_results
8697
98+construct_cap_expression :: MonadIO m => [Char] -> BuildResults -> m CapExpression
8799construct_cap_expression cap_string build_results = do
88100 byte_array <- liftIO $ newArray (map ( toEnum . fromEnum ) cap_string )
89101 let expr = CapExpression
@@ -95,7 +107,7 @@ construct_cap_expression cap_string build_results = do
95107 , param_count = out_param_count build_results
96108 , param_ops = out_param_ops build_results
97109 }
98− return (demanding expr (rnf expr))
110+ return $! rnf expr `seq` expr
99111
100112type CapParser a = GenParser Char BuildState a
101113
src/Graphics/Vty.hs−3
@@ -27,10 +27,7 @@ import Graphics.Vty.LLInput
2727
2828import Data.IORef
2929
30−import Data.Maybe ( maybe )
31−
3230import qualified System.Console.Terminfo as Terminfo
33−import System.IO
3431
3532-- | The main object. At most one should be created.
3633-- An alternative is to use unsafePerformIO to automatically create a singleton Vty instance when
src/Graphics/Vty/DisplayAttributes.hs+1
@@ -42,6 +42,7 @@ instance Monoid DisplayAttrDiff where
4242simplify_style_diffs :: [ StyleStateChange ] -> [ StyleStateChange ] -> [ StyleStateChange ]
4343simplify_style_diffs cs_0 cs_1 = cs_0 `mappend` cs_1
4444
45+simplify_color_diffs :: DisplayColorDiff -> DisplayColorDiff -> DisplayColorDiff
4546simplify_color_diffs _cd ColorToDefault = ColorToDefault
4647simplify_color_diffs cd NoColorChange = cd
4748simplify_color_diffs _cd ( SetColor !c ) = SetColor c
src/Graphics/Vty/Image.hs+2−1
@@ -30,7 +30,6 @@ import Codec.Binary.UTF8.Width
3030
3131import Codec.Binary.UTF8.String ( decode )
3232
33−import Data.AffineSpace
3433import qualified Data.ByteString as BS
3534import Data.Monoid
3635import qualified Data.Sequence as Seq
@@ -111,6 +110,8 @@ instance Show Image where
111110 = "HorizJoin " ++ show c ++ " ( " ++ show l ++ " <|> " ++ show r ++ " )"
112111 show ( VertJoin { part_top = t, part_bottom = b, output_width = c, output_height = r } )
113112 = "VertJoin (" ++ show c ++ ", " ++ show r ++ ") ( " ++ show t ++ " ) <-> ( " ++ show b ++ " )"
113+ show ( Translation offset i )
114+ = "Translation ( " ++ show offset ++ ", " ++ show i ++ " )"
114115 show ( EmptyImage ) = "EmptyImage"
115116
116117-- | Currently append in the Monoid instance is equivalent to <->. Future versions will just stack
src/Graphics/Vty/Inline.hs−1
@@ -9,7 +9,6 @@ import Graphics.Vty.Terminal.Generic
99
1010import Control.Applicative
1111import Control.Monad.State.Strict
12−import Control.Monad.Trans
1312
1413import Data.Bits ( (.&.), complement )
1514import qualified Data.String.UTF8 as UTF8
src/Graphics/Vty/LLInput.hs+6−7
@@ -26,7 +26,6 @@ import Control.Exception
2626import System.Console.Terminfo
2727
2828import System.Posix.Signals.Exts
29−import System.Posix.Signals
3029import System.Posix.Terminal
3130import System.Posix.IO ( stdInput
3231 ,fdRead
@@ -88,13 +87,13 @@ initTermInput escDelay terminal = do
8887 setFdOption stdInput NonBlockingRead False
8988 threadWaitRead stdInput
9089 setFdOption stdInput NonBlockingRead True
91− try readAll :: IO (Either IOException ())
90+ _ <- try readAll :: IO (Either IOException ())
9291 when (escDelay == 0) finishAtomicInput
9392 loop
9493 readAll = do
9594 (bytes, bytes_read) <- fdRead stdInput 1
9695 when (bytes_read > 0) $ do
97− tryPutMVar hadInput () -- signal input
96+ _ <- tryPutMVar hadInput () -- signal input
9897 writeChan inputChannel (head bytes)
9998 readAll
10099 -- | If there is no input for some time, this thread puts '\xFFFE' in the
@@ -212,13 +211,13 @@ initTermInput escDelay terminal = do
212211 let pokeIO = (Catch $ do let e = error "(getsize in input layer)"
213212 setTerminalAttributes stdInput nattr Immediately
214213 writeChan eventChannel (EvResize e e))
215− installHandler windowChange pokeIO Nothing
216− installHandler continueProcess pokeIO Nothing
214+ _ <- installHandler windowChange pokeIO Nothing
215+ _ <- installHandler continueProcess pokeIO Nothing
217216 let uninit = do killThread eventThreadId
218217 killThread inputThreadId
219218 killThread noInputThreadId
220− installHandler windowChange Ignore Nothing
221− installHandler continueProcess Ignore Nothing
219+ _ <- installHandler windowChange Ignore Nothing
220+ _ <- installHandler continueProcess Ignore Nothing
222221 setTerminalAttributes stdInput oattr Immediately
223222 return (readChan eventChannel, uninit)
224223
src/Graphics/Vty/Span.hs+1−3
@@ -24,8 +24,6 @@ import Data.Array.ST
2424import qualified Data.ByteString as B
2525import qualified Data.ByteString.Internal as BInt
2626import qualified Data.Foldable as Foldable
27−import Data.Function
28−import Data.List
2927import Data.Word
3028import qualified Data.ByteString.UTF8 as BSUTF8
3129import qualified Data.String.UTF8 as UTF8
@@ -153,7 +151,7 @@ ops_for_row mrow_ops bg region image y remaining_columns
153151 then remaining_columns
154152 else width
155153 forM_ [y .. y + actual_height - 1] $ \y' -> snoc_bg_fill mrow_ops bg actual_width y'
156− Translation v i -> ops_for_row mrow_ops bg region i y remaining_columns
154+ Translation _offset i -> ops_for_row mrow_ops bg region i y remaining_columns
157155
158156snoc_text_span :: (Foldable.Foldable t)
159157 => Attr
src/Graphics/Vty/Terminal.hs−1
@@ -32,7 +32,6 @@ import Control.Applicative
3232import Control.Exception ( SomeException, try )
3333import Control.Monad.Trans
3434
35−import Data.Either
3635import Data.List ( isPrefixOf )
3736import Data.Word
3837
src/Graphics/Vty/Terminal/Generic.hs−1
@@ -24,7 +24,6 @@ import Data.Array
2424import qualified Data.ByteString.Internal as BSCore
2525import Data.Foldable
2626import Data.IORef
27−import Data.Word
2827import Data.String.UTF8 hiding ( foldl )
2928
3029data TerminalHandle where
src/Graphics/Vty/Terminal/TerminfoBased.hs+4−4
@@ -93,7 +93,7 @@ terminal_instance in_ID = do
9393 case parse_result of
9494 Left e -> fail $ show e
9595 Right cap -> return $ Just cap
96− term_fd <- liftIO $ dup stdOutput
96+ the_fd <- liftIO $ dup stdOutput
9797 pure Term
9898 <*> pure in_ID
9999 <*> pure ti
@@ -107,7 +107,7 @@ terminal_instance in_ID = do
107107 <*> require_cap "sgr0"
108108 <*> require_cap "clear"
109109 <*> current_display_attr_caps ti
110− <*> pure term_fd
110+ <*> pure the_fd
111111
112112current_display_attr_caps :: ( Applicative m, MonadIO m )
113113 => Terminfo.Terminal
@@ -186,8 +186,8 @@ foreign import ccall unsafe "output_buffer.h stdout_output_buffer" c_output_byte
186186 :: CInt -> Ptr Word8 -> CSize -> IO ()
187187foreign import ccall "gwinsz.h c_get_window_size" c_get_window_size
188188 :: IO CLong
189−foreign import ccall "fdatasync" c_fdatasync
190− :: CInt -> IO CInt
189+-- foreign import ccall "fdatasync" c_fdatasync
190+-- :: CInt -> IO CInt
191191
192192get_window_size :: IO (Int,Int)
193193get_window_size = do