36 lines
913 B
Haskell
36 lines
913 B
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE OverloadedLists #-}
|
|
module Character (
|
|
Character(..)
|
|
, Key
|
|
, dex
|
|
) where
|
|
|
|
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)
|
|
|
|
data Character = Character {
|
|
name :: String
|
|
, skin :: FilePath
|
|
, gender :: Gender
|
|
, pokemons :: Array Pokemon.T
|
|
} deriving (Generic)
|
|
|
|
instance ToJSON Character where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON Character where
|
|
parseJSON = genericParseJSON defaultOptions
|
|
|
|
newtype Key = Key Int deriving (Generic)
|
|
|
|
instance ToJSON Key where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON Key where
|
|
parseJSON = genericParseJSON defaultOptions
|
|
|
|
dex :: Vector Character
|
|
dex = []
|