on develop help sign in
Clean up warnings and lint
commit2d6724453e11bfd70a32aa372b1a3c0ce5ee701d authorElliot Cameron <eacameron@gmail.com> dateFri 8 May 2020, 00:33 (6 years ago) parentaf6a738
3 files changed+10−11
src/Reflex/Class/Switchable.hs+2−3 src/Reflex/Vty/Host.hs+3−4 src/Reflex/Vty/Widget.hs+5−4
src/Reflex/Class/Switchable.hs+2−3
@@ -4,7 +4,6 @@ Description: A class for things that can be switched on the firing of an event
44-}
55{-# LANGUAGE FlexibleInstances #-}
66{-# LANGUAGE FunctionalDependencies #-}
7−{-# LANGUAGE MultiParamTypeClasses #-}
87{-# LANGUAGE UndecidableInstances #-}
98module Reflex.Class.Switchable where
109
@@ -26,5 +25,5 @@ instance Reflex t => Switchable t (Behavior t a) where
2625
2726instance (Reflex t, Switchable t a, Switchable t b) => Switchable t (a, b) where
2827 switching (a, b) e = (,)
29− <$> (switching a $ fmap fst e)
30− <*> (switching b $ fmap snd e)
28+ <$> switching a (fmap fst e)
29+ <*> switching b (fmap snd e)
src/Reflex/Vty/Host.hs+3−4
@@ -28,8 +28,7 @@ import Control.Monad.Identity (Identity(..))
2828import Control.Monad.Primitive (PrimMonad)
2929import Control.Monad.Ref (MonadRef, Ref, readRef)
3030import Data.Dependent.Sum (DSum ((:=>)))
31−import Data.IORef (IORef)
32−import Data.IORef (readIORef)
31+import Data.IORef (IORef, readIORef)
3332import Data.Maybe (catMaybes)
3433
3534import Reflex
@@ -76,7 +75,7 @@ type MonadVtyApp t m =
7675type VtyApp t m = MonadVtyApp t m
7776 => DisplayRegion
7877 -- ^ The initial display size (updates to this come as events)
79− -> Event t (V.Event)
78+ -> Event t V.Event
8079 -- ^ Vty input events.
8180 -> m (VtyResult t)
8281 -- ^ The output of the 'VtyApp'. The application runs in a context that,
@@ -179,7 +178,7 @@ runVtyAppWithHandle vty vtyGuest = flip onException (V.shutdown vty) $
179178 triggerInvocation = TriggerInvocation ne $ return ()
180179 -- Write our input event's 'EventTrigger' with the newly created
181180 -- 'TriggerInvocation' value to the queue of events.
182− writeChan events $ [triggerRef :=> triggerInvocation]
181+ writeChan events [triggerRef :=> triggerInvocation]
183182
184183 -- The main application loop. We wait for new events, fire those that
185184 -- have subscribers, and update the display. If we detect a shutdown
src/Reflex/Vty/Widget.hs+5−4
@@ -70,8 +70,9 @@ module Reflex.Vty.Widget
7070
7171import Control.Applicative (liftA2)
7272import Control.Monad.Fix (MonadFix)
73−import Control.Monad.Reader
74−import Control.Monad.Trans (lift)
73+import Control.Monad.IO.Class (MonadIO)
74+import Control.Monad.Reader (ReaderT, ask, asks, runReaderT)
75+import Control.Monad.Trans (MonadTrans, lift)
7576import Data.Default (Default(..))
7677import Data.Set (Set)
7778import qualified Data.Set as Set
@@ -142,7 +143,7 @@ instance MonadTrans (VtyWidget t) where
142143
143144instance MonadNodeId m => MonadNodeId (VtyWidget t m) where
144145 getNextNodeId = VtyWidget $ do
145− lift $ lift $ getNextNodeId
146+ lift $ lift getNextNodeId
146147
147148-- | Runs a 'VtyWidget' with a given context
148149runVtyWidget
@@ -492,7 +493,7 @@ splitVDrag wS wA wB = do
492493 rec splitterCheckpoint <- holdDyn splitter0 $ leftmost [fst <$> ffilter snd dragSplitter, resizeSplitter]
493494 splitterPos <- holdDyn splitter0 $ leftmost [fst <$> dragSplitter, resizeSplitter]
494495 splitterFrac <- holdDyn ((1::Double) / 2) $ ffor (attach (current dh) (fst <$> dragSplitter)) $ \(h, x) ->
495− fromIntegral x / (max 1 (fromIntegral h))
496+ fromIntegral x / max 1 (fromIntegral h)
496497 let dragSplitter = fforMaybe (attach (current splitterCheckpoint) dragE) $
497498 \(splitterY, Drag (_, fromY) (_, toY) _ _ end) ->
498499 if splitterY == fromY then Just (toY, end) else Nothing