@@ -38,30 +38,30 @@ data Notice = Notice Text Text
38
38
39
39
data Modal s
40
40
= ModalNotice Notice
41
- | ModalWhyDepends (B. GenericList Widgets Seq (NonEmpty ( Path s ) ))
42
- | ModalSearch Text Text (B. GenericList Widgets Seq ( Path s ) )
41
+ | ModalWhyDepends (B. GenericList Widgets Seq (NonEmpty Path ))
42
+ | ModalSearch Text Text (B. GenericList Widgets Seq Path )
43
43
44
44
succCycle :: forall a . (Bounded a , Enum a ) => a -> a
45
45
succCycle a
46
46
| fromEnum a == fromEnum (maxBound @ a ) = minBound
47
47
| otherwise = succ a
48
48
49
49
data AppEnv s = AppEnv
50
- { aeActualStoreEnv :: StoreEnv s ( PathStats s ) ,
51
- aeInvertedIndex :: InvertedIndex ( Path s ) ,
52
- aePrevPane :: List s ,
53
- aeCurrPane :: List s ,
54
- aeNextPane :: List s ,
55
- aeParents :: [List s ],
50
+ { aeActualStoreEnv :: StoreEnv PathStats ,
51
+ aeInvertedIndex :: InvertedIndex Path ,
52
+ aePrevPane :: List ,
53
+ aeCurrPane :: List ,
54
+ aeNextPane :: List ,
55
+ aeParents :: [List ],
56
56
aeOpenModal :: Maybe (Modal s ),
57
57
aeSortOrder :: SortOrder ,
58
58
aeSortOrderLastChanged :: Clock. TimeSpec ,
59
59
aeCurrTime :: Clock. TimeSpec
60
60
}
61
61
62
- type Path s = StorePath s ( StoreName s ) ( PathStats s )
62
+ type Path = StorePath StoreName PathStats
63
63
64
- type List s = B. GenericList Widgets Seq ( Path s )
64
+ type List = B. GenericList Widgets Seq Path
65
65
66
66
data SortOrder
67
67
= SortOrderAlphabetical
@@ -71,12 +71,12 @@ data SortOrder
71
71
72
72
B. suffixLenses ''AppEnv
73
73
74
- _ModalWhyDepends :: Traversal' (Modal s ) (B. GenericList Widgets Seq (NonEmpty ( Path s ) ))
74
+ _ModalWhyDepends :: Traversal' (Modal s ) (B. GenericList Widgets Seq (NonEmpty Path ))
75
75
_ModalWhyDepends f m = case m of
76
76
ModalWhyDepends l -> ModalWhyDepends <$> f l
77
77
_ -> pure m
78
78
79
- compareBySortOrder :: SortOrder -> Path s -> Path s -> Ordering
79
+ compareBySortOrder :: SortOrder -> Path -> Path -> Ordering
80
80
compareBySortOrder SortOrderAlphabetical = compare `on` T. toLower . storeNameToShortText . spName
81
81
compareBySortOrder SortOrderClosureSize = compare `on` Down . psTotalSize . spPayload
82
82
compareBySortOrder SortOrderAddedSize = compare `on` Down . psAddedSize . spPayload
@@ -85,7 +85,7 @@ attrTerminal, attrUnderlined :: B.AttrName
85
85
attrTerminal = B. attrName " terminal"
86
86
attrUnderlined = B. attrName " underlined"
87
87
88
- run :: StoreEnv s ( PathStats s ) -> IO ()
88
+ run :: StoreEnv PathStats -> IO ()
89
89
run env = do
90
90
-- Create the inverted index, and start evaluating it in the background
91
91
let ii = iiFromList . toList . fmap (\ sp -> (storeNameToText (spName sp), sp)) $ seAll env
@@ -142,14 +142,14 @@ run env = do
142
142
renderList ::
143
143
Maybe SortOrder ->
144
144
Bool ->
145
- List s ->
145
+ List ->
146
146
B. Widget Widgets
147
147
renderList highlightSort =
148
148
B. renderList
149
149
( \ _
150
150
StorePath
151
151
{ spName,
152
- spPayload = PathStats {psTotalSize, psAddedSize},
152
+ spPayload = PathStats {psTotalSize, psAddedSize, psDisambiguationChars },
153
153
spRefs,
154
154
spSignatures
155
155
} ->
@@ -162,7 +162,7 @@ renderList highlightSort =
162
162
[ if null spSignatures
163
163
then B. txt " "
164
164
else B. txt " ✓ " ,
165
- B. txt (storeNameToShortText spName)
165
+ B. txt (storeNameToShortTextWithDisambiguation psDisambiguationChars spName)
166
166
& underlineWhen SortOrderAlphabetical
167
167
& B. padRight (B. Pad 1 )
168
168
& B. padRight B. Max ,
@@ -336,7 +336,7 @@ app =
336
336
]
337
337
)
338
338
339
- yankToClipboard :: StoreName s -> IO (Either Notice () )
339
+ yankToClipboard :: StoreName -> IO (Either Notice () )
340
340
yankToClipboard p =
341
341
Clipboard. copy (toText $ storeNameToPath p)
342
342
<&> \ case
@@ -438,7 +438,7 @@ renderNotice :: Notice -> B.Widget a
438
438
renderNotice (Notice title txt) = renderModal title (B. txt txt)
439
439
440
440
renderWhyDependsModal ::
441
- B. GenericList Widgets Seq (NonEmpty ( Path s ) ) ->
441
+ B. GenericList Widgets Seq (NonEmpty Path ) ->
442
442
B. Widget Widgets
443
443
renderWhyDependsModal l =
444
444
B. renderList renderDepends True l
@@ -468,7 +468,7 @@ showWhyDepends env@AppEnv {aeActualStoreEnv} =
468
468
(fromMaybe 0 $ ((==) `on` fmap spName) route `S.findIndexL` xs)
469
469
}
470
470
471
- renderSearchModal :: Text -> Text -> B. GenericList Widgets Seq ( Path s ) -> B. Widget Widgets
471
+ renderSearchModal :: Text -> Text -> B. GenericList Widgets Seq Path -> B. Widget Widgets
472
472
renderSearchModal left right l =
473
473
renderModal " Search" window
474
474
where
@@ -490,10 +490,10 @@ showAndUpdateSearch left right env@AppEnv {aeInvertedIndex} =
490
490
& S. fromList
491
491
in B. list WidgetSearch xs 1
492
492
493
- move :: (List s -> List s ) -> B. EventM n (AppEnv s ) ()
493
+ move :: (List -> List ) -> B. EventM n (AppEnv s ) ()
494
494
move = moveF . modify
495
495
496
- moveF :: B. EventM n ( List s ) () -> B. EventM n (AppEnv s ) ()
496
+ moveF :: B. EventM n List () -> B. EventM n (AppEnv s ) ()
497
497
moveF f = do
498
498
B. zoom aeCurrPaneL f
499
499
modify repopulateNextPane
@@ -534,7 +534,7 @@ repopulateNextPane env@AppEnv {aeActualStoreEnv, aeNextPane, aeSortOrder} =
534
534
aeNextPane
535
535
}
536
536
537
- sortPane :: SortOrder -> List s -> List s
537
+ sortPane :: SortOrder -> List -> List
538
538
sortPane so l =
539
539
let selected = B. listSelectedElement l
540
540
elems =
@@ -552,10 +552,10 @@ sortPanes env@AppEnv {aeParents, aePrevPane, aeCurrPane, aeNextPane, aeSortOrder
552
552
aePrevPane = sortPane aeSortOrder aePrevPane
553
553
}
554
554
555
- selectedPath :: AppEnv s -> Path s
555
+ selectedPath :: AppEnv s -> Path
556
556
selectedPath = NE. head . selectedPaths
557
557
558
- selectedPaths :: AppEnv s -> NonEmpty ( Path s )
558
+ selectedPaths :: AppEnv s -> NonEmpty Path
559
559
selectedPaths AppEnv {aePrevPane, aeCurrPane, aeParents} =
560
560
let parents =
561
561
mapMaybe
@@ -565,7 +565,7 @@ selectedPaths AppEnv {aePrevPane, aeCurrPane, aeParents} =
565
565
Nothing -> error " invariant violation: no selected element"
566
566
Just (_, p) -> p :| parents
567
567
568
- selectPath :: NonEmpty ( Path s ) -> AppEnv s -> AppEnv s
568
+ selectPath :: NonEmpty Path -> AppEnv s -> AppEnv s
569
569
selectPath path env
570
570
| (spName <$> path) == (spName <$> selectedPaths env) =
571
571
env
@@ -602,9 +602,9 @@ selectPath path env@AppEnv {aeActualStoreEnv} =
602
602
mkList ::
603
603
SortOrder ->
604
604
n ->
605
- Seq ( Path s ) ->
606
- Maybe ( Path s ) ->
607
- B. GenericList n Seq ( Path s )
605
+ Seq Path ->
606
+ Maybe Path ->
607
+ B. GenericList n Seq Path
608
608
mkList sortOrder name possible selected =
609
609
let contents = S. sortBy (compareBySortOrder sortOrder) possible
610
610
in B. list name contents 1
0 commit comments