@@ -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 #-}
2-- | This file is generated from the Wikipedia page
4-- | This file is generated from the Wikipedia page
3-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
5-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
4module Data.CountryCodes.ISO31661 (
6module Data.CountryCodes.ISO31661 (
@@ -14,11 +16,13 @@ module Data.CountryCodes.ISO31661 (
15import Control.Applicative (pure)
17import Control.Applicative (pure)
16import Control.DeepSeq (NFData(..))
18import Control.DeepSeq (NFData(..))
17−import Data.Aeson
19+import Data.Aeson
18−import Data.Typeable
20+import Data.Typeable
19−import qualified Data.Text as T
21+import Data.Text as T
20−import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
24+import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
21−import Text.Shakespeare.I18N
25+import Text.Shakespeare.I18N
23data CountryCode =
27data CountryCode =
@@ -278,7 +282,7 @@ data CountryCode =
281− deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable)
285+ deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable, Generic, ToSchema)
283-- | Maybe get the CountryCode from the text code.
287-- | Maybe get the CountryCode from the text code.
284fromMText :: T.Text -> Maybe CountryCode
288fromMText :: T.Text -> Maybe CountryCode
@@ -1583,13 +1587,16 @@ countryList = [("Afghanistan",AF)
1584-- | to json: as a simple string
1588-- | to json: as a simple string
1585instance ToJSON CountryCode where
1589instance ToJSON CountryCode where
1586− toJSON =toJSON . toText
1590+ toJSON = toJSON . toText
1588-- | from json: as a simple string
1592-- | from json: as a simple string
1589instance FromJSON CountryCode where
1593instance FromJSON CountryCode where
1590 parseJSON (String s)
1594 parseJSON (String s)
1591 | Just a <- fromMText s=pure a
1595 | Just a <- fromMText s=pure a
1592− parseJSON _ =fail "CountryCode"
1596+ parseJSON _ = fail "CountryCode"
1598+deriving instance ToJSONKey CountryCode
1599+deriving instance FromJSONKey CountryCode
1594-- | show user readable name, in English (ignoring locale for now)
1601-- | show user readable name, in English (ignoring locale for now)
1595instance RenderMessage master CountryCode where
1602instance RenderMessage master CountryCode where