Take Gender out into a separate module to share it with Characters
This commit is contained in:
parent
fec16c651a
commit
355c7d08be
4 changed files with 17 additions and 6 deletions
|
@ -26,6 +26,7 @@ executable pokeNeige
|
|||
, Character
|
||||
, Config
|
||||
, Game
|
||||
, Gender
|
||||
, Item
|
||||
, Message
|
||||
, Message.Client
|
||||
|
|
|
@ -10,12 +10,14 @@ module Character (
|
|||
import Data.Aeson (ToJSON(..), FromJSON(..), genericToEncoding, genericParseJSON, defaultOptions)
|
||||
import Data.Vector (Vector)
|
||||
import GHC.Generics (Generic)
|
||||
import Gender (Gender(..))
|
||||
import qualified Pokemon (T)
|
||||
import Tool.Array (Array, malloc)
|
||||
|
||||
data Character = Character {
|
||||
name :: String
|
||||
, skin :: FilePath
|
||||
, gender :: Gender
|
||||
, pokemons :: Array Pokemon.T
|
||||
} deriving (Generic)
|
||||
|
||||
|
|
13
src/Gender.hs
Normal file
13
src/Gender.hs
Normal file
|
@ -0,0 +1,13 @@
|
|||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Gender (
|
||||
Gender(..)
|
||||
) where
|
||||
|
||||
import Data.Aeson (ToJSON(..), FromJSON(..), genericToEncoding, defaultOptions)
|
||||
import GHC.Generics (Generic)
|
||||
|
||||
data Gender = M | F | NB deriving (Generic)
|
||||
|
||||
instance ToJSON Gender where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Gender
|
|
@ -6,17 +6,12 @@ module Pokemon (
|
|||
import Data.Aeson (ToJSON(..), FromJSON(..), genericToEncoding, genericParseJSON, defaultOptions)
|
||||
import GHC.Generics (Generic)
|
||||
|
||||
import Gender (Gender)
|
||||
import qualified Pokemon.Species as Species (Key)
|
||||
import Pokemon.Status (Status)
|
||||
import qualified Pokemon.Move as Move (Key)
|
||||
import Tool.Array (Array)
|
||||
|
||||
data Gender = M | F | NB deriving (Generic)
|
||||
|
||||
instance ToJSON Gender where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Gender
|
||||
|
||||
data T = T {
|
||||
nick :: Maybe String
|
||||
, species :: Species.Key
|
||||
|
|
Loading…
Reference in a new issue