git.iko.soy/typeable/country-codes
on master help sign in
Add Arbitrary instance
commit05d68730f2ba1e02d62de556205f34a1a2eef55a authorDmitry Olshansky <olshanskydr@gmail.com> dateSat 2 Apr 2022, 12:47 (5 years ago) parenta85df94
3 files changed+12
country-codes.cabal+2 src/Data/CountryCodes/ISO31661.hs+7 stack.yaml+3
country-codes.cabal+2
@@ -31,8 +31,10 @@ library
3131 , text >= 0.11
3232 , aeson >= 0.5
3333 , deepseq >= 1.4
34+ , generic-arbitrary
3435 , shakespeare == 2.0.*
3536 , openapi3
37+ , QuickCheck
3638 ghc-options: -Wall
3739 other-modules: Data.CountryCodes.ISO31661
3840 exposed-modules: Data.CountryCodes
src/Data/CountryCodes/ISO31661.hs+7
@@ -1,6 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, NoImplicitPrelude
22 , DeriveGeneric, DeriveAnyClass, PatternGuards, FlexibleInstances
33 , MultiParamTypeClasses, StandaloneDeriving #-}
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 (
@@ -23,6 +24,8 @@ import Data.OpenApi
2324import GHC.Generics
2425import Prelude (Show,Read,Eq,Ord,Bounded,Enum,error,($),(++),Maybe(..),(.),fail,seq)
2526import Text.Shakespeare.I18N
27+import Test.QuickCheck.Arbitrary
28+import Test.QuickCheck.Arbitrary.Generic
2629
2730data CountryCode =
2831 AD
@@ -1605,3 +1608,7 @@ instance RenderMessage master CountryCode where
16051608-- | Allow the deep evaluation of CountryCode with `deepseq`
16061609instance NFData CountryCode where
16071610 rnf a = a `seq` ()
1611+
1612+instance Arbitrary CountryCode where
1613+ arbitrary = genericArbitrary
1614+ shrink = genericShrink
stack.yaml+3
@@ -7,3 +7,6 @@ extra-deps:
77- git: https://github.com/typeable/openapi3.git
88 # nix-sha256: 1aqn5dia4aqwpmr3v0rcb8kzhknp5674hhay8h7p76206dx83ykg
99 commit: bb1c64f8501535143c92907166fdc9f8df6d51b9
10+- git: https://github.com/typeable/generic-arbitrary.git
11+ # nix-sha256: 01k87zxa8cd5ssy1wiqwyqqvz4v7lvh3q6cipmadg4w2ynmfbdn0
12+ commit: 84c62a4de517c78e5080f5451714ce7944987ba6