Skip to content

Commit e859603

Browse files
more warning cleanup
1 parent 916c90e commit e859603

File tree

5 files changed

+22
-51
lines changed

5 files changed

+22
-51
lines changed

app/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import GHC.IO.Handle
1515
import GHC.IO.Handle.FD
1616
import System.IO
1717
import System.Directory
18-
import System.FilePath
19-
import System.Console.ANSI
2018
import Options
2119

2220

src/Potato/Flow/Vty/Main.hs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,34 @@ import Relude
1212

1313

1414
import Potato.Flow
15-
import Potato.Flow.Controller
1615
import Potato.Flow.TestStates
17-
import Potato.Flow.Vty.Attrs
1816
import Potato.Flow.Vty.Canvas
19-
import Potato.Flow.Vty.Info
2017
import Potato.Flow.Vty.Input
2118
import Potato.Flow.Vty.Layer
2219
import Potato.Flow.Vty.Params
2320
import Potato.Flow.Vty.PotatoReader
2421
import Potato.Flow.Vty.Tools
2522
import Potato.Flow.Vty.Left
26-
import Potato.Flow.Vty.Common
2723
import Potato.Reflex.Vty.Helpers
2824
import Potato.Reflex.Vty.Widget.Popup
29-
import Potato.Reflex.Vty.Widget.FileExplorer
3025
import Potato.Reflex.Vty.Widget
3126
import qualified Potato.Reflex.Vty.Host
3227
import Potato.Flow.Vty.SaveAsWindow
3328
import Potato.Flow.Vty.Alert
3429
import Potato.Flow.Vty.AppKbCmd
3530

36-
import System.IO (stderr, stdout, hFlush)
31+
import System.IO (hFlush)
3732
import System.Console.ANSI (hSetTitle)
3833
import qualified System.FilePath as FP
3934
import qualified System.Directory as FP
4035

4136
import Control.Concurrent
42-
import Control.Monad.Fix
4337
import Control.Monad.NodeId
4438
import Control.Exception (handle)
4539
import qualified Data.Aeson as Aeson
4640
import qualified Data.Aeson.Encode.Pretty as PrettyAeson
4741
import Data.Maybe
48-
import Data.Monoid (Any)
4942
import Data.Default
50-
import qualified Data.Text as T
5143
import qualified Data.Text.Encoding as T
5244
import qualified Data.Text.Lazy as LT
5345
import qualified Data.Text.Lazy.Encoding as LT
@@ -60,10 +52,8 @@ import Data.These
6052
import Network.HTTP.Simple
6153

6254
import qualified Graphics.Vty as V
63-
import qualified Graphics.Vty.Input.Events as V
64-
import qualified Graphics.Vty.UnicodeWidthTable.IO as V
55+
--import qualified Graphics.Vty.UnicodeWidthTable.IO as V
6556
import Reflex
66-
import Reflex.Host.Class
6757
import Reflex.Potato.Helpers
6858
import Reflex.Vty
6959

