Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user