perform action on completion of goalie edit
This commit is contained in:
@@ -39,89 +39,103 @@ import Mtlstats.Util
|
|||||||
editGoalieC :: EditGoalieState -> Controller
|
editGoalieC :: EditGoalieState -> Controller
|
||||||
editGoalieC egs
|
editGoalieC egs
|
||||||
| null $ egs^.egsSelectedGoalie = selectC
|
| null $ egs^.egsSelectedGoalie = selectC
|
||||||
| otherwise = editC $ egs^.egsMode
|
| otherwise = editC (egs^.egsCallback) (egs^.egsMode)
|
||||||
|
|
||||||
selectC :: Controller
|
selectC :: Controller
|
||||||
selectC = promptController goalieToEditPrompt
|
selectC = promptController goalieToEditPrompt
|
||||||
|
|
||||||
editC :: EditGoalieMode -> Controller
|
editC :: Action () -> EditGoalieMode -> Controller
|
||||||
editC = \case
|
editC cb =
|
||||||
EGMenu -> menuC
|
( \case
|
||||||
EGNumber -> numberC
|
EGMenu -> menuC
|
||||||
EGName -> nameC
|
EGNumber -> numberC
|
||||||
EGYtd -> ytdMenuC
|
EGName -> nameC
|
||||||
EGLifetime -> lifetimeMenuC
|
EGYtd -> ytdMenuC
|
||||||
EGYtdGames b -> ytdGamesC b
|
EGLifetime -> lifetimeMenuC
|
||||||
EGYtdMins b -> ytdMinsC b
|
EGYtdGames b -> ytdGamesC b
|
||||||
EGYtdGoals b -> ytdGoalsC b
|
EGYtdMins b -> ytdMinsC b
|
||||||
EGYtdShutouts b -> ytdShutoutsC b
|
EGYtdGoals b -> ytdGoalsC b
|
||||||
EGYtdWins b -> ytdWinsC b
|
EGYtdShutouts b -> ytdShutoutsC b
|
||||||
EGYtdLosses b -> ytdLossesC b
|
EGYtdWins b -> ytdWinsC b
|
||||||
EGYtdTies -> ytdTiesC
|
EGYtdLosses b -> ytdLossesC b
|
||||||
EGLtGames b -> ltGamesC b
|
EGYtdTies -> ytdTiesC
|
||||||
EGLtMins b -> ltMinsC b
|
EGLtGames b -> ltGamesC b
|
||||||
EGLtGoals b -> ltGoalsC b
|
EGLtMins b -> ltMinsC b
|
||||||
EGLtShutouts b -> ltShutoutsC b
|
EGLtGoals b -> ltGoalsC b
|
||||||
EGLtWins b -> ltWinsC b
|
EGLtShutouts b -> ltShutoutsC b
|
||||||
EGLtLosses b -> ltLossesC b
|
EGLtWins b -> ltWinsC b
|
||||||
EGLtTies -> ltTiesC
|
EGLtLosses b -> ltLossesC b
|
||||||
|
EGLtTies -> ltTiesC
|
||||||
|
) <*> return cb
|
||||||
|
|
||||||
menuC :: Controller
|
menuC :: Action () -> Controller
|
||||||
menuC = menuControllerWith header editGoalieMenu
|
menuC _ = menuControllerWith header editGoalieMenu
|
||||||
|
|
||||||
numberC :: Controller
|
numberC :: Action () -> Controller
|
||||||
numberC = promptController editGoalieNumberPrompt
|
numberC = promptController . editGoalieNumberPrompt
|
||||||
|
|
||||||
nameC :: Controller
|
nameC :: Action () -> Controller
|
||||||
nameC = promptController editGoalieNamePrompt
|
nameC = promptController . editGoalieNamePrompt
|
||||||
|
|
||||||
ytdMenuC :: Controller
|
ytdMenuC :: Action () -> Controller
|
||||||
ytdMenuC = menuControllerWith header editGoalieYtdMenu
|
ytdMenuC _ = menuControllerWith header editGoalieYtdMenu
|
||||||
|
|
||||||
lifetimeMenuC :: Controller
|
lifetimeMenuC :: Action () -> Controller
|
||||||
lifetimeMenuC = menuControllerWith header editGoalieLtMenu
|
lifetimeMenuC _ = menuControllerWith header editGoalieLtMenu
|
||||||
|
|
||||||
ytdGamesC :: Bool -> Controller
|
ytdGamesC :: Bool -> Action () -> Controller
|
||||||
ytdGamesC = promptController . editGoalieYtdGamesPrompt
|
ytdGamesC = curry $ promptController .
|
||||||
|
uncurry editGoalieYtdGamesPrompt
|
||||||
|
|
||||||
ytdMinsC :: Bool -> Controller
|
ytdMinsC :: Bool -> Action () -> Controller
|
||||||
ytdMinsC = promptController . editGoalieYtdMinsPrompt
|
ytdMinsC = curry $ promptController .
|
||||||
|
uncurry editGoalieYtdMinsPrompt
|
||||||
|
|
||||||
ytdGoalsC :: Bool -> Controller
|
ytdGoalsC :: Bool -> Action () -> Controller
|
||||||
ytdGoalsC = promptController . editGoalieYtdGoalsPrompt
|
ytdGoalsC = curry $ promptController .
|
||||||
|
uncurry editGoalieYtdGoalsPrompt
|
||||||
|
|
||||||
ytdShutoutsC :: Bool -> Controller
|
ytdShutoutsC :: Bool -> Action () -> Controller
|
||||||
ytdShutoutsC = promptController . editGoalieYtdShutoutsPrompt
|
ytdShutoutsC = curry $ promptController .
|
||||||
|
uncurry editGoalieYtdShutoutsPrompt
|
||||||
|
|
||||||
ytdWinsC :: Bool -> Controller
|
ytdWinsC :: Bool -> Action () -> Controller
|
||||||
ytdWinsC = promptController . editGoalieYtdWinsPrompt
|
ytdWinsC = curry $ promptController .
|
||||||
|
uncurry editGoalieYtdWinsPrompt
|
||||||
|
|
||||||
ytdLossesC :: Bool -> Controller
|
ytdLossesC :: Bool -> Action () -> Controller
|
||||||
ytdLossesC = promptController . editGoalieYtdLossesPrompt
|
ytdLossesC = curry $ promptController .
|
||||||
|
uncurry editGoalieYtdLossesPrompt
|
||||||
|
|
||||||
ytdTiesC :: Controller
|
ytdTiesC :: Action () -> Controller
|
||||||
ytdTiesC = promptController editGoalieYtdTiesPrompt
|
ytdTiesC = promptController . editGoalieYtdTiesPrompt
|
||||||
|
|
||||||
ltGamesC :: Bool -> Controller
|
ltGamesC :: Bool -> Action () -> Controller
|
||||||
ltGamesC = promptController . editGoalieLtGamesPrompt
|
ltGamesC = curry $ promptController .
|
||||||
|
uncurry editGoalieLtGamesPrompt
|
||||||
|
|
||||||
ltMinsC :: Bool -> Controller
|
ltMinsC :: Bool -> Action () -> Controller
|
||||||
ltMinsC = promptController . editGoalieLtMinsPrompt
|
ltMinsC = curry $ promptController .
|
||||||
|
uncurry editGoalieLtMinsPrompt
|
||||||
|
|
||||||
ltGoalsC :: Bool -> Controller
|
ltGoalsC :: Bool -> Action() -> Controller
|
||||||
ltGoalsC = promptController . editGoalieLtGoalsPrompt
|
ltGoalsC = curry $ promptController .
|
||||||
|
uncurry editGoalieLtGoalsPrompt
|
||||||
|
|
||||||
ltShutoutsC :: Bool -> Controller
|
ltShutoutsC :: Bool -> Action () -> Controller
|
||||||
ltShutoutsC = promptController . editGoalieLtShutoutsPrompt
|
ltShutoutsC = curry $ promptController .
|
||||||
|
uncurry editGoalieLtShutoutsPrompt
|
||||||
|
|
||||||
ltWinsC :: Bool -> Controller
|
ltWinsC :: Bool -> Action () -> Controller
|
||||||
ltWinsC = promptController . editGoalieLtWinsPrompt
|
ltWinsC = curry $ promptController .
|
||||||
|
uncurry editGoalieLtWinsPrompt
|
||||||
|
|
||||||
ltLossesC :: Bool -> Controller
|
ltLossesC :: Bool -> Action () -> Controller
|
||||||
ltLossesC = promptController . editGoalieLtLossesPrompt
|
ltLossesC = curry $ promptController .
|
||||||
|
uncurry editGoalieLtLossesPrompt
|
||||||
|
|
||||||
ltTiesC :: Controller
|
ltTiesC :: Action () -> Controller
|
||||||
ltTiesC = promptController editGoalieLtTiesPrompt
|
ltTiesC = promptController . editGoalieLtTiesPrompt
|
||||||
|
|
||||||
header :: ProgState -> C.Update ()
|
header :: ProgState -> C.Update ()
|
||||||
header s = C.drawString $ fromMaybe "" $ do
|
header s = C.drawString $ fromMaybe "" $ do
|
||||||
|
|||||||
@@ -52,85 +52,119 @@ goalieToEditPrompt = selectGoaliePrompt "Goalie to edit: " $
|
|||||||
modify . (progMode.editGoalieStateL.egsSelectedGoalie .~)
|
modify . (progMode.editGoalieStateL.egsSelectedGoalie .~)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's number
|
-- | Prompt to edit a goalie's number
|
||||||
editGoalieNumberPrompt :: Prompt
|
editGoalieNumberPrompt
|
||||||
|
:: Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
|
-> Prompt
|
||||||
editGoalieNumberPrompt = editNum "Goalie number: " EGMenu
|
editGoalieNumberPrompt = editNum "Goalie number: " EGMenu
|
||||||
(gNumber .~)
|
(gNumber .~)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's name
|
-- | Prompt to edit a goalie's name
|
||||||
editGoalieNamePrompt :: Prompt
|
editGoalieNamePrompt
|
||||||
editGoalieNamePrompt = namePrompt "Goalie name: " $ \name ->
|
:: Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
|
-> Prompt
|
||||||
|
editGoalieNamePrompt cb = namePrompt "Goalie name: " $ \name -> do
|
||||||
if null name
|
if null name
|
||||||
then goto EGMenu
|
then goto EGMenu
|
||||||
else doEdit EGMenu $ gName .~ name
|
else doEdit EGMenu $ gName .~ name
|
||||||
|
cb
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD games played
|
-- | Prompt to edit a goalie's YTD games played
|
||||||
editGoalieYtdGamesPrompt
|
editGoalieYtdGamesPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieYtdGamesPrompt batchMode =
|
editGoalieYtdGamesPrompt batchMode cb =
|
||||||
editNum "Year-to-date games played: " mode
|
editNum "Year-to-date games played: " mode
|
||||||
(gYtd.gsGames .~)
|
(gYtd.gsGames .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGYtdMins True else EGYtd
|
(mode, cb') = if batchMode
|
||||||
|
then (EGYtdMins True, return ())
|
||||||
|
else (EGYtd, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD minutes played
|
-- | Prompt to edit a goalie's YTD minutes played
|
||||||
editGoalieYtdMinsPrompt
|
editGoalieYtdMinsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieYtdMinsPrompt batchMode =
|
editGoalieYtdMinsPrompt batchMode cb =
|
||||||
editNum "Year-to-date minutes played: " mode
|
editNum "Year-to-date minutes played: " mode
|
||||||
(gYtd.gsMinsPlayed .~)
|
(gYtd.gsMinsPlayed .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGYtdGoals True else EGYtd
|
(mode, cb') = if batchMode
|
||||||
|
then (EGYtdGoals True, return ())
|
||||||
|
else (EGYtd, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD goales allowed
|
-- | Prompt to edit a goalie's YTD goales allowed
|
||||||
editGoalieYtdGoalsPrompt
|
editGoalieYtdGoalsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieYtdGoalsPrompt batchMode =
|
editGoalieYtdGoalsPrompt batchMode cb =
|
||||||
editNum "Year-to-date goals allowed: " mode
|
editNum "Year-to-date goals allowed: " mode
|
||||||
(gYtd.gsGoalsAllowed .~)
|
(gYtd.gsGoalsAllowed .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGYtdShutouts True else EGYtd
|
(mode, cb') = if batchMode
|
||||||
|
then (EGYtdShutouts True, return ())
|
||||||
|
else (EGYtd, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD shutouts
|
-- | Prompt to edit a goalie's YTD shutouts
|
||||||
editGoalieYtdShutoutsPrompt
|
editGoalieYtdShutoutsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieYtdShutoutsPrompt batchMode =
|
editGoalieYtdShutoutsPrompt batchMode cb =
|
||||||
editNum "Year-to-date shutouts: " mode
|
editNum "Year-to-date shutouts: " mode
|
||||||
(gYtd.gsShutouts .~)
|
(gYtd.gsShutouts .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGYtdWins True else EGYtd
|
(mode, cb') = if batchMode
|
||||||
|
then (EGYtdWins True, return ())
|
||||||
|
else (EGYtd, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD wins
|
-- | Prompt to edit a goalie's YTD wins
|
||||||
editGoalieYtdWinsPrompt
|
editGoalieYtdWinsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieYtdWinsPrompt batchMode =
|
editGoalieYtdWinsPrompt batchMode cb =
|
||||||
editNum "Year-to-date wins: " mode
|
editNum "Year-to-date wins: " mode
|
||||||
(gYtd.gsWins .~)
|
(gYtd.gsWins .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGYtdLosses True else EGYtd
|
(mode, cb') = if batchMode
|
||||||
|
then (EGYtdLosses True, return ())
|
||||||
|
else (EGYtd, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD losses
|
-- | Prompt to edit a goalie's YTD losses
|
||||||
editGoalieYtdLossesPrompt
|
editGoalieYtdLossesPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieYtdLossesPrompt batchMode =
|
editGoalieYtdLossesPrompt batchMode cb =
|
||||||
editNum "Year-to-date losses: " mode
|
editNum "Year-to-date losses: " mode
|
||||||
(gYtd.gsLosses .~)
|
(gYtd.gsLosses .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGYtdTies else EGYtd
|
(mode, cb') = if batchMode
|
||||||
|
then (EGYtdTies, return ())
|
||||||
|
else (EGYtd, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's YTD ties
|
-- | Prompt to edit a goalie's YTD ties
|
||||||
editGoalieYtdTiesPrompt :: Prompt
|
editGoalieYtdTiesPrompt
|
||||||
|
:: Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
|
-> Prompt
|
||||||
editGoalieYtdTiesPrompt = editNum "Year-to-date ties: " EGYtd
|
editGoalieYtdTiesPrompt = editNum "Year-to-date ties: " EGYtd
|
||||||
(gYtd.gsTies .~)
|
(gYtd.gsTies .~)
|
||||||
|
|
||||||
@@ -138,70 +172,97 @@ editGoalieYtdTiesPrompt = editNum "Year-to-date ties: " EGYtd
|
|||||||
editGoalieLtGamesPrompt
|
editGoalieLtGamesPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieLtGamesPrompt batchMode =
|
editGoalieLtGamesPrompt batchMode cb =
|
||||||
editNum "Lifetime games played: " mode
|
editNum "Lifetime games played: " mode
|
||||||
(gLifetime.gsGames .~)
|
(gLifetime.gsGames .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGLtMins True else EGLifetime
|
(mode, cb') = if batchMode
|
||||||
|
then (EGLtMins True, return ())
|
||||||
|
else (EGLifetime, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's lifetime minutes played
|
-- | Prompt to edit a goalie's lifetime minutes played
|
||||||
editGoalieLtMinsPrompt
|
editGoalieLtMinsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieLtMinsPrompt batchMode =
|
editGoalieLtMinsPrompt batchMode cb =
|
||||||
editNum "Lifetime minutes played: " mode
|
editNum "Lifetime minutes played: " mode
|
||||||
(gLifetime.gsMinsPlayed .~)
|
(gLifetime.gsMinsPlayed .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGLtGoals True else EGLifetime
|
(mode, cb') = if batchMode
|
||||||
|
then (EGLtGoals True, return ())
|
||||||
|
else (EGLifetime, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's lifetime goals allowed
|
-- | Prompt to edit a goalie's lifetime goals allowed
|
||||||
editGoalieLtGoalsPrompt
|
editGoalieLtGoalsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieLtGoalsPrompt batchMode =
|
editGoalieLtGoalsPrompt batchMode cb =
|
||||||
editNum "Lifetime goals allowed: " mode
|
editNum "Lifetime goals allowed: " mode
|
||||||
(gLifetime.gsGoalsAllowed .~)
|
(gLifetime.gsGoalsAllowed .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGLtShutouts True else EGLifetime
|
(mode, cb') = if batchMode
|
||||||
|
then (EGLtShutouts True, return ())
|
||||||
|
else (EGLifetime, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's lifetime shutouts
|
-- | Prompt to edit a goalie's lifetime shutouts
|
||||||
editGoalieLtShutoutsPrompt
|
editGoalieLtShutoutsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieLtShutoutsPrompt batchMode =
|
editGoalieLtShutoutsPrompt batchMode cb =
|
||||||
editNum "Lifetime shutouts: " mode
|
editNum "Lifetime shutouts: " mode
|
||||||
(gLifetime.gsShutouts .~)
|
(gLifetime.gsShutouts .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGLtWins True else EGLifetime
|
(mode, cb') = if batchMode
|
||||||
|
then (EGLtWins True, return ())
|
||||||
|
else (EGLifetime, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's lifetime wins
|
-- | Prompt to edit a goalie's lifetime wins
|
||||||
editGoalieLtWinsPrompt
|
editGoalieLtWinsPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieLtWinsPrompt batchMode =
|
editGoalieLtWinsPrompt batchMode cb =
|
||||||
editNum "Lifetime wins: " mode
|
editNum "Lifetime wins: " mode
|
||||||
(gLifetime.gsWins .~)
|
(gLifetime.gsWins .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGLtLosses True else EGLifetime
|
(mode, cb') = if batchMode
|
||||||
|
then (EGLtLosses True, return ())
|
||||||
|
else (EGLifetime, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's lifetime losses
|
-- | Prompt to edit a goalie's lifetime losses
|
||||||
editGoalieLtLossesPrompt
|
editGoalieLtLossesPrompt
|
||||||
:: Bool
|
:: Bool
|
||||||
-- ^ Indicates whether or not we're in batch mode
|
-- ^ Indicates whether or not we're in batch mode
|
||||||
|
-> Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editGoalieLtLossesPrompt batchMode =
|
editGoalieLtLossesPrompt batchMode cb =
|
||||||
editNum "Lifetime losses: " mode
|
editNum "Lifetime losses: " mode
|
||||||
(gLifetime.gsLosses .~)
|
(gLifetime.gsLosses .~) cb'
|
||||||
where
|
where
|
||||||
mode = if batchMode then EGLtTies else EGLifetime
|
(mode, cb') = if batchMode
|
||||||
|
then (EGLtTies, return ())
|
||||||
|
else (EGLifetime, cb)
|
||||||
|
|
||||||
-- | Prompt to edit a goalie's lifetime ties
|
-- | Prompt to edit a goalie's lifetime ties
|
||||||
editGoalieLtTiesPrompt :: Prompt
|
editGoalieLtTiesPrompt
|
||||||
|
:: Action ()
|
||||||
|
-- ^ Action to perform on completion
|
||||||
|
-> Prompt
|
||||||
editGoalieLtTiesPrompt = editNum "Lifetime ties: " EGLifetime
|
editGoalieLtTiesPrompt = editNum "Lifetime ties: " EGLifetime
|
||||||
(gLifetime.gsTies .~)
|
(gLifetime.gsTies .~)
|
||||||
|
|
||||||
@@ -209,10 +270,13 @@ editNum
|
|||||||
:: String
|
:: String
|
||||||
-> EditGoalieMode
|
-> EditGoalieMode
|
||||||
-> (Int -> Goalie -> Goalie)
|
-> (Int -> Goalie -> Goalie)
|
||||||
|
-> Action ()
|
||||||
-> Prompt
|
-> Prompt
|
||||||
editNum pStr mode f = numPromptWithFallback pStr
|
editNum pStr mode f cb = numPromptWithFallback pStr
|
||||||
(goto mode)
|
(goto mode >> cb)
|
||||||
(doEdit mode . f)
|
(\num -> do
|
||||||
|
doEdit mode $ f num
|
||||||
|
cb)
|
||||||
|
|
||||||
doEdit :: EditGoalieMode -> (Goalie -> Goalie) -> Action ()
|
doEdit :: EditGoalieMode -> (Goalie -> Goalie) -> Action ()
|
||||||
doEdit mode f = do
|
doEdit mode f = do
|
||||||
|
|||||||
Reference in New Issue
Block a user