hlint suggestions
This commit is contained in:
parent
53c49492cb
commit
9ee33cbd03
|
@ -124,12 +124,13 @@ awardGoal n ps = ps
|
||||||
(\m -> let
|
(\m -> let
|
||||||
stats = M.findWithDefault newPlayerStats n m
|
stats = M.findWithDefault newPlayerStats n m
|
||||||
in M.insert n (stats & psGoals %~ succ) m)
|
in M.insert n (stats & psGoals %~ succ) m)
|
||||||
& database.dbPlayers %~ map
|
& database.dbPlayers %~ zipWith
|
||||||
(\(i, p) -> if i == n
|
(\i p -> if i == n
|
||||||
then p
|
then p
|
||||||
& pYtd.psGoals %~ succ
|
& pYtd.psGoals %~ succ
|
||||||
& pLifetime.psGoals %~ succ
|
& pLifetime.psGoals %~ succ
|
||||||
else p) . zip [0..]
|
else p)
|
||||||
|
[0..]
|
||||||
|
|
||||||
-- | Awards an assist to a player
|
-- | Awards an assist to a player
|
||||||
awardAssist
|
awardAssist
|
||||||
|
@ -142,12 +143,13 @@ awardAssist n ps = ps
|
||||||
(\m -> let
|
(\m -> let
|
||||||
stats = M.findWithDefault newPlayerStats n m
|
stats = M.findWithDefault newPlayerStats n m
|
||||||
in M.insert n (stats & psAssists %~ succ) m)
|
in M.insert n (stats & psAssists %~ succ) m)
|
||||||
& database.dbPlayers %~ map
|
& database.dbPlayers %~ zipWith
|
||||||
(\(i, p) -> if i == n
|
(\i p -> if i == n
|
||||||
then p
|
then p
|
||||||
& pYtd.psAssists %~ succ
|
& pYtd.psAssists %~ succ
|
||||||
& pLifetime.psAssists %~ succ
|
& pLifetime.psAssists %~ succ
|
||||||
else p) . zip [0..]
|
else p)
|
||||||
|
[0..]
|
||||||
|
|
||||||
-- | Resets the entered data for the current goal
|
-- | Resets the entered data for the current goal
|
||||||
resetGoalData :: ProgState -> ProgState
|
resetGoalData :: ProgState -> ProgState
|
||||||
|
|
|
@ -170,10 +170,11 @@ gameGoalieMenu s = let
|
||||||
goalie <- nth n $ s^.database.dbGoalies
|
goalie <- nth n $ s^.database.dbGoalies
|
||||||
Just (n, goalie))
|
Just (n, goalie))
|
||||||
gids
|
gids
|
||||||
in Menu title () $ map
|
in Menu title () $ zipWith
|
||||||
(\(ch, (gid, goalie)) -> MenuItem ch (goalieSummary goalie) $
|
(\ch (gid, goalie) -> MenuItem ch (goalieSummary goalie) $
|
||||||
modify $ GI.setGameGoalie gid) $
|
modify $ GI.setGameGoalie gid)
|
||||||
zip ['1'..] goalies
|
['1'..]
|
||||||
|
goalies
|
||||||
|
|
||||||
-- | The edit menu
|
-- | The edit menu
|
||||||
editMenu :: Menu ()
|
editMenu :: Menu ()
|
||||||
|
|
|
@ -164,9 +164,7 @@ numPromptWithFallback pStr fallback act = Prompt
|
||||||
, promptProcessChar = \ch str -> if isDigit ch
|
, promptProcessChar = \ch str -> if isDigit ch
|
||||||
then str ++ [ch]
|
then str ++ [ch]
|
||||||
else str
|
else str
|
||||||
, promptAction = \inStr -> case readMaybe inStr of
|
, promptAction = maybe fallback act . readMaybe
|
||||||
Nothing -> fallback
|
|
||||||
Just n -> act n
|
|
||||||
, promptSpecialKey = const $ return ()
|
, promptSpecialKey = const $ return ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,8 +241,7 @@ filteredPlayerReport width label criteria showTotals lineNumbers ps = let
|
||||||
else repeat ""
|
else repeat ""
|
||||||
|
|
||||||
table = overlayLast olayText
|
table = overlayLast olayText
|
||||||
$ map (\(ln, line) -> overlay ln $ centre width line)
|
$ zipWith (\ln line -> overlay ln $ centre width line) lnOverlay
|
||||||
$ zip lnOverlay
|
|
||||||
$ complexTable ([right, left] ++ repeat right)
|
$ complexTable ([right, left] ++ repeat right)
|
||||||
$ tHeader : body ++ if showTotals
|
$ tHeader : body ++ if showTotals
|
||||||
then [separator, totals]
|
then [separator, totals]
|
||||||
|
@ -301,8 +300,7 @@ goalieReport width showTotals lineNumbers goalieData = let
|
||||||
then "" : [right 2 $ show x | x <- [(1 :: Int)..]]
|
then "" : [right 2 $ show x | x <- [(1 :: Int)..]]
|
||||||
else repeat ""
|
else repeat ""
|
||||||
|
|
||||||
in map (\(ln, line) -> overlay ln $ centre width line)
|
in zipWith (\ln line -> overlay ln $ centre width line) lnOverlay
|
||||||
$ zip lnOverlay
|
|
||||||
$ overlayLast olayText
|
$ overlayLast olayText
|
||||||
$ complexTable ([right, left] ++ repeat right)
|
$ complexTable ([right, left] ++ repeat right)
|
||||||
$ header : body ++ if showTotals
|
$ header : body ++ if showTotals
|
||||||
|
|
|
@ -208,9 +208,8 @@ import Data.Aeson
|
||||||
, (.=)
|
, (.=)
|
||||||
)
|
)
|
||||||
import Data.Char (toUpper)
|
import Data.Char (toUpper)
|
||||||
import Data.List (isInfixOf)
|
import Data.List (find, isInfixOf)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Maybe (listToMaybe)
|
|
||||||
import Lens.Micro (Lens', lens, (&), (^.), (.~))
|
import Lens.Micro (Lens', lens, (&), (^.), (.~))
|
||||||
import Lens.Micro.TH (makeLenses)
|
import Lens.Micro.TH (makeLenses)
|
||||||
import qualified UI.NCurses as C
|
import qualified UI.NCurses as C
|
||||||
|
@ -1019,7 +1018,7 @@ playerSearchExact
|
||||||
-> Maybe (Int, Player)
|
-> Maybe (Int, Player)
|
||||||
-- ^ The player's index and value
|
-- ^ The player's index and value
|
||||||
playerSearchExact sStr =
|
playerSearchExact sStr =
|
||||||
listToMaybe . filter match . zip [0..]
|
find match . zip [0..]
|
||||||
where match (_, p) = p^.pName == sStr
|
where match (_, p) = p^.pName == sStr
|
||||||
|
|
||||||
-- | Modifies a player with a given name
|
-- | Modifies a player with a given name
|
||||||
|
|
|
@ -52,8 +52,9 @@ modifyNth
|
||||||
-> [a]
|
-> [a]
|
||||||
-- ^ The list
|
-- ^ The list
|
||||||
-> [a]
|
-> [a]
|
||||||
modifyNth n f = map (\(i, x) -> if i == n then f x else x)
|
modifyNth n f = zipWith
|
||||||
. zip [0..]
|
(\i x -> if i == n then f x else x)
|
||||||
|
[0..]
|
||||||
|
|
||||||
-- | Modify a value indexed by a given key in a map using a default
|
-- | Modify a value indexed by a given key in a map using a default
|
||||||
-- initial value if not present
|
-- initial value if not present
|
||||||
|
|
Loading…
Reference in New Issue
Block a user