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