aboutsummaryrefslogtreecommitdiff
path: root/lib/Malodivo/Types/District.hs
blob: 058377bd2315a0643c8579fedf9042259116d282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-|
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, ToJSON)
import Data.Hashable (Hashable)

-- | District of the Kindom of Malodivo.
data District
  = Palolene
  | SouthernPalolene
  | Lakos
  deriving ( Eq
           , Hashable
           , Show
           , Generic
           , FromJSON
           , ToJSON
           )