git.iko.soy/typeable/country-codes
on master help sign in
country-codes.cabal+10−3
since splitsnapshots
unifiedsplit
@@ -31,8 +31,14 @@ library
31 , text >= 0.11
31 , text >= 0.11
32 , aeson >= 0.5
32 , aeson >= 0.5
33 , deepseq >= 1.4
33 , deepseq >= 1.4
34− , shakespeare == 2.0.*
34+ , shakespeare
35+ -- == 2.0.*
36+ if !(impl(ghcjs) || arch(javascript) || arch(wasm32))
37+ build-depends:
35− , openapi3
38+ openapi3
39+ , QuickCheck
40+ , generic-arbitrary
41+ cpp-options: -DBACKEND
36 ghc-options: -Wall
42 ghc-options: -Wall
37 other-modules: Data.CountryCodes.ISO31661
43 other-modules: Data.CountryCodes.ISO31661
38 exposed-modules: Data.CountryCodes
44 exposed-modules: Data.CountryCodes
@@ -43,7 +49,8 @@ executable country-codes-generate
43 build-depends:
49 build-depends:
44 base >= 4 && < 5
50 base >= 4 && < 5
45 , text >= 0.11
51 , text >= 0.11
46− , tagsoup >= 0.13 && < 0.15
52+ , tagsoup >= 0.13
53+ -- && < 0.15
47 ghc-options: -Wall -rtsopts
54 ghc-options: -Wall -rtsopts
48 main-is: Main.hs
55 main-is: Main.hs
49 if !flag(generate)
56 if !flag(generate)
src/Data/CountryCodes/ISO31661.hs+18−3
@@ -1,6 +1,7 @@
1{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
1{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
2 , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
2 , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
3− , MultiParamTypeClasses, StandaloneDeriving #-}
3+ , MultiParamTypeClasses, StandaloneDeriving, CPP #-}
4+{-# OPTIONS_GHC -fconstraint-solver-iterations=10 #-}
4-- | This file is generated from the Wikipedia page
5-- | This file is generated from the Wikipedia page
5-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
6-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
6module Data.CountryCodes.ISO31661 (
7module Data.CountryCodes.ISO31661 (
@@ -19,10 +20,14 @@ import Control.DeepSeq (NFData(..))
19import Data.Aeson
20import Data.Aeson
20import Data.Typeable
21import Data.Typeable
21import Data.Text as T
22import Data.Text as T
22−import Data.OpenApi
23import GHC.Generics
23import GHC.Generics
24import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
24import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
25import Text.Shakespeare.I18N
25import Text.Shakespeare.I18N
26+#ifdef BACKEND
27+import Data.OpenApi
28+import Test.QuickCheck.Arbitrary
29+import Test.QuickCheck.Arbitrary.Generic
30+#endif
26
31
27data CountryCode =
32data CountryCode =
28 AD
33 AD
@@ -282,7 +287,11 @@ data CountryCode =
282 | XK
287 | XK
283 | XC
288 | XC
284 | WE
289 | WE
285− deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable, Generic, ToSchema)
290+ deriving (Show,Read,Eq,Ord,Bounded,Enum,Typeable, Generic
291+#ifdef BACKEND
292+ , ToSchema
293+#endif
294+ )
286
295
287-- | Maybe get the CountryCode from the text code.
296-- | Maybe get the CountryCode from the text code.
288fromMText :: T.Text -> Maybe CountryCode
297fromMText :: T.Text -> Maybe CountryCode
@@ -1605,3 +1614,9 @@ instance RenderMessage master CountryCode where
1605-- | Allow the deep evaluation of CountryCode with `deepseq`
1614-- | Allow the deep evaluation of CountryCode with `deepseq`
1606instance NFData CountryCode where
1615instance NFData CountryCode where
1607 rnf a = a `seq` ()
1616 rnf a = a `seq` ()
1617+
1618+#ifdef BACKEND
1619+instance Arbitrary CountryCode where
1620+ arbitrary = genericArbitrary
1621+ shrink = genericShrink
1622+#endif
stack.yaml+8−5
@@ -1,9 +1,12 @@
1−resolver: lts-18.18
1+resolver: lts-21.3
2
2
3packages:
3packages:
4- .
4- .
5
5
6−extra-deps:
6+# extra-deps:
7−- git: https://github.com/typeable/openapi3.git
7+# - git: https://github.com/typeable/openapi3.git
8− # nix-sha256: 1aqn5dia4aqwpmr3v0rcb8kzhknp5674hhay8h7p76206dx83ykg
8+# # nix-sha256: 1aqn5dia4aqwpmr3v0rcb8kzhknp5674hhay8h7p76206dx83ykg
9− commit: bb1c64f8501535143c92907166fdc9f8df6d51b9
9+# commit: bb1c64f8501535143c92907166fdc9f8df6d51b9
10+# - git: https://github.com/typeable/generic-arbitrary.git
11+# # nix-sha256: 01k87zxa8cd5ssy1wiqwyqqvz4v7lvh3q6cipmadg4w2ynmfbdn0
12+# commit: 84c62a4de517c78e5080f5451714ce7944987ba6