Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Projectile where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Dodge.Data.Payload
|
||||
import Dodge.Data.Ammo
|
||||
import Geometry.Data
|
||||
import Control.Lens
|
||||
|
||||
data ProjectileType = ShellType
|
||||
--data ProjectileType = ShellType
|
||||
data Proj
|
||||
= RemoteShell
|
||||
{ _prjPos :: Point2
|
||||
@@ -32,5 +34,8 @@ data Proj
|
||||
, _prjUpdates :: [ProjectileUpdate]
|
||||
, _prjMITID :: Maybe Int
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Proj where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Proj
|
||||
makeLenses ''Proj
|
||||
|
||||
Reference in New Issue
Block a user