Skip to content

Commit 22eaeac

Browse files
warning cleanup 1
1 parent 4bbeae3 commit 22eaeac

File tree

5 files changed

+19
-54
lines changed

5 files changed

+19
-54
lines changed

src/Potato/Flow/Vty/Layer.hs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,23 @@ module Potato.Flow.Vty.Layer (
1111
import Relude
1212

1313
import Potato.Flow
14-
import Potato.Flow.Controller
1514
import Potato.Flow.Vty.Attrs
1615
import Potato.Flow.Vty.Input
1716
import Potato.Reflex.Vty.Helpers
18-
import Potato.Reflex.Vty.Widget
1917
import Potato.Flow.Vty.PotatoReader
2018
import Potato.Flow.Vty.Common
2119
import Potato.Reflex.Vty.Widget.ScrollBar
2220
import Potato.Reflex.Vty.Widget.TextInputHelpers
2321

2422

2523
import qualified Potato.Data.Text.Zipper
26-
import Control.Monad.Fix
27-
import Data.Align
28-
import Data.Dependent.Sum (DSum ((:=>)))
29-
import qualified Data.IntMap.Strict as IM
3024
import qualified Data.List as L
3125
import qualified Data.Sequence as Seq
3226
import qualified Data.Text as T
33-
import Data.Text.Zipper
3427
import qualified Data.Text.Zipper as TZ
35-
import Data.These
3628

3729
import qualified Graphics.Vty as V
3830
import Reflex
39-
import Reflex.Network
40-
import Reflex.Potato.Helpers
4131
import Reflex.Vty
4232

4333

@@ -110,7 +100,6 @@ layerContents LayerWidgetConfig {..} scrollDyn = do
110100
LayersHandlerRenderEntryNormal selected mdots mrenaming lentry@LayerEntry{..} -> r where
111101
ident = layerEntry_depth lentry
112102
sowl = _layerEntry_superOwl
113-
rid = _superOwl_id sowl
114103
label = hasOwlItem_name sowl
115104

116105
attr = case selected of
@@ -132,6 +121,7 @@ layerContents LayerWidgetConfig {..} scrollDyn = do
132121
OwlSubItemBox _ -> ""
133122
OwlSubItemLine _ -> ""
134123
OwlSubItemTextArea _ -> "𐂂"
124+
_ -> "?"
135125

136126
t1 = V.text' attr . T.pack $
137127

@@ -171,12 +161,6 @@ holdLayerWidget :: forall t m. (MonadWidget t m, HasPotato t m)
171161
-> m (LayerWidget t)
172162
holdLayerWidget lwc@LayerWidgetConfig {..} = do
173163

174-
175-
176-
177-
potatostylebeh <- fmap _potatoConfig_style askPotato
178-
PotatoStyle {..} <- sample potatostylebeh
179-
180164
regionWidthDyn <- displayWidth
181165
--regionHeightDyn <- displayHeight
182166

src/Potato/Flow/Vty/Left.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import Relude
1313

1414

1515
import Potato.Flow
16-
import Potato.Flow.Vty.Info
1716
import Potato.Flow.Vty.Layer
1817
import Potato.Flow.Vty.Params
1918
import Potato.Flow.Vty.PotatoReader
@@ -173,7 +172,7 @@ holdLeftWidget LeftWidgetConfig {..} = do
173172
return (params', paramsFocusEv')
174173

175174
let
176-
refineFocusNoParamsEv = leftmost
175+
refineFocusNoParamsEv :: (Event t Text) = leftmost
177176
[ fmap (const "menu") menuFocusEv
178177
, fmap (const "tools") toolsFocusEv
179178
, fmap (const "toolsOptions") toolsOptionsFocusEv

src/Potato/Flow/Vty/Main.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ welcomeWidget version = do
208208
}
209209
boxTitle (constant def) (constant $ "😱 tinytools-vty (beta v." <> version <> ") 😱") $ do
210210
initLayout $ col $ do
211-
(grout . stretch) 1 $ scrollableText scrollcfg welcomeMessageDyn
211+
_ <- (grout . stretch) 1 $ scrollableText scrollcfg welcomeMessageDyn
212212
(grout . fixed) 3 $ textButton def (constant "bye")
213213

214214

@@ -378,7 +378,7 @@ mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
378378
, _goatWidgetConfig_setFocusedArea = _leftWidget_setFocusEvent leftW
379379

380380
-- TODO
381-
--, _goatWidgetConfig_unicodeWidthFn =
381+
, _goatWidgetConfig_unicodeWidthFn = Nothing
382382

383383
-- debugging stuff
384384
, _goatWidgetConfig_setDebugLabel = never
@@ -397,7 +397,7 @@ mainPFWidgetWithBypass MainPFWidgetConfig {..} bypassEvent = mdo
397397

398398
rightPanel = do
399399
dreg' <- askRegion
400-
let dreg = fmap (\region -> region { _region_left = 0, _region_top = 0}) dreg'
400+
let dreg = fmap (\reg -> reg { _region_left = 0, _region_top = 0}) dreg'
401401
f <- focus
402402
pane dreg f $ holdCanvasWidget $ CanvasWidgetConfig {
403403
_canvasWidgetConfig_pan = _goatWidget_pan everythingW

src/Potato/Flow/Vty/Params.hs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE RecordWildCards #-}
22
{-# LANGUAGE RecursiveDo #-}
3+
{-# OPTIONS_GHC -fno-warn-orphans #-}
34

45
module Potato.Flow.Vty.Params (
56
ParamsWidgetConfig(..)
@@ -15,17 +16,12 @@ module Potato.Flow.Vty.Params (
1516
import Relude
1617

1718
import Potato.Flow
18-
import Potato.Flow.OwlHelpers
1919
import Potato.Flow.Vty.Common
2020
import Potato.Reflex.Vty.Helpers
2121
import Potato.Flow.Vty.PotatoReader
22-
import Potato.Flow.Vty.Attrs
2322
import Potato.Reflex.Vty.Widget.TextInputHelpers
2423

25-
import Control.Monad.Fix
26-
import Control.Monad.NodeId
2724
import Data.Align
28-
import Data.Char (isNumber)
2925
import Data.Dependent.Sum (DSum ((:=>)))
3026
import qualified Data.IntMap as IM
3127
import qualified Data.List.Extra as L
@@ -35,7 +31,6 @@ import qualified Data.Text as T
3531
import qualified Data.Text.Zipper as TZ
3632
import Data.These
3733
import Data.Tuple.Extra
38-
import qualified Data.List as List
3934

4035
import qualified Graphics.Vty as V
4136
import Reflex
@@ -105,7 +100,7 @@ selectParamsFromSelection ps (SuperOwlParliament selection) = r where
105100
subSelection = SuperOwlParliament $ Seq.fromList $ fmap fst params
106101
r = case values of
107102
[] -> Nothing
108-
x:xs -> if L.allSame values
103+
x:_ -> if L.allSame values
109104
then Just (subSelection, Just x)
110105
else Just (subSelection, Nothing)
111106

@@ -121,9 +116,9 @@ makeLineStyleInputDyn :: Tool -> Selection -> PotatoDefaultParameters -> Maybe (
121116
makeLineStyleInputDyn tool selection pdp = r where
122117

123118
selectLineStyleFromSelection :: Selection -> Maybe (Selection, Maybe (Maybe LineStyle, Maybe LineStyle))
124-
selectLineStyleFromSelection (SuperOwlParliament selection) = r_d1 where
119+
selectLineStyleFromSelection (SuperOwlParliament sel) = r_d1 where
125120
ps = (\x -> (getSEltLineStyle x, getSEltLineStyleEnd x)) . superOwl_toSElt_hack
126-
rawparams = ffilter (\(_,(x,y)) -> isJust x || isJust y) . fmap (\sowl -> (sowl, ps sowl)) $ selection
121+
rawparams = ffilter (\(_,(x,y)) -> isJust x || isJust y) . fmap (\sowl -> (sowl, ps sowl)) $ sel
127122
startvalues = catMaybes . toList . fmap fst . fmap snd $ rawparams
128123
endvalues = catMaybes . toList . fmap snd . fmap snd $ rawparams
129124
subSelection = SuperOwlParliament $ fmap fst rawparams
@@ -290,13 +285,13 @@ holdSuperStyleWidget pdpDyn inputDyn = constDyn $ mdo
290285
setStyleEv' = makeSuperStyleEvent tl v bl h f tr br (void $ updated focusDynUnique)
291286
captureEv' = leftmost [void setStyleEv', captureEv1]
292287
return (5, captureEv', setStyleEv')
288+
_ -> error "radioList returned invalid index"
293289

294290
setStyleEv <- switchHold never (fmap thd3 setStyleEvEv)
295291
captureEv <- switchHold never (fmap snd3 setStyleEvEv)
296292
heightDyn <- holdDyn 0 (fmap fst3 setStyleEvEv)
297293

298294
let
299-
selectionDyn = fmap fst3 inputDyn
300295
pushSuperStyleFn :: SuperStyle -> PushM t (Maybe (Either Llama SetPotatoDefaultParameters))
301296
pushSuperStyleFn ss = do
302297
(SuperOwlParliament selection, _, tool) <- sample . current $ inputDyn
@@ -411,6 +406,7 @@ holdLineStyleWidgetNew pdpDyn inputDyn = constDyn $ do
411406
0 -> if start == end then start else Nothing
412407
1 -> start
413408
2 -> end
409+
_ -> error "radioList returned invalid index"
414410

415411
(focusDyn,wasChangeDyn,l,r,u,d) <- do
416412
--(tile . fixed) 1 $ text (fmap (T.pack . superStyle_toListFormat . Data.Maybe.fromJust) $ current mssDyn)
@@ -439,13 +435,13 @@ holdLineStyleWidgetNew pdpDyn inputDyn = constDyn $ do
439435
setStyleEv' = makeLineStyleEvent (current l) (current r) (current u) (current d) (void $ gate (current wasChangeDyn) (updated focusDynUnique))
440436
captureEv' = leftmost [void setStyleEv', captureEv'']
441437
return (7, captureEv', setStyleEv')
438+
_ -> error "radioList returned invalid index"
442439

443440
setStyleEv <- switchHold never (fmap thd3 setStyleEvEv)
444441
captureEv <- switchHold never (fmap snd3 setStyleEvEv)
445442
heightDyn <- holdDyn 0 (fmap fst3 setStyleEvEv)
446443

447444
let
448-
selectionDyn = fmap fst3 inputDyn
449445
pushLineStyleFn :: Either () LineStyle -> PushM t (Maybe (Either Llama SetPotatoDefaultParameters))
450446
pushLineStyleFn eflipss = do
451447
pdp <- sample . current $ pdpDyn
@@ -456,6 +452,7 @@ holdLineStyleWidgetNew pdpDyn inputDyn = constDyn $ do
456452
0 -> SetLineStyleEnd_Both
457453
1 -> SetLineStyleEnd_Start
458454
2 -> SetLineStyleEnd_End
455+
_ -> error "radioList returned invalid index"
459456
(setstart, setend) = case whichEnd of
460457
SetLineStyleEnd_Start -> (True, False)
461458
SetLineStyleEnd_End -> (False, True)
@@ -501,7 +498,6 @@ holdTextAlignmentWidget :: forall t m. (MonadLayoutWidget t m, HasPotato t m) =>
501498
holdTextAlignmentWidget _ inputDyn = constDyn $ do
502499
let
503500
mtaDyn = fmap snd3 inputDyn
504-
selectionDyn = fmap fst3 inputDyn
505501

506502
let
507503

@@ -521,6 +517,7 @@ holdTextAlignmentWidget _ inputDyn = constDyn $ do
521517
0 -> TextAlign_Left
522518
1 -> TextAlign_Center
523519
2 -> TextAlign_Right
520+
_ -> error "radioList returned invalid index"
524521
) $ setAlignmentEv'
525522
pushAlignmentFn :: TextAlign -> PushM t (Maybe (Either Llama SetPotatoDefaultParameters))
526523
pushAlignmentFn ta = do
@@ -544,8 +541,6 @@ holdSBoxTypeWidget :: forall t m. (MonadLayoutWidget t m) => ParamsWidgetFn t m
544541
holdSBoxTypeWidget _ inputDyn = constDyn $ do
545542
let
546543
mBoxType = fmap snd3 inputDyn
547-
selectionDyn = fmap fst3 inputDyn
548-
mbt0 <- sample . current $ mBoxType
549544

550545
let
551546
stateDyn = ffor mBoxType $ \case
@@ -584,14 +579,14 @@ holdSBoxTypeWidget _ inputDyn = constDyn $ do
584579
where
585580
newbt = case bt of
586581
This border -> make_sBoxType border (sBoxType_isText oldbt)
587-
That text -> make_sBoxType (sBoxType_hasBorder oldbt) text
588-
These border text -> make_sBoxType border text
582+
That txt -> make_sBoxType (sBoxType_hasBorder oldbt) txt
583+
These border txt -> make_sBoxType border txt
589584
return $ if toolOverrideSBoxType tool
590585
-- UNTESTED, it's probably currect but the tool overrides this default so I never actually tested it
591586
then Just . Right $ def { _setPotatoDefaultParameters_sBoxType = Just $ case bt of
592587
This border -> make_sBoxType border (snd curState)
593-
That text -> make_sBoxType (fst curState) text
594-
These border text -> make_sBoxType border text
588+
That txt -> make_sBoxType (fst curState) txt
589+
These border txt -> make_sBoxType border txt
595590
}
596591
else case Data.Maybe.mapMaybe fmapfn . toList $ selection of
597592
[] -> Nothing
@@ -636,10 +631,6 @@ holdCanvasSizeWidget canvasDyn _ _ = constDyn $ do
636631
captureEv = leftmost [void outputEv, captureEv1]
637632
return (3, captureEv, outputEv)
638633

639-
data SEltParams = SEltParams {
640-
--_sEltParams_sBox =
641-
}
642-
643634
data ParamsWidgetConfig t = ParamsWidgetConfig {
644635
_paramsWidgetConfig_selectionDyn :: Dynamic t Selection
645636
, _paramsWidgetConfig_canvasDyn :: Dynamic t SCanvas

test/Reflex/Vty/Test/Common.hs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,10 @@ where
99

1010
import Relude
1111

12-
import Test.Hspec
13-
import Test.Hspec.Contrib.HUnit (fromHUnitTest)
1412
import Test.HUnit
1513

16-
import Control.Monad.IO.Class (liftIO)
17-
import Data.Kind
18-
import qualified Data.List as L
19-
20-
import qualified Graphics.Vty as V
2114
import Reflex
2215
import Reflex.Host.Class
23-
import Reflex.Vty
24-
import Reflex.Vty.Test.Monad.Host
2516

2617

2718
subscribeDynamic :: (MonadSubscribeEvent t m) => Dynamic t a -> m (EventHandle t a, Behavior t a)
@@ -48,7 +39,7 @@ checkSingleMaybe values a = case nonEmpty values of
4839
Nothing -> assertFailure "empty list"
4940
Just x -> Just a @=? head x
5041

51-
checkNothing :: (Show a) => [Maybe a] -> Assertion
42+
checkNothing :: [Maybe a] -> Assertion
5243
checkNothing values = case nonEmpty values of
5344
Nothing -> assertFailure "empty list"
5445
-- TODO prob check that all elts in list are Nothing

0 commit comments

Comments
 (0)