28 lines
633 B
Haskell
28 lines
633 B
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
module Pokemon.Species (
|
|
Key
|
|
, Species(..)
|
|
) where
|
|
|
|
import Data.Aeson (ToJSON(..), FromJSON(..), genericToEncoding, genericParseJSON, defaultOptions)
|
|
import GHC.Generics (Generic)
|
|
|
|
import Pokemon.Type (Type)
|
|
import Pokemon.Move (Move)
|
|
import Data.Map (Map)
|
|
|
|
data Species = Species {
|
|
name :: String
|
|
, number :: Int
|
|
, type_ :: Type
|
|
, skin :: FilePath
|
|
, moves :: Map Int Move
|
|
}
|
|
|
|
newtype Key = Key Int deriving (Generic)
|
|
|
|
instance ToJSON Key where
|
|
toEncoding = genericToEncoding defaultOptions
|
|
instance FromJSON Key where
|
|
parseJSON = genericParseJSON defaultOptions
|