on master help sign in
Warning cleanup: remove stale imports, add missing type signatures
commit9f8f35215e2062e07f29ebe21b822588805ca88d authorJonathan Daugherty <cygnus@foobox.com> dateWed 11 Jun 2014, 20:19 (12 years ago) parent64c7ec0
5 files changed+23−5
src/Graphics/Vty/Config.hs+21 src/Graphics/Vty/Inline/Unsafe.hs−1 src/Graphics/Vty/Input/Classify.hs+1−1 src/Graphics/Vty/Input/Events.hs−2 src/Graphics/Vty/Input/Loop.hs+1−1
src/Graphics/Vty/Config.hs+21
@@ -1,5 +1,6 @@
11{-# LANGUAGE FlexibleContexts #-}
22{-# LANGUAGE NoMonomorphismRestriction #-}
3+{-# LANGUAGE KindSignatures #-}
34-- | A 'Config' can be provided to mkVty to customize the applications use of vty. A config file can
45-- be used to customize vty for a user's system.
56--
@@ -173,6 +174,9 @@ configLanguage = LanguageDef
173174configLexer :: Stream s m Char => P.GenTokenParser s u m
174175configLexer = P.makeTokenParser configLanguage
175176
177+mapDecl :: forall s u (m :: * -> *).
178+ (Monad m, Stream s (WriterT Config m) Char) =>
179+ ParsecT s u (WriterT Config m) ()
176180mapDecl = do
177181 void $ string "map"
178182 P.whiteSpace configLexer
@@ -185,6 +189,9 @@ mapDecl = do
185189
186190-- TODO: Generated by a vim macro. There is a better way here. Derive parser? Use Read
187191-- instance? Generics?
192+parseKey :: forall s u (m :: * -> *).
193+ Stream s m Char =>
194+ ParsecT s u m Key
188195parseKey = do
189196 key <- P.identifier configLexer
190197 case key of
@@ -215,8 +222,14 @@ parseKey = do
215222 "KMenu" -> return KMenu
216223 _ -> fail $ key ++ " is not a valid key identifier"
217224
225+parseModifiers :: forall s u (m :: * -> *).
226+ Stream s m Char =>
227+ ParsecT s u m [Modifier]
218228parseModifiers = P.brackets configLexer (parseModifier `sepBy` P.symbol configLexer ",")
219229
230+parseModifier :: forall s u (m :: * -> *).
231+ Stream s m Char =>
232+ ParsecT s u m Modifier
220233parseModifier = do
221234 m <- P.identifier configLexer
222235 case m of
@@ -226,14 +239,22 @@ parseModifier = do
226239 "MAlt" -> return MAlt
227240 _ -> fail $ m ++ " is not a valid modifier identifier"
228241
242+debugLogDecl :: forall s u (m :: * -> *).
243+ (Monad m, Stream s (WriterT Config m) Char) =>
244+ ParsecT s u (WriterT Config m) ()
229245debugLogDecl = do
230246 void $ string "debugLog"
231247 P.whiteSpace configLexer
232248 path <- P.stringLiteral configLexer
233249 lift $ tell $ def { debugLog = Just path }
234250
251+ignoreLine :: forall s u (m :: * -> *).
252+ Stream s m Char => ParsecT s u m ()
235253ignoreLine = void $ manyTill anyChar newline
236254
255+parseConfig :: forall s u (m :: * -> *).
256+ (Monad m, Stream s (WriterT Config m) Char) =>
257+ ParsecT s u (WriterT Config m) ()
237258parseConfig = void $ many $ do
238259 P.whiteSpace configLexer
239260 let directives = [mapDecl, debugLogDecl]
src/Graphics/Vty/Inline/Unsafe.hs−1
@@ -2,7 +2,6 @@
22module Graphics.Vty.Inline.Unsafe where
33
44import Graphics.Vty
5−import Graphics.Vty.Config (userConfig)
65
76import Data.Default
87import Data.IORef
src/Graphics/Vty/Input/Classify.hs+1−1
@@ -12,7 +12,7 @@ import Graphics.Vty.Input.Events
1212
1313import Codec.Binary.UTF8.Generic (decode)
1414
15−import Data.List(tails,inits)
15+import Data.List(inits)
1616import qualified Data.Map as M( fromList, lookup )
1717import Data.Maybe ( mapMaybe )
1818import qualified Data.Set as S( fromList, member )
src/Graphics/Vty/Input/Events.hs−2
@@ -1,7 +1,5 @@
11module Graphics.Vty.Input.Events where
22
3−import Data.Map (Map)
4−
53-- | Representations of non-modifier keys.
64--
75-- * 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
177177 Nothing -> return ()
178178 Just h -> do
179179 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))
181181 forM_ classifyTable $ \i -> case i of
182182 (inBytes, EvKey k mods) -> hPrintf h "map %s %s %s %s\n" (show termName)
183183 (show inBytes)