Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.GenParams
|
||||
where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Color
|
||||
import Dodge.Data.Damage.Type
|
||||
import Control.Lens
|
||||
@@ -9,7 +12,13 @@ import qualified Data.Map.Strict as M
|
||||
newtype GenParams = GenParams
|
||||
{ _sensorCoding :: M.Map DamageType (PaletteColor,DecorationShape)
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON GenParams where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON GenParams
|
||||
data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES
|
||||
deriving (Eq,Ord,Enum,Show,Read)
|
||||
deriving (Eq,Ord,Enum,Show,Read,Generic)
|
||||
instance ToJSON DecorationShape where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON DecorationShape
|
||||
makeLenses ''GenParams
|
||||
|
||||
Reference in New Issue
Block a user