28 lines
735 B
Haskell
28 lines
735 B
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
module Pokemon (
|
|
Pokemon(..)
|
|
) where
|
|
|
|
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 Pokemon = Pokemon {
|
|
nick :: Maybe String
|
|
, species :: Species.Key
|
|
, gender :: Gender
|
|
, level :: Int
|
|
, status :: Status
|
|
, moves :: Array Move.Key
|
|
} deriving (Generic)
|
|
|
|
instance ToJSON Pokemon where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON Pokemon where
|
|
parseJSON = genericParseJSON defaultOptions
|