Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Corpse where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import ShapePicture.Data
|
||||
import Geometry.Data
|
||||
|
||||
import Control.Lens
|
||||
data CorpseResurrection = NoResurrection
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON CorpseResurrection where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON CorpseResurrection
|
||||
data Corpse = Corpse
|
||||
{ _cpID :: Int
|
||||
, _cpPos :: Point2
|
||||
@@ -14,5 +20,8 @@ data Corpse = Corpse
|
||||
, _cpSPic :: SPic
|
||||
, _cpRes :: CorpseResurrection
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Corpse where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Corpse
|
||||
makeLenses ''Corpse
|
||||
|
||||
Reference in New Issue
Block a user