diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2017-06-22 12:24:49 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2017-06-24 01:51:22 +0300 |
commit | b36973b3e08e6d1f8a7d42a6984249486d0cebfe (patch) | |
tree | d14d015a3d5aa20d8a6e1effb9630643abaa847a /lib/Malodivo/Types/District.hs | |
download | molodivo-b36973b3e08e6d1f8a7d42a6984249486d0cebfe.tar.gz |
Initial commit0.0.0
Diffstat (limited to 'lib/Malodivo/Types/District.hs')
-rw-r--r-- | lib/Malodivo/Types/District.hs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/Malodivo/Types/District.hs b/lib/Malodivo/Types/District.hs new file mode 100644 index 0000000..a46628d --- /dev/null +++ b/lib/Malodivo/Types/District.hs @@ -0,0 +1,41 @@ +{-| +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 + ) |