Replace list by triple in deal function following error on failable pattern with GHC 8.6.3
This commit is contained in:
parent
18d544e13f
commit
14d58d002e
1 changed files with 3 additions and 2 deletions
|
@ -10,11 +10,11 @@ import Hanafuda.KoiKoi.Game (Game, Mode(..), On(..), Step(..), end, stop)
|
|||
import qualified Hanafuda.Player as Player (deal, get, next, score)
|
||||
import Data.Map ((!), insert)
|
||||
import Control.Monad.IO.Class (MonadIO)
|
||||
import Control.Monad.State (replicateM, runState, state)
|
||||
import Control.Monad.State (runState, state)
|
||||
|
||||
deal :: (MonadIO m, Ord player) => On player -> m (On player)
|
||||
deal on@(On_ {players}) = do
|
||||
([hand1, hand2, river], deck) <- fmap (runState (replicateM 3 take8)) $ shuffle cards
|
||||
((hand1, hand2, river), deck) <- runState getTriple <$> shuffle cards
|
||||
return on {
|
||||
players = Player.deal players [hand1, hand2]
|
||||
, deck
|
||||
|
@ -22,6 +22,7 @@ deal on@(On_ {players}) = do
|
|||
}
|
||||
where
|
||||
take8 = state $ splitAt 8
|
||||
getTriple = (,,) <$> take8 <*> take8 <*> take8
|
||||
|
||||
next :: (MonadIO m, Ord player) => On player -> m (Game player)
|
||||
next on@(On_ {mode, scores, month, players, oyake, winning}) =
|
||||
|
|
Loading…
Reference in a new issue