git.iko.soy/typeable/country-codes
on 2014387 help sign in
3 files changed+73−85
since splitsnapshots
unifiedsplit
country-codes.cabal+2−10 src/Data/CountryCodes/ISO31661.hs+11−67 stack.yaml+60−8
country-codes.cabal+2−10
@@ -31,14 +31,7 @@ library
3131 , text >= 0.11
3232 , aeson >= 0.5
3333 , deepseq >= 1.4
34− , shakespeare
35− -- == 2.0.*
36− if !(impl(ghcjs) || arch(javascript) || arch(wasm32))
37− build-depends:
38− openapi3
39− , QuickCheck
40− , generic-arbitrary
41− cpp-options: -DBACKEND
34+ , shakespeare == 2.0.*
4235 ghc-options: -Wall
4336 other-modules: Data.CountryCodes.ISO31661
4437 exposed-modules: Data.CountryCodes
@@ -49,8 +42,7 @@ executable country-codes-generate
4942 build-depends:
5043 base >= 4 && < 5
5144 , text >= 0.11
52− , tagsoup >= 0.13
53− -- && < 0.15
45+ , tagsoup >= 0.13 && < 0.15
5446 ghc-options: -Wall -rtsopts
5547 main-is: Main.hs
5648 if !flag(generate)
src/Data/CountryCodes/ISO31661.hs+11−67
@@ -1,7 +1,4 @@
1−{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
2− , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
3− , MultiParamTypeClasses, StandaloneDeriving, CPP #-}
4−{-# OPTIONS_GHC -fconstraint-solver-iterations=10 #-}
1+{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude, PatternGuards, FlexibleInstances, MultiParamTypeClasses #-}
52-- | This file is generated from the Wikipedia page
63-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
74module Data.CountryCodes.ISO31661 (
@@ -17,19 +14,13 @@ module Data.CountryCodes.ISO31661 (
1714
1815import Control.Applicative (pure)
1916import Control.DeepSeq (NFData(..))
20−import Data.Aeson
21−import Data.Typeable
22−import Data.Text as T
23−import GHC.Generics
24−import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
25−import Text.Shakespeare.I18N
26−#ifdef BACKEND
27−import Data.OpenApi
28−import Test.QuickCheck.Arbitrary
29−import Test.QuickCheck.Arbitrary.Generic
30−#endif
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
3122
32−data CountryCode =
23+data CountryCode =
3324 AD
3425 | AE
3526 | AF
@@ -279,19 +270,7 @@ data CountryCode =
279270 | ZA
280271 | ZM
281272 | ZW
282− -- Added these non standard codes that occur in
283− -- travolutionary database
284− -- https://typeable.atlassian.net/browse/B2H-796
285− | XA
286− | AN
287− | XK
288− | XC
289− | WE
290− deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable, Generic
291−#ifdef BACKEND
292− , ToSchema
293−#endif
294− )
273+ deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable)
295274
296275-- | Maybe get the CountryCode from the text code.
297276fromMText :: T.Text -> Maybe CountryCode
@@ -544,11 +523,6 @@ fromMText "YT" = Just YT
544523fromMText "ZA" = Just ZA
545524fromMText "ZM" = Just ZM
546525fromMText "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
552526fromMText _ = Nothing
553527
554528-- | Get the CountryCode from the text code. Errors if the code is unknown
@@ -808,11 +782,6 @@ toText YT = "YT"
808782toText ZA = "ZA"
809783toText ZM = "ZM"
810784toText ZW = "ZW"
811−toText XA = "XA"
812−toText AN = "AN"
813−toText XK = "XK"
814−toText XC = "XC"
815−toText WE = "WE"
816785
817786-- | Maybe get the code from the user readable name.
818787fromMName :: T.Text -> Maybe CountryCode
@@ -1065,11 +1034,6 @@ fromMName "Mayotte" = Just YT
10651034fromMName "South Africa" = Just ZA
10661035fromMName "Zambia" = Just ZM
10671036fromMName "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
10731037fromMName _ = Nothing
10741038
10751039-- | Get the CountryCode from the user readable name. Errors if the name is unknown
@@ -1329,11 +1293,6 @@ toName YT = "Mayotte"
13291293toName ZA = "South Africa"
13301294toName ZM = "Zambia"
13311295toName ZW = "Zimbabwe"
1332−toName XA = "Canary Islands"
1333−toName AN = "Netherlands Antilles"
1334−toName XK = "Kosovo"
1335−toName XC = "Ceuta"
1336−toName WE = "West Bank"
13371296
13381297-- | list of names sorted by alphabetical order, with country code
13391298-- this is ready to be used in a yesod selectField, for example
@@ -1586,26 +1545,17 @@ countryList = [("Afghanistan",AF)
15861545 ,("Yemen",YE)
15871546 ,("Zambia",ZM)
15881547 ,("Zimbabwe",ZW)
1589− ,("Åland Islands",AX)
1590− ,("Canary Islands", XA)
1591− ,("Netherlands Antilles",AN)
1592− ,("Kosovo",XK)
1593− ,("Ceuta",XC)
1594− ,("West Bank",WE)
1595− ]
1548+ ,("Åland Islands",AX) ]
15961549
15971550-- | to json: as a simple string
15981551instance ToJSON CountryCode where
1599− toJSON = toJSON . toText
1552+ toJSON =toJSON . toText
16001553
16011554-- | from json: as a simple string
16021555instance FromJSON CountryCode where
16031556 parseJSON (String s)
16041557 | Just a <- fromMText s=pure a
1605− parseJSON _ = fail "CountryCode"
1606−
1607−deriving instance ToJSONKey CountryCode
1608−deriving instance FromJSONKey CountryCode
1558+ parseJSON _ =fail "CountryCode"
16091559
16101560-- | show user readable name, in English (ignoring locale for now)
16111561instance RenderMessage master CountryCode where
@@ -1614,9 +1564,3 @@ instance RenderMessage master CountryCode where
16141564-- | Allow the deep evaluation of CountryCode with `deepseq`
16151565instance NFData CountryCode where
16161566 rnf a = a `seq` ()
1617−
1618−#ifdef BACKEND
1619−instance Arbitrary CountryCode where
1620− arbitrary = genericArbitrary
1621− shrink = genericShrink
1622−#endif
stack.yaml+60−8
@@ -1,12 +1,64 @@
1−resolver: lts-21.3
1+# This file was automatically generated by 'stack init'
2+#
3+# Some commonly used options have been documented as comments in this file.
4+# For advanced use and comprehensive documentation of the format, please see:
5+# https://docs.haskellstack.org/en/stable/yaml_configuration/
26
7+# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+# A snapshot resolver dictates the compiler version and the set of packages
9+# to be used for project dependencies. For example:
10+#
11+# resolver: lts-3.5
12+# resolver: nightly-2015-09-21
13+# resolver: ghc-7.10.2
14+#
15+# The location of a snapshot can be provided as a file or url. Stack assumes
16+# a snapshot provided as a file might change, whereas a url resource does not.
17+#
18+# resolver: ./custom-snapshot.yaml
19+# resolver: https://example.com/snapshots/2018-01-01.yaml
20+resolver: lts-13.7
21+
22+# User packages to be built.
23+# Various formats can be used as shown in the example below.
24+#
25+# packages:
26+# - some-directory
27+# - https://example.com/foo/bar/baz-0.0.2.tar.gz
28+# - location:
29+# git: https://github.com/commercialhaskell/stack.git
30+# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
31+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
32+# subdirs:
33+# - auto-update
34+# - wai
335packages:
436- .
37+# Dependency packages to be pulled from upstream that are not in the resolver
38+# using the same syntax as the packages field.
39+# (e.g., acme-missiles-0.3)
40+# extra-deps: []
41+
42+# Override default flag values for local packages and extra-deps
43+# flags: {}
44+
45+# Extra package databases containing global packages
46+# extra-package-dbs: []
547
6−# extra-deps:
7−# - git: https://github.com/typeable/openapi3.git
8−# # nix-sha256: 1aqn5dia4aqwpmr3v0rcb8kzhknp5674hhay8h7p76206dx83ykg
9−# commit: bb1c64f8501535143c92907166fdc9f8df6d51b9
10−# - git: https://github.com/typeable/generic-arbitrary.git
11−# # nix-sha256: 01k87zxa8cd5ssy1wiqwyqqvz4v7lvh3q6cipmadg4w2ynmfbdn0
12−# commit: 84c62a4de517c78e5080f5451714ce7944987ba6
48+# Control whether we use the GHC we find on the path
49+# system-ghc: true
50+#
51+# Require a specific version of stack, using version ranges
52+# require-stack-version: -any # Default
53+# require-stack-version: ">=1.9"
54+#
55+# Override the architecture used by stack, especially useful on Windows
56+# arch: i386
57+# arch: x86_64
58+#
59+# Extra directories used by stack for building
60+# extra-include-dirs: [/path/to/dir]
61+# extra-lib-dirs: [/path/to/dir]
62+#
63+# Allow a newer minor version of GHC than the snapshot specifies
64+# compiler-check: newer-minor