Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.EnergyBall where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry.Data
|
||||
import Color
|
||||
import Dodge.Data.Damage.Type
|
||||
import Control.Lens
|
||||
|
||||
data EnergyBall = EnergyBall
|
||||
{ _ebVel :: Point2
|
||||
, _ebColor :: Color
|
||||
@@ -16,5 +18,8 @@ data EnergyBall = EnergyBall
|
||||
, _ebZ :: Float
|
||||
, _ebRot :: Float
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON EnergyBall where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON EnergyBall
|
||||
makeLenses ''EnergyBall
|
||||
|
||||
Reference in New Issue
Block a user