@@ -89,7 +79,7 @@ potatoMainWidgetWithHandle vty child =
8979
let inp' = fforMaybe inp $ \case
9080
V.EvResize {} -> Nothing
9181
x -> Just x
92-
(shutdown, images) <- runThemeReader (constant V.defAttr) $
82+
(shutdown, imgs) <- runThemeReader (constant V.defAttr) $
9383
runFocusReader (pure True) $
9484
runDisplayRegion (fmap (\(w, h) -> Region 0 0 w h) size) $
9585
runImageWriter $
@@ -98,7 +88,7 @@ potatoMainWidgetWithHandle vty child =
9888
tellImages . ffor (current size) $ \(w, h) -> [V.charFill V.defAttr ' ' w h]
9989
child
10090
return $ Potato.Reflex.Vty.Host.VtyResult
101-
{ _vtyResult_picture = fmap (V.picForLayers . reverse) images
91+
{ _vtyResult_picture = fmap (V.picForLayers . reverse) imgs
10292
, _vtyResult_shutdown = shutdown
10393
}
10494

@@ -133,7 +123,7 @@ potatoMainWidget child = do
133123

134124

135125
-- | tick once (redraw widgets) upon event firing
136-
tickOnEvent :: (Reflex t, Adjustable t m) => Event t a -> m ()
126+
tickOnEvent :: (Adjustable t m) => Event t a -> m ()
137127
tickOnEvent ev = void $ runWithReplace (return ()) (ev $> return ())
138128

139129
-- | TODO move to ReflexHelpers
@@ -189,6 +179,10 @@ welcomeWidget = do
189179
(grout . stretch) 1 $ text (current welcomeMessageDyn)
190180
(grout . fixed) 3 $ textButton def (constant "bye")
191181

182+
183+
184+
185+
-- TODO DELETE OR MOVE UNUSED
192186
-- | toggle the focus of a widget
193187
-- also forces unfocused widget to ignore mouse inputs
194188
focusWidgetNoMouse :: forall t m a. (MonadWidget t m)
@@ -200,6 +194,7 @@ focusWidgetNoMouse f child = do
200194
localInput (gate (current f)) $
201195
child
202196

197+
-- TODO DELETE OR MOVE UNUSED
203198
-- | ignores mouse input unless widget is focused
204199
ignoreMouseUnlessFocused :: forall t m a. (MonadWidget t m)
205200
=> m a
@@ -208,6 +203,8 @@ ignoreMouseUnlessFocused child = do
208203
f <- focus
209204
focusWidgetNoMouse f child
210205

206+
207+
211208
-- | block all or some input events, always focused if parent is focused
212209
captureInputEvents :: forall t m a. (MonadWidget t m)
213210
=> These (Event t ()) (Behavior t Bool) -- ^ This ev is event indicating input should be capture. That beh is behavior gating input (true means captured)
@@ -244,7 +241,7 @@ mainPFWidgetWithBypass :: forall t m. (MonadWidget t m)
244241
-> m (Event t ())
245242
mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
246243
-- external inputs
247-
currentTime <- liftIO $ getCurrentTime
244+
--currentTime <- liftIO $ getCurrentTime
248245

249246
-- note tickEv triggers 2 ticks
250247
--tickEv <- tickLossy 1 currentTime
@@ -330,6 +327,9 @@ mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
330327
, _goatWidgetConfig_setPotatoDefaultParameters = _paramsWidget_setDefaultParamsEvent (_leftWidget_paramsW leftW)
331328
, _goatWidgetConfig_markSaved = void performSaveEv
332329

330+
-- TODO
331+
--, _goatWidgetConfig_unicodeWidthFn =
332+
333333
-- debugging stuff
334334
, _goatWidgetConfig_setDebugLabel = never
335335
, _goatWidgetConfig_bypassEvent = bypassEvent

test/Potato/Flow/ParamsSpec.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ import Potato.Flow.Vty.Params
1818
import Potato.Flow
1919
import Potato.Flow.Vty.PotatoReader
2020

21-
import Control.Monad.IO.Class (liftIO)
22-
import Control.Monad.Ref
2321
import Data.Default
24-
import qualified Data.Kind
25-
import qualified Data.List as L
26-
import qualified Data.Sequence as Seq
27-
import Data.Tuple.Extra (thd3)
2822

2923
import qualified Graphics.Vty as V
3024
import Reflex
@@ -34,7 +28,6 @@ import Reflex.Vty.Test.Monad.Host
3428
import Reflex.Vty.Test.Monad.Host.TH
3529
import Reflex.Vty.Test.Common
3630

37-
import Language.Haskell.TH
3831

3932
$(declareStuff "ParamsNetwork"
4033
[("setSelection", [t|Selection|])
@@ -122,7 +115,7 @@ test_superStyleWidget_basic :: Test
122115
test_superStyleWidget_basic = TestLabel "set canvas size" $ TestCase $ runSpiderHost $
123116
runReflexVtyTestApp @ (SuperStyleWidgetNetwork (SpiderTimeline Global) (SpiderHost Global)) (100,100) $ do
124117

125-
let queueVtyEventAndFire x = queueVtyEvent x >> fireQueuedEvents
118+
--let queueVtyEventAndFire x = queueVtyEvent x >> fireQueuedEvents
126119

127120
-- get our app's input triggers
128121
SuperStyleWidgetNetwork_InputTriggerRefs {..} <- userInputTriggerRefs

test/Potato/FlowSpecTH.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ import Test.HUnit
1717
import Potato.Flow.Vty.Main
1818
import Potato.Flow
1919

20-
import Control.Monad.IO.Class (liftIO)
21-
import Control.Monad.Ref
22-
import Data.Default
23-
import qualified Data.Kind
24-
import qualified Data.List as L
25-
2620
import qualified Graphics.Vty as V
2721
import Reflex
2822
import Reflex.Host.Class
@@ -31,8 +25,6 @@ import Reflex.Vty.Test.Monad.Host
3125
import Reflex.Vty.Test.Monad.Host.TH
3226
import Reflex.Vty.Test.Common
3327

34-
import Language.Haskell.TH
35-
3628
-- for reference, non-TH equivalent network
3729
{-
3830
data PotatoNetwork t (m :: Type -> Type)
@@ -75,6 +67,7 @@ $(declareStuff "PotatoNetwork"
7567
(MainPFWidgetConfig {
7668
_mainPFWidgetConfig_initialFile = Nothing
7769
, _mainPFWidgetConfig_initialState = emptyOwlPFState
70+
, _mainPFWidgetConfig_homeDirectory = ""
7871
})
7972
$(tinput "PotatoNetwork" "bypassEvent")
8073

test/Reflex/Vty/Test/Monad/THSpec.hs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ import Test.Hspec
1414
import Test.Hspec.Contrib.HUnit (fromHUnitTest)
1515
import Test.HUnit
1616

17-
import Potato.Flow.Vty.Main
18-
import Potato.Flow
19-
import Potato.Flow.ParamsSpec hiding (spec)
20-
21-
import Control.Monad.IO.Class (liftIO)
22-
import Control.Monad.Ref
23-
import Data.Default
24-
import Data.Kind
2517
import qualified Data.List as L
2618

2719
import qualified Graphics.Vty as V
@@ -30,11 +22,6 @@ import Reflex.Host.Class
3022
import Reflex.Vty
3123
import Reflex.Vty.Test.Monad.Host
3224
import Reflex.Vty.Test.Monad.Host.TH
33-
import Reflex.Vty.Test.Common
34-
35-
import Reflex.Vty.Test.Monad.Host.TH
36-
37-
import Language.Haskell.TH
3825

3926

4027
$(declareStuff "BasicNetworkTest1"
@@ -86,13 +73,13 @@ test_basic = TestLabel "basic" $ TestCase $ runSpiderHost $
8673

8774
-- fire a dummy input event and enusre the output is as expected
8875
queueEventTriggerRef _basicNetworkTest1_InputTriggerRefs_dummy 'p'
89-
a2 :: [Maybe VtyEvent] <- fireQueuedEventsAndRead $ sequence =<< readEvent vtyH
90-
liftIO $ a2 @?= [Just $ V.EvKey (V.KChar 'p') []]
76+
a3 :: [Maybe VtyEvent] <- fireQueuedEventsAndRead $ sequence =<< readEvent vtyH
77+
liftIO $ a3 @?= [Just $ V.EvKey (V.KChar 'p') []]
9178

9279
-- resize the screen and check that the changes are reflected
9380
queueVtyEvent $ V.EvResize 10 10
94-
a3 :: [Maybe Int] <- fireQueuedEventsAndRead $ sequence =<< readEvent dwH
95-
liftIO $ a3 @?= [Just 10]
81+
a4 :: [Maybe Int] <- fireQueuedEventsAndRead $ sequence =<< readEvent dwH
82+
liftIO $ a4 @?= [Just 10]
9683

9784

9885

0 commit comments

Comments
 (0)