implemented CreateGoalieState type

This commit is contained in:
Jonathan Lamothe 2019-10-21 23:53:41 -04:00
parent a234d8e802
commit 1782c0bc48

View File

@ -30,6 +30,7 @@ module Mtlstats.Types (
GameState (..),
GameType (..),
CreatePlayerState (..),
CreateGoalieState (..),
Database (..),
Player (..),
PlayerStats (..),
@ -69,6 +70,11 @@ module Mtlstats.Types (
cpsPosition,
cpsSuccessCallback,
cpsFailureCallback,
-- ** CreateGoalieState Lenses
cgsNumber,
cgsName,
cgsSuccessCallback,
cgsFailureCallback,
-- ** Database Lenses
dbPlayers,
dbGoalies,
@ -107,6 +113,7 @@ module Mtlstats.Types (
newProgState,
newGameState,
newCreatePlayerState,
newCreateGoalieState,
newDatabase,
newPlayer,
newPlayerStats,
@ -254,6 +261,18 @@ data CreatePlayerState = CreatePlayerState
-- ^ The function to call on failure
}
-- | Goalie creation status
data CreateGoalieState = CreateGoalieState
{ _cgsNumber :: Maybe Int
-- ^ The goalie's number
, _cgsName :: String
-- ^ The goalie's name
, _cgsSuccessCallback :: Action ()
-- ^ The function to call on success
, _cgsFailureCallback :: Action ()
-- ^ The function to call on failure
}
-- | Represents the database
data Database = Database
{ _dbPlayers :: [Player]
@ -481,6 +500,7 @@ data Prompt = Prompt
makeLenses ''ProgState
makeLenses ''GameState
makeLenses ''CreatePlayerState
makeLenses ''CreateGoalieState
makeLenses ''Database
makeLenses ''Player
makeLenses ''PlayerStats
@ -542,6 +562,15 @@ newCreatePlayerState = CreatePlayerState
, _cpsFailureCallback = return ()
}
-- | Constructor for a 'CreateGoalieState'
newCreateGoalieState :: CreateGoalieState
newCreateGoalieState = CreateGoalieState
{ _cgsNumber = Nothing
, _cgsName = ""
, _cgsSuccessCallback = return ()
, _cgsFailureCallback = return ()
}
-- | Constructor for a 'Database'
newDatabase :: Database
newDatabase = Database