git.iko.soy/typeable/country-codes
on master help sign in
3 files changed+36−11
since splitsnapshots
unifiedsplit
country-codes.cabal+10−3 src/Data/CountryCodes/ISO31661.hs+18−3 stack.yaml+8−5
country-codes.cabal+10−3
@@ -31,8 +31,14 @@ library
3131 , text >= 0.11
3232 , aeson >= 0.5
3333 , deepseq >= 1.4
34− , shakespeare == 2.0.*
35− , openapi3
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
3642 ghc-options: -Wall
3743 other-modules: Data.CountryCodes.ISO31661
3844 exposed-modules: Data.CountryCodes
@@ -43,7 +49,8 @@ executable country-codes-generate
4349 build-depends:
4450 base >= 4 && < 5
4551 , text >= 0.11
46− , tagsoup >= 0.13 && < 0.15
52+ , tagsoup >= 0.13
53+ -- && < 0.15
4754 ghc-options: -Wall -rtsopts
4855 main-is: Main.hs
4956 if !flag(generate)
src/Data/CountryCodes/ISO31661.hs+18−3
@@ -1,6 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
22 , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
3− , MultiParamTypeClasses, StandaloneDeriving #-}
3+ , MultiParamTypeClasses, StandaloneDeriving, CPP #-}
4+{-# OPTIONS_GHC -fconstraint-solver-iterations=10 #-}
45-- | This file is generated from the Wikipedia page
56-- <http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
67module Data.CountryCodes.ISO31661 (
@@ -19,10 +20,14 @@ import Control.DeepSeq (NFData(..))
1920import Data.Aeson
2021import Data.Typeable
2122import Data.Text as T
22−import Data.OpenApi
2323import GHC.Generics
2424import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
2525import Text.Shakespeare.I18N
26+#ifdef BACKEND
27+import Data.OpenApi
28+import Test.QuickCheck.Arbitrary
29+import Test.QuickCheck.Arbitrary.Generic
30+#endif
2631
2732data CountryCode =
2833 AD
@@ -282,7 +287,11 @@ data CountryCode =
282287 | XK
283288 | XC
284289 | 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+ )
286295
287296-- | Maybe get the CountryCode from the text code.
288297fromMText :: T.Text -> Maybe CountryCode
@@ -1605,3 +1614,9 @@ instance RenderMessage master CountryCode where
16051614-- | Allow the deep evaluation of CountryCode with `deepseq`
16061615instance NFData CountryCode where
16071616 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
22
33packages:
44- .
55
6−extra-deps:
7−- git: https://github.com/typeable/openapi3.git
8− # nix-sha256: 1aqn5dia4aqwpmr3v0rcb8kzhknp5674hhay8h7p76206dx83ykg
9− commit: bb1c64f8501535143c92907166fdc9f8df6d51b9
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