import Data.Attoparsec.Text hiding (Result)
import Control.Applicative
-data Shape = Rock | Paper | Scissors deriving (Show, Eq, Ord, Enum)
+data Shape = Rock | Paper | Scissors deriving (Show, Eq, Ord, Enum, Bounded)
data Result = Loss | Draw | Win deriving (Show, Eq, Ord, Enum)
data Round = Round Shape Shape deriving (Eq, Show)
data ShapeResult = ShapeResult Shape Result deriving (Eq, Show)
roundFromResult :: ShapeResult -> Round
roundFromResult (ShapeResult shape result) = Round shape p2s
where p2s = head [ p2Shape
- | p2Shape <- [Rock .. Scissors]
+ -- | p2Shape <- [Rock .. Scissors]
+ | p2Shape <- [minBound .. maxBound]
, player2Result (Round shape p2Shape) == result
]