@@ -1,7 +1,4 @@
1−{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
1+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude, PatternGuards, FlexibleInstances, MultiParamTypeClasses #-}
2− , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
3− , MultiParamTypeClasses, StandaloneDeriving, CPP #-}
4−{-# OPTIONS_GHC -fconstraint-solver-iterations=10 #-}
5-- | This file is generated from the Wikipedia page
2-- | This file is generated from the Wikipedia page
6-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
3-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
7module Data.CountryCodes.ISO31661 (
4module Data.CountryCodes.ISO31661 (
@@ -16,20 +13,13 @@ module Data.CountryCodes.ISO31661 (
18import Control.Applicative (pure)
15import Control.Applicative (pure)
19−import Control.DeepSeq (NFData(..))
20−import Data.Aeson
16+import Data.Aeson
21−import Data.Typeable
17+import Data.Typeable
22−import Data.Text as T
18+import qualified Data.Text as T
24−import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
19+import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail)
25−import Text.Shakespeare.I18N
20+import Text.Shakespeare.I18N
28−import Test.QuickCheck.Arbitrary
29−import Test.QuickCheck.Arbitrary.Generic
32−data CountryCode =
22+data CountryCode =
@@ -279,19 +269,7 @@ data CountryCode =
282− -- Added these non standard codes that occur in
283− -- travolutionary database
284− -- https://typeable.atlassian.net/browse/B2H-796
290− deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable, Generic
272+ deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable)
296-- | Maybe get the CountryCode from the text code.
274-- | Maybe get the CountryCode from the text code.
297fromMText :: T.Text -> Maybe CountryCode
275fromMText :: T.Text -> Maybe CountryCode
@@ -544,11 +522,6 @@ fromMText "YT" = Just YT
544fromMText "ZA" = Just ZA
522fromMText "ZA" = Just ZA
545fromMText "ZM" = Just ZM
523fromMText "ZM" = Just ZM
546fromMText "ZW" = Just ZW
524fromMText "ZW" = Just ZW
547−fromMText "XA" = Just XA
548−fromMText "AN" = Just AN
549−fromMText "XK" = Just XK
550−fromMText "XC" = Just XC
551−fromMText "WE" = Just WE
552fromMText _ = Nothing
525fromMText _ = Nothing
554-- | Get the CountryCode from the text code. Errors if the code is unknown
527-- | Get the CountryCode from the text code. Errors if the code is unknown
@@ -808,11 +781,6 @@ toText YT = "YT"
808toText ZA = "ZA"
781toText ZA = "ZA"
809toText ZM = "ZM"
782toText ZM = "ZM"
810toText ZW = "ZW"
783toText ZW = "ZW"
817-- | Maybe get the code from the user readable name.
785-- | Maybe get the code from the user readable name.
818fromMName :: T.Text -> Maybe CountryCode
786fromMName :: T.Text -> Maybe CountryCode
@@ -1065,11 +1033,6 @@ fromMName "Mayotte" = Just YT
1065fromMName "South Africa" = Just ZA
1033fromMName "South Africa" = Just ZA
1066fromMName "Zambia" = Just ZM
1034fromMName "Zambia" = Just ZM
1067fromMName "Zimbabwe" = Just ZW
1035fromMName "Zimbabwe" = Just ZW
1068−fromMName "Canary Islands" = Just XA
1069−fromMName "Netherlands Antilles" = Just AN
1070−fromMName "Kosovo" = Just XK
1071−fromMName "Ceuta" = Just XC
1072−fromMName "West Bank" = Just WE
1073fromMName _ = Nothing
1036fromMName _ = Nothing
1075-- | Get the CountryCode from the user readable name. Errors if the name is unknown
1038-- | Get the CountryCode from the user readable name. Errors if the name is unknown
@@ -1329,11 +1292,6 @@ toName YT = "Mayotte"
1329toName ZA = "South Africa"
1292toName ZA = "South Africa"
1330toName ZM = "Zambia"
1293toName ZM = "Zambia"
1331toName ZW = "Zimbabwe"
1294toName ZW = "Zimbabwe"
1332−toName XA = "Canary Islands"
1333−toName AN = "Netherlands Antilles"
1334−toName XK = "Kosovo"
1336−toName WE = "West Bank"
1338-- | list of names sorted by alphabetical order, with country code
1296-- | list of names sorted by alphabetical order, with country code
1339-- this is ready to be used in a yesod selectField, for example
1297-- this is ready to be used in a yesod selectField, for example
@@ -1586,37 +1544,19 @@ countryList = [("Afghanistan",AF)
1586 ,("Yemen",YE)
1544 ,("Yemen",YE)
1587 ,("Zambia",ZM)
1545 ,("Zambia",ZM)
1588 ,("Zimbabwe",ZW)
1546 ,("Zimbabwe",ZW)
1589− ,("Åland Islands",AX)
1547+ ,("Åland Islands",AX) ]
1590− ,("Canary Islands", XA)
1591− ,("Netherlands Antilles",AN)
1597-- | to json: as a simple string
1549-- | to json: as a simple string
1598instance ToJSON CountryCode where
1550instance ToJSON CountryCode where
1599− toJSON = toJSON . toText
1551+ toJSON =toJSON . toText
1601-- | from json: as a simple string
1553-- | from json: as a simple string
1602instance FromJSON CountryCode where
1554instance FromJSON CountryCode where
1603 parseJSON (String s)
1555 parseJSON (String s)
1604 | Just a <- fromMText s=pure a
1556 | Just a <- fromMText s=pure a
1605− parseJSON _ = fail "CountryCode"
1557+ parseJSON _ =fail "CountryCode"
1607−deriving instance ToJSONKey CountryCode
1608−deriving instance FromJSONKey CountryCode
1610-- | show user readable name, in English (ignoring locale for now)
1559-- | show user readable name, in English (ignoring locale for now)
1611instance RenderMessage master CountryCode where
1560instance RenderMessage master CountryCode where
1612 renderMessage _ _ = toName
1561 renderMessage _ _ = toName
1614−-- | Allow the deep evaluation of CountryCode with `deepseq`
1615−instance NFData CountryCode where
1619−instance Arbitrary CountryCode where
1620− arbitrary = genericArbitrary
1621− shrink = genericShrink