Add generic derivations and To/FromJSON instances
This commit is contained in:
+10
-1
@@ -1,9 +1,14 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{- | GameRooms contain information about given positions in the world
|
||||
-}
|
||||
module Dodge.GameRoom
|
||||
where
|
||||
import Geometry
|
||||
import Control.Lens
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
|
||||
data GameRoom = GameRoom
|
||||
{ _grViewpoints :: [Point2]
|
||||
@@ -13,4 +18,8 @@ data GameRoom = GameRoom
|
||||
, _grLinkDirs :: [Float]
|
||||
, _grName :: String
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON GameRoom where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON GameRoom
|
||||
makeLenses ''GameRoom
|
||||
|
||||
Reference in New Issue
Block a user