Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
--{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
--{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Dodge.Data.Material where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics
|
||||
deriving (Eq,Ord,Show,Bounded,Enum,Read)
|
||||
deriving (Eq,Ord,Show,Bounded,Enum,Read,Generic)
|
||||
instance ToJSON Material where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Material
|
||||
|
||||
Reference in New Issue
Block a user