@@ -20,7 +20,7 @@ import qualified Data.Text as T
20import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
20import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
21import Text.Shakespeare.I18N
21import Text.Shakespeare.I18N
23−data CountryCode =
23+data CountryCode =
@@ -270,6 +270,14 @@ data CountryCode =
273+ -- Added these non standard codes that occur in
274+ -- travolutionary database
275+ -- https://typeable.atlassian.net/browse/B2H-796
273 deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable)
281 deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable)
275-- | Maybe get the CountryCode from the text code.
283-- | Maybe get the CountryCode from the text code.
@@ -523,6 +531,11 @@ fromMText "YT" = Just YT
523fromMText "ZA" = Just ZA
531fromMText "ZA" = Just ZA
524fromMText "ZM" = Just ZM
532fromMText "ZM" = Just ZM
525fromMText "ZW" = Just ZW
533fromMText "ZW" = Just ZW
534+fromMText "XA" = Just XA
535+fromMText "AN" = Just AN
536+fromMText "XK" = Just XK
537+fromMText "XC" = Just XC
538+fromMText "WE" = Just WE
526fromMText _ = Nothing
539fromMText _ = Nothing
528-- | Get the CountryCode from the text code. Errors if the code is unknown
541-- | Get the CountryCode from the text code. Errors if the code is unknown
@@ -782,6 +795,11 @@ toText YT = "YT"
782toText ZA = "ZA"
795toText ZA = "ZA"
783toText ZM = "ZM"
796toText ZM = "ZM"
784toText ZW = "ZW"
797toText ZW = "ZW"
786-- | Maybe get the code from the user readable name.
804-- | Maybe get the code from the user readable name.
787fromMName :: T.Text -> Maybe CountryCode
805fromMName :: T.Text -> Maybe CountryCode
@@ -1034,6 +1052,11 @@ fromMName "Mayotte" = Just YT
1034fromMName "South Africa" = Just ZA
1052fromMName "South Africa" = Just ZA
1035fromMName "Zambia" = Just ZM
1053fromMName "Zambia" = Just ZM
1036fromMName "Zimbabwe" = Just ZW
1054fromMName "Zimbabwe" = Just ZW
1055+fromMName "Canary Islands" = Just XA
1056+fromMName "Netherlands Antilles" = Just AN
1057+fromMName "Kosovo" = Just XK
1058+fromMName "Ceuta" = Just XC
1059+fromMName "West Bank" = Just WE
1037fromMName _ = Nothing
1060fromMName _ = Nothing
1039-- | Get the CountryCode from the user readable name. Errors if the name is unknown
1062-- | Get the CountryCode from the user readable name. Errors if the name is unknown
@@ -1293,6 +1316,11 @@ toName YT = "Mayotte"
1293toName ZA = "South Africa"
1316toName ZA = "South Africa"
1294toName ZM = "Zambia"
1317toName ZM = "Zambia"
1295toName ZW = "Zimbabwe"
1318toName ZW = "Zimbabwe"
1319+toName XA = "Canary Islands"
1320+toName AN = "Netherlands Antilles"
1321+toName XK = "Kosovo"
1323+toName WE = "West Bank"
1297-- | list of names sorted by alphabetical order, with country code
1325-- | list of names sorted by alphabetical order, with country code
1298-- this is ready to be used in a yesod selectField, for example
1326-- this is ready to be used in a yesod selectField, for example
@@ -1545,7 +1573,13 @@ countryList = [("Afghanistan",AF)
1545 ,("Yemen",YE)
1573 ,("Yemen",YE)
1546 ,("Zambia",ZM)
1574 ,("Zambia",ZM)
1547 ,("Zimbabwe",ZW)
1575 ,("Zimbabwe",ZW)
1548− ,("Åland Islands",AX) ]
1576+ ,("Åland Islands",AX)
1577+ ,("Canary Islands", XA)
1578+ ,("Netherlands Antilles",AN)
1550-- | to json: as a simple string
1584-- | to json: as a simple string
1551instance ToJSON CountryCode where
1585instance ToJSON CountryCode where