Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.TractorBeam where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry.Data
|
||||
import Control.Lens
|
||||
data TractorBeam = TractorBeam
|
||||
@@ -9,5 +12,8 @@ data TractorBeam = TractorBeam
|
||||
, _tbVel :: Point2
|
||||
, _tbTime :: Int
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON TractorBeam where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON TractorBeam
|
||||
makeLenses ''TractorBeam
|
||||
|
||||
Reference in New Issue
Block a user