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
+11 -3
View File
@@ -1,6 +1,9 @@
{-# LANGUAGE StrictData #-}
{-# LANGUAGE DeriveGeneric #-}
module Dodge.Data.Object where
data Object
import GHC.Generics
import Data.Aeson
data ObjectType
= ObTerminal
| ObCreature
| ObMachine
@@ -12,4 +15,9 @@ data Object
| ObProp
| ObTrigger
| ObItem
deriving (Eq,Show,Ord,Read,Enum,Bounded)
deriving (Eq,Show,Ord,Read,Enum,Bounded,Generic)
instance ToJSON ObjectType where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ObjectType
instance ToJSONKey ObjectType
instance FromJSONKey ObjectType