File tree Expand file tree Collapse file tree 3 files changed +5
-10
lines changed
Expand file tree Collapse file tree 3 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ library
4040 random == 1. *,
4141 split == 0.2. *,
4242 ansi-wl-pprint == 0.6. *,
43- operational == 0.2. *
43+ operational == 0.2. *,
44+ semigroups == 0.13. *
4445 -- hs-source-dirs:
4546 default-language : Haskell2010
4647
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import qualified Data.Map.Strict as M
2020import Control.Monad.Operational
2121import Control.Monad.State.Strict
2222import Control.Monad.Error
23+ import Data.List.NonEmpty
2324import Control.Applicative
2425import System.Random
2526
@@ -64,16 +65,8 @@ data PlayerAction = PlayerAction ActionType Card
6465data ActionType = Play | Drop | BuildCompany
6566 deriving Eq
6667
67- -- | Some types for non empty lists
68- data NonEmpty a = NonEmpty a [a ]
69-
7068_NonEmpty :: Prism' [a ] (NonEmpty a )
71- _NonEmpty = prism fromNonEmpty toNonEmpty
72- where
73- fromNonEmpty (NonEmpty x xs) = x : xs
74- toNonEmpty l = case l of
75- [] -> Left l
76- (x: xs) -> Right (NonEmpty x xs)
69+ _NonEmpty = prism' toList nonEmpty
7770
7871-- | This describe the capabilities needed to write the rules, when no
7972-- interaction with the player is required.
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import Startups.GameTypes
88import qualified Data.Map.Strict as M
99import Control.Monad.Operational
1010import Control.Monad.State.Strict
11+ import Data.List.NonEmpty
1112
1213data OperationDict m = OperationDict { _doPlayerDecision :: Age -> Turn -> PlayerId -> NonEmpty Card -> GameState -> m (PlayerAction , Exchange )
1314 , _doAskCard :: Age -> PlayerId -> NonEmpty Card -> GameState -> Message -> m Card
You can’t perform that action at this time.
0 commit comments