on master help sign in
Warning cleanup: remove stale imports, add missing type signatures
9f8f352Jonathan Daugherty
src/Graphics/Vty/Config.hs+21
@@ -1,5 +1,6 @@
1{-# LANGUAGE FlexibleContexts #-}
1{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE NoMonomorphismRestriction #-}
2{-# LANGUAGE NoMonomorphismRestriction #-}
3+{-# LANGUAGE KindSignatures #-}
3-- | A 'Config' can be provided to mkVty to customize the applications use of vty. A config file can
4-- | A 'Config' can be provided to mkVty to customize the applications use of vty. A config file can
4-- be used to customize vty for a user's system.
5-- be used to customize vty for a user's system.
5--
6--
@@ -173,6 +174,9 @@ configLanguage = LanguageDef
173configLexer :: Stream s m Char => P.GenTokenParser s u m
174configLexer :: Stream s m Char => P.GenTokenParser s u m
174configLexer = P.makeTokenParser configLanguage
175configLexer = P.makeTokenParser configLanguage
175
176
177+mapDecl :: forall s u (m :: * -> *).
178+ (Monad m, Stream s (WriterT Config m) Char) =>
179+ ParsecT s u (WriterT Config m) ()
176mapDecl = do
180mapDecl = do
177 void $ string "map"
181 void $ string "map"
178 P.whiteSpace configLexer
182 P.whiteSpace configLexer
@@ -185,6 +189,9 @@ mapDecl = do
185
189
186-- TODO: Generated by a vim macro. There is a better way here. Derive parser? Use Read
190-- TODO: Generated by a vim macro. There is a better way here. Derive parser? Use Read
187-- instance? Generics?
191-- instance? Generics?
192+parseKey :: forall s u (m :: * -> *).
193+ Stream s m Char =>
194+ ParsecT s u m Key
188parseKey = do
195parseKey = do
189 key <- P.identifier configLexer
196 key <- P.identifier configLexer
190 case key of
197 case key of
@@ -215,8 +222,14 @@ parseKey = do
215 "KMenu" -> return KMenu
222 "KMenu" -> return KMenu
216 _ -> fail $ key ++ " is not a valid key identifier"
223 _ -> fail $ key ++ " is not a valid key identifier"
217
224
225+parseModifiers :: forall s u (m :: * -> *).
226+ Stream s m Char =>
227+ ParsecT s u m [Modifier]
218parseModifiers = P.brackets configLexer (parseModifier `sepBy` P.symbol configLexer ",")
228parseModifiers = P.brackets configLexer (parseModifier `sepBy` P.symbol configLexer ",")
219
229
230+parseModifier :: forall s u (m :: * -> *).
231+ Stream s m Char =>
232+ ParsecT s u m Modifier
220parseModifier = do
233parseModifier = do
221 m <- P.identifier configLexer
234 m <- P.identifier configLexer
222 case m of
235 case m of
@@ -226,14 +239,22 @@ parseModifier = do
226 "MAlt" -> return MAlt
239 "MAlt" -> return MAlt
227 _ -> fail $ m ++ " is not a valid modifier identifier"
240 _ -> fail $ m ++ " is not a valid modifier identifier"
228
241
242+debugLogDecl :: forall s u (m :: * -> *).
243+ (Monad m, Stream s (WriterT Config m) Char) =>
244+ ParsecT s u (WriterT Config m) ()
229debugLogDecl = do
245debugLogDecl = do
230 void $ string "debugLog"
246 void $ string "debugLog"
231 P.whiteSpace configLexer
247 P.whiteSpace configLexer
232 path <- P.stringLiteral configLexer
248 path <- P.stringLiteral configLexer
233 lift $ tell $ def { debugLog = Just path }
249 lift $ tell $ def { debugLog = Just path }
234
250
251+ignoreLine :: forall s u (m :: * -> *).
252+ Stream s m Char => ParsecT s u m ()
235ignoreLine = void $ manyTill anyChar newline
253ignoreLine = void $ manyTill anyChar newline
236
254
255+parseConfig :: forall s u (m :: * -> *).
256+ (Monad m, Stream s (WriterT Config m) Char) =>
257+ ParsecT s u (WriterT Config m) ()
237parseConfig = void $ many $ do
258parseConfig = void $ many $ do
238 P.whiteSpace configLexer
259 P.whiteSpace configLexer
239 let directives = [mapDecl, debugLogDecl]
260 let directives = [mapDecl, debugLogDecl]
src/Graphics/Vty/Inline/Unsafe.hs−1
@@ -2,7 +2,6 @@
2module Graphics.Vty.Inline.Unsafe where
2module Graphics.Vty.Inline.Unsafe where
3
3
4import Graphics.Vty
4import Graphics.Vty
5−import Graphics.Vty.Config (userConfig)
6
5
7import Data.Default
6import Data.Default
8import Data.IORef
7import Data.IORef
src/Graphics/Vty/Input/Classify.hs+1−1
@@ -12,7 +12,7 @@ import Graphics.Vty.Input.Events
12
12
13import Codec.Binary.UTF8.Generic (decode)
13import Codec.Binary.UTF8.Generic (decode)
14
14
15−import Data.List(tails,inits)
15+import Data.List(inits)
16import qualified Data.Map as M( fromList, lookup )
16import qualified Data.Map as M( fromList, lookup )
17import Data.Maybe ( mapMaybe )
17import Data.Maybe ( mapMaybe )
18import qualified Data.Set as S( fromList, member )
18import qualified Data.Set as S( fromList, member )
src/Graphics/Vty/Input/Events.hs−2
@@ -1,7 +1,5 @@
1module Graphics.Vty.Input.Events where
1module Graphics.Vty.Input.Events where
2
2
3−import Data.Map (Map)
4−
5-- | Representations of non-modifier keys.
3-- | Representations of non-modifier keys.
6--
4--
7-- * KFun is indexed from 0 to 63. Range of supported FKeys varies by terminal and keyboard.
5-- * KFun is indexed from 0 to 63. Range of supported FKeys varies by terminal and keyboard.
src/Graphics/Vty/Input/Loop.hs+1−1
@@ -177,7 +177,7 @@ logInitialInputState input termName classifyTable = case _inputDebug input of
177 Nothing -> return ()
177 Nothing -> return ()
178 Just h -> do
178 Just h -> do
179 config <- readIORef $ _configRef input
179 config <- readIORef $ _configRef input
180− hPrintf h "initial (vmin,vtime): %s\n" (show (vmin config, vtime config))
180+ _ <- hPrintf h "initial (vmin,vtime): %s\n" (show (vmin config, vtime config))
181 forM_ classifyTable $ \i -> case i of
181 forM_ classifyTable $ \i -> case i of
182 (inBytes, EvKey k mods) -> hPrintf h "map %s %s %s %s\n" (show termName)
182 (inBytes, EvKey k mods) -> hPrintf h "map %s %s %s %s\n" (show termName)
183 (show inBytes)
183 (show inBytes)