@@ -1,4 +1,6 @@
1−{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude, PatternGuards, FlexibleInstances, MultiParamTypeClasses #-}
1+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
2+ , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
3+ , MultiParamTypeClasses, StandaloneDeriving #-}
24-- | This file is generated from the Wikipedia page
35-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
46module Data.CountryCodes.ISO31661 (
@@ -14,11 +16,13 @@ module Data.CountryCodes.ISO31661 (
1416
1517import Control.Applicative (pure)
1618import Control.DeepSeq (NFData(..))
17−import Data.Aeson
18−import Data.Typeable
19−import qualified Data.Text as T
20−import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
21−import Text.Shakespeare.I18N
19+import Data.Aeson
20+import Data.Typeable
21+import Data.Text as T
22+import Data.OpenApi
23+import GHC.Generics
24+import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
25+import Text.Shakespeare.I18N
2226
2327data CountryCode =
2428 AD
@@ -278,7 +282,7 @@ data CountryCode =
278282 | XK
279283 | XC
280284 | WE
281− deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable)
285+ deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable, Generic, ToSchema)
282286
283287-- | Maybe get the CountryCode from the text code.
284288fromMText :: T.Text -> Maybe CountryCode
@@ -1583,13 +1587,16 @@ countryList = [("Afghanistan",AF)
15831587
15841588-- | to json: as a simple string
15851589instance ToJSON CountryCode where
1586− toJSON =toJSON . toText
1590+ toJSON = toJSON . toText
15871591
15881592-- | from json: as a simple string
15891593instance FromJSON CountryCode where
15901594 parseJSON (String s)
15911595 | Just a <- fromMText s=pure a
1592− parseJSON _ =fail "CountryCode"
1596+ parseJSON _ = fail "CountryCode"
1597+
1598+deriving instance ToJSONKey CountryCode
1599+deriving instance FromJSONKey CountryCode
15931600
15941601-- | show user readable name, in English (ignoring locale for now)
15951602instance RenderMessage master CountryCode where