allow player creation callbacks to be impure

This commit is contained in:
Jonathan Lamothe
2019-09-19 04:01:28 -04:00
parent 8277f8bac7
commit 11a66cfd33
3 changed files with 12 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
module Mtlstats.Control (dispatch) where
import Control.Monad (when)
import Control.Monad (join, when)
import Control.Monad.Trans.State (gets, modify)
import Data.Char (toUpper)
import Data.Maybe (fromJust)
@@ -236,12 +236,11 @@ confirmCreatePlayerC = Controller
return C.CursorInvisible
, handleController = \e -> do
case ynHandler e of
Just True -> do
Just True -> do
modify addPlayer
gets (view $ progMode.createPlayerStateL.cpsSuccessCallback)
>>= modify
Just False -> gets (view $ progMode.createPlayerStateL.cpsFailureCallback)
>>= modify
Nothing -> return ()
join $ gets $ view $ progMode.createPlayerStateL.cpsSuccessCallback
Just False ->
join $ gets $ view $ progMode.createPlayerStateL.cpsFailureCallback
Nothing -> return ()
return True
}