{-| Districts can be encoded to and decoded from JSON: >>> import Data.Aeson (decode, encode) >>> import Data.ByteString.Lazy.Char8 (pack) >>> encode Palolene "\"Palolene\"" >>> encode [ Lakos, SouthernPalolene ] "[\"Lakos\",\"SouthernPalolene\"]" >>> decode . pack $ "[ \"Lakos\" ]" :: Maybe [District] Just [Lakos] -} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} module Malodivo.Types.District ( District(..) ) where import GHC.Generics (Generic) import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey) import Data.Hashable (Hashable) -- | District of the Kindom of Malodivo. data District = Palolene | SouthernPalolene | Lakos deriving ( Eq , Hashable , Show , Generic , FromJSON , FromJSONKey , ToJSON , ToJSONKey )