Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.ForegroundShape where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry
|
||||
import ShapePicture
|
||||
import Control.Lens
|
||||
|
||||
data ForegroundShape = ForegroundShape
|
||||
{ _fsID :: Int
|
||||
, _fsPos :: Point2
|
||||
@@ -12,5 +14,8 @@ data ForegroundShape = ForegroundShape
|
||||
, _fsRad :: Float -- This should probably be a bounding box
|
||||
, _fsSPic :: SPic
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON ForegroundShape where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ForegroundShape
|
||||
makeLenses ''ForegroundShape
|
||||
|
||||
Reference in New Issue
Block a user