Skip to content

Commit 06e0c71

Browse files
Morra - Some changes
1 parent fb9083c commit 06e0c71

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

chapter26/src/Morra.hs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
module Morra where
2-
import Data.Maybe
3-
import Data.Monoid
2+
3+
import Control.Applicative
44
import Control.Monad
55
import Control.Monad.IO.Class
66
import Control.Monad.Trans.Class
77
import Control.Monad.Trans.Maybe
88
import Control.Monad.Trans.Reader
99
import Control.Monad.Trans.State
10-
import Control.Applicative
10+
import Data.Maybe
11+
import Data.Monoid
1112
import System.Random
1213
-- StateT should save scores of both player and computer
1314
-- Computer should choose its hand randomly
@@ -36,7 +37,7 @@ instance Monoid Score where
3637
mempty = Score (mempty, mempty)
3738
(Score (h1, a1)) `mappend` (Score (h2, a2)) =
3839
Score ((h1 `mappend` h2), (a1 `mappend` a2))
39-
40+
4041
data Winner
4142
= Humans
4243
| Computer
@@ -103,7 +104,7 @@ process :: Score -> Maybe Score -> IO Score
103104
process current maybeNext =
104105
case maybeNext of
105106
Just next -> evalStateT go' (current `mappend` next)
106-
Nothing -> return current
107+
Nothing -> return current
107108

108109
go' :: StateT Score IO Score
109110
go' = do

0 commit comments

Comments
 (0)