implemented posSearch

This commit is contained in:
Jonathan Lamothe committed 2020-02-11 23:58:47 -05:00
1 parent 457298e565
commit 25e4929f0b
2 files changed
+33 -9

No files matched your search

+6 -1
View File
@@ -26,6 +26,8 @@ module Mtlstats.Helpers.Position
, getPositions
) where
import Data.Char (toUpper)
import Data.List (isInfixOf)
import qualified Data.Set as S
import Lens.Micro ((^.))
@@ -39,7 +41,10 @@ posSearch
-- ^ The database
-> [(Int, String)]
-- ^ A list of result indices and their values
posSearch = undefined
posSearch sStr db = filter sFunc $ zip [0..] ps
where
sFunc (_, pos) = map toUpper sStr `isInfixOf` map toUpper pos
ps = getPositions db
-- | Searches the 'Database' for an exact position
posSearchExact