1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Suggest
11import qualified Data.Char as Char
12import qualified Data.List as List
13import qualified Text.EditDistance as Dist
20distance :: String -> String -> Int
22 Dist.restrictedDamerauLevenshteinDistance Dist.defaultEditCosts x y
29sort :: String -> (a -> String) -> [a] -> [a]
30sort target toString values =
31 List.sortOn (distance (toLower target) . toLower . toString) values
34toLower :: String -> String
36 map Char.toLower string
43rank :: String -> (a -> String) -> [a] -> [(Int,a)]
44rank target toString values =
47 distance (toLower target) (toLower (toString v))
52 List.sortOn fst (map addRank values)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list