Add generic derivations and To/FromJSON instances

This commit is contained in:
2022-07-25 22:49:18 +01:00
parent f5604ef429
commit b8e8413daa
99 changed files with 1406 additions and 517 deletions
+7 -2
View File
@@ -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