git.iko.soy/typeable/connexpay
on master help sign in
Add cabal.project and CI (#7)
9284156Uladzimir Stsepchanka
.github/workflows/haskell-ci.ymlnew file+219
@@ -0,0 +1,219 @@
1+# This GitHub workflow config has been generated by a script via
2+#
3+# haskell-ci 'github' 'cabal.project'
4+#
5+# To regenerate the script (for example after adjusting tested-with) run
6+#
7+# haskell-ci regenerate
8+#
9+# For more information, see https://github.com/haskell-CI/haskell-ci
10+#
11+# version: 0.19.20250330
12+#
13+# REGENDATA ("0.19.20250330",["github","cabal.project"])
14+#
15+name: Haskell-CI
16+on:
17+ push:
18+ branches:
19+ - master
20+ pull_request:
21+ branches:
22+ - master
23+jobs:
24+ linux:
25+ name: Haskell-CI - Linux - ${{ matrix.compiler }}
26+ runs-on: ubuntu-24.04
27+ timeout-minutes:
28+ 60
29+ container:
30+ image: buildpack-deps:jammy
31+ continue-on-error: ${{ matrix.allow-failure }}
32+ strategy:
33+ matrix:
34+ include:
35+ - compiler: ghc-9.8.4
36+ compilerKind: ghc
37+ compilerVersion: 9.8.4
38+ setup-method: ghcup
39+ allow-failure: false
40+ - compiler: ghc-9.6.6
41+ compilerKind: ghc
42+ compilerVersion: 9.6.6
43+ setup-method: ghcup
44+ allow-failure: false
45+ fail-fast: false
46+ steps:
47+ - name: apt-get install
48+ run: |
49+ apt-get update
50+ apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
51+ - name: Install GHCup
52+ run: |
53+ mkdir -p "$HOME/.ghcup/bin"
54+ curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup"
55+ chmod a+x "$HOME/.ghcup/bin/ghcup"
56+ - name: Install cabal-install
57+ run: |
58+ "$HOME/.ghcup/bin/ghcup" install cabal 3.14.1.1-p1 || (cat "$HOME"/.ghcup/logs/*.* && false)
59+ echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.1.1-p1 -vnormal+nowrap" >> "$GITHUB_ENV"
60+ - name: Install GHC (GHCup)
61+ if: matrix.setup-method == 'ghcup'
62+ run: |
63+ "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
64+ HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
65+ HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
66+ HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
67+ echo "HC=$HC" >> "$GITHUB_ENV"
68+ echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
69+ echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
70+ env:
71+ HCKIND: ${{ matrix.compilerKind }}
72+ HCNAME: ${{ matrix.compiler }}
73+ HCVER: ${{ matrix.compilerVersion }}
74+ - name: Set PATH and environment variables
75+ run: |
76+ echo "$HOME/.cabal/bin" >> $GITHUB_PATH
77+ echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
78+ echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
79+ echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
80+ HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
81+ echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
82+ echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
83+ echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
84+ echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
85+ echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
86+ env:
87+ HCKIND: ${{ matrix.compilerKind }}
88+ HCNAME: ${{ matrix.compiler }}
89+ HCVER: ${{ matrix.compilerVersion }}
90+ - name: env
91+ run: |
92+ env
93+ - name: write cabal config
94+ run: |
95+ mkdir -p $CABAL_DIR
96+ cat >> $CABAL_CONFIG <<EOF
97+ remote-build-reporting: anonymous
98+ write-ghc-environment-files: never
99+ remote-repo-cache: $CABAL_DIR/packages
100+ logs-dir: $CABAL_DIR/logs
101+ world-file: $CABAL_DIR/world
102+ extra-prog-path: $CABAL_DIR/bin
103+ symlink-bindir: $CABAL_DIR/bin
104+ installdir: $CABAL_DIR/bin
105+ build-summary: $CABAL_DIR/logs/build.log
106+ store-dir: $CABAL_DIR/store
107+ install-dirs user
108+ prefix: $CABAL_DIR
109+ repository hackage.haskell.org
110+ url: http://hackage.haskell.org/
111+ EOF
112+ cat >> $CABAL_CONFIG <<EOF
113+ program-default-options
114+ ghc-options: $GHCJOBS +RTS -M3G -RTS
115+ EOF
116+ cat $CABAL_CONFIG
117+ - name: versions
118+ run: |
119+ $HC --version || true
120+ $HC --print-project-git-commit-id || true
121+ $CABAL --version || true
122+ - name: update cabal index
123+ run: |
124+ $CABAL v2-update -v
125+ - name: install cabal-plan
126+ run: |
127+ mkdir -p $HOME/.cabal/bin
128+ curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
129+ echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
130+ xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
131+ rm -f cabal-plan.xz
132+ chmod a+x $HOME/.cabal/bin/cabal-plan
133+ cabal-plan --version
134+ - name: checkout
135+ uses: actions/checkout@v4
136+ with:
137+ path: source
138+ - name: initial cabal.project for sdist
139+ run: |
140+ touch cabal.project
141+ echo "packages: $GITHUB_WORKSPACE/source/connexpay" >> cabal.project
142+ echo "packages: $GITHUB_WORKSPACE/source/connexpay-optparse" >> cabal.project
143+ cat cabal.project
144+ - name: sdist
145+ run: |
146+ mkdir -p sdist
147+ $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
148+ - name: unpack
149+ run: |
150+ mkdir -p unpacked
151+ find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
152+ - name: generate cabal.project
153+ run: |
154+ PKGDIR_connexpay="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/connexpay-[0-9.]*')"
155+ echo "PKGDIR_connexpay=${PKGDIR_connexpay}" >> "$GITHUB_ENV"
156+ PKGDIR_connexpay_optparse="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/connexpay-optparse-[0-9.]*')"
157+ echo "PKGDIR_connexpay_optparse=${PKGDIR_connexpay_optparse}" >> "$GITHUB_ENV"
158+ rm -f cabal.project cabal.project.local
159+ touch cabal.project
160+ touch cabal.project.local
161+ echo "packages: ${PKGDIR_connexpay}" >> cabal.project
162+ echo "packages: ${PKGDIR_connexpay_optparse}" >> cabal.project
163+ echo "package connexpay" >> cabal.project
164+ echo " ghc-options: -Werror=missing-methods" >> cabal.project
165+ echo "package connexpay-optparse" >> cabal.project
166+ echo " ghc-options: -Werror=missing-methods" >> cabal.project
167+ cat >> cabal.project <<EOF
168+ source-repository-package
169+ type: git
170+ location: https://github.com/typeable/bucks.git
171+ tag: 9e378b675fe7fb88d5ddb3af068d82eb441f343c
172+
173+ source-repository-package
174+ type: git
175+ location: https://github.com/typeable/req.git
176+ tag: 8829ac5197f7a4b3f04b7fdfc3ea66cfe70ab0a5
177+ EOF
178+ $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(connexpay|connexpay-optparse)$/; }' >> cabal.project.local
179+ cat cabal.project
180+ cat cabal.project.local
181+ - name: dump install plan
182+ run: |
183+ $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
184+ cabal-plan
185+ - name: restore cache
186+ uses: actions/cache/restore@v4
187+ with:
188+ key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
189+ path: ~/.cabal/store
190+ restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
191+ - name: install dependencies
192+ run: |
193+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
194+ $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
195+ - name: build w/o tests
196+ run: |
197+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
198+ - name: build
199+ run: |
200+ $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
201+ - name: cabal check
202+ run: |
203+ cd ${PKGDIR_connexpay} || false
204+ ${CABAL} -vnormal check
205+ cd ${PKGDIR_connexpay_optparse} || false
206+ ${CABAL} -vnormal check
207+ - name: haddock
208+ run: |
209+ $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
210+ - name: unconstrained build
211+ run: |
212+ rm -f cabal.project.local
213+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
214+ - name: save cache
215+ if: always()
216+ uses: actions/cache/save@v4
217+ with:
218+ key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
219+ path: ~/.cabal/store
.gitignorenew file+29
@@ -0,0 +1,29 @@
1+# https://github.com/github/gitignore/blob/main/Haskell.gitignore
2+dist
3+dist-*
4+cabal-dev
5+*.o
6+*.hi
7+*.hie
8+*.chi
9+*.chs.h
10+*.dyn_o
11+*.dyn_hi
12+.hpc
13+.hsenv
14+.cabal-sandbox/
15+cabal.sandbox.config
16+*.prof
17+*.aux
18+*.hp
19+*.eventlog
20+.stack-work/
21+cabal.project.local
22+cabal.project.local~
23+.HTF/
24+
25+stack.yaml.lock
26+
27+# Temp files
28+*~
29+\#*\#
cabal.haskell-cinew file+1
@@ -0,0 +1 @@
1+branches: master
cabal.projectnew file+15
@@ -0,0 +1,15 @@
1+with-compiler: ghc-9.6.6
2+
3+packages:
4+ connexpay/
5+ connexpay-optparse/
6+
7+source-repository-package
8+ type: git
9+ location: https://github.com/typeable/bucks.git
10+ tag: 9e378b675fe7fb88d5ddb3af068d82eb441f343c
11+
12+source-repository-package
13+ type: git
14+ location: https://github.com/typeable/req.git
15+ tag: 8829ac5197f7a4b3f04b7fdfc3ea66cfe70ab0a5
cabal.project.freezenew file+201
@@ -0,0 +1,201 @@
1+active-repositories: hackage.haskell.org:merge
2+constraints: any.Cabal ==3.10.3.0,
3+ any.Cabal-syntax ==3.10.3.0,
4+ any.OneTuple ==0.4.2,
5+ any.QuickCheck ==2.14.3,
6+ QuickCheck -old-random +templatehaskell,
7+ any.RSA ==2.4.1,
8+ any.SHA ==1.6.4.4,
9+ SHA -exe,
10+ any.StateVar ==1.2.2,
11+ any.aeson ==2.1.2.1,
12+ aeson -cffi +ordered-keymap,
13+ any.ansi-terminal ==1.0.2,
14+ ansi-terminal -example,
15+ any.ansi-terminal-types ==0.11.5,
16+ any.appar ==0.1.8,
17+ any.array ==0.5.6.0,
18+ any.asn1-encoding ==0.9.6,
19+ any.asn1-parse ==0.9.5,
20+ any.asn1-types ==0.3.4,
21+ any.assoc ==1.1.1,
22+ assoc -tagged,
23+ any.async ==2.2.5,
24+ async -bench,
25+ any.attoparsec ==0.14.4,
26+ attoparsec -developer,
27+ any.attoparsec-iso8601 ==1.1.1.0,
28+ any.authenticate-oauth ==1.7,
29+ any.base ==4.18.2.1,
30+ any.base-compat ==0.13.1,
31+ any.base-compat-batteries ==0.13.1,
32+ any.base-orphans ==0.9.2,
33+ any.base64-bytestring ==1.2.1.0,
34+ any.basement ==0.0.16,
35+ any.bifunctors ==5.6.2,
36+ bifunctors +tagged,
37+ any.binary ==0.8.9.1,
38+ any.bitvec ==1.1.5.0,
39+ bitvec +simd,
40+ any.blaze-builder ==0.4.2.3,
41+ any.bucks ==0.1,
42+ bucks -aeson -openapi -rel8,
43+ any.byteorder ==1.0.4,
44+ any.bytestring ==0.11.5.3,
45+ any.case-insensitive ==1.2.1.0,
46+ any.cereal ==0.5.8.3,
47+ cereal -bytestring-builder,
48+ any.colour ==2.3.6,
49+ any.comonad ==5.0.8,
50+ comonad +containers +distributive +indexed-traversable,
51+ any.conduit ==1.3.6,
52+ any.containers ==0.6.7,
53+ any.contravariant ==1.5.5,
54+ contravariant +semigroups +statevar +tagged,
55+ any.cookie ==0.4.6,
56+ any.crypto-api ==0.13.3,
57+ crypto-api -all_cpolys,
58+ any.crypto-pubkey-types ==0.4.3,
59+ any.cryptohash-md5 ==0.11.101.0,
60+ any.cryptohash-sha1 ==0.11.101.0,
61+ any.crypton ==0.34,
62+ crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
63+ any.crypton-connection ==0.3.2,
64+ any.crypton-x509 ==1.7.7,
65+ any.crypton-x509-store ==1.6.9,
66+ any.crypton-x509-system ==1.6.7,
67+ any.crypton-x509-validation ==1.6.12,
68+ any.data-default ==0.7.1.1,
69+ any.data-default-class ==0.1.2.0,
70+ any.data-default-instances-containers ==0.0.1,
71+ any.data-default-instances-dlist ==0.0.1,
72+ any.data-default-instances-old-locale ==0.0.1,
73+ any.data-fix ==0.3.4,
74+ any.deepseq ==1.4.8.1,
75+ any.directory ==1.3.8.5,
76+ any.distributive ==0.6.2.1,
77+ distributive +semigroups +tagged,
78+ any.dlist ==1.0,
79+ dlist -werror,
80+ any.entropy ==0.4.1.10,
81+ entropy -donotgetentropy,
82+ any.exceptions ==0.10.7,
83+ any.filepath ==1.4.300.1,
84+ any.generically ==0.1.1,
85+ any.ghc-bignum ==1.3,
86+ any.ghc-boot-th ==9.6.6,
87+ any.ghc-prim ==0.10.0,
88+ any.groups ==0.5.3,
89+ any.hashable ==1.4.4.0,
90+ hashable +integer-gmp -random-initial-seed,
91+ any.hourglass ==0.2.12,
92+ any.hsc2hs ==0.68.10,
93+ hsc2hs -in-ghc-tree,
94+ any.http-api-data ==0.5.1,
95+ http-api-data -use-text-show,
96+ any.http-client ==0.7.17,
97+ http-client +network-uri,
98+ any.http-client-tls ==0.3.6.3,
99+ any.http-types ==0.12.4,
100+ any.indexed-traversable ==0.1.4,
101+ any.indexed-traversable-instances ==0.1.2,
102+ any.integer-conversion ==0.1.0.1,
103+ any.integer-gmp ==1.1,
104+ any.integer-logarithms ==1.0.3.1,
105+ integer-logarithms -check-bounds +integer-gmp,
106+ any.iproute ==1.7.14,
107+ any.libyaml ==0.1.4,
108+ libyaml -no-unicode -system-libyaml,
109+ any.libyaml-clib ==0.2.5,
110+ any.megaparsec ==9.5.0,
111+ megaparsec -dev,
112+ any.memory ==0.18.0,
113+ memory +support_bytestring +support_deepseq,
114+ any.mime-types ==0.1.2.0,
115+ any.modern-uri ==0.3.6.1,
116+ modern-uri -dev,
117+ any.monad-control ==1.0.3.1,
118+ any.mono-traversable ==1.0.20.0,
119+ any.mtl ==2.3.1,
120+ any.mtl-compat ==0.2.2,
121+ mtl-compat -two-point-one -two-point-two,
122+ any.network ==3.1.4.0,
123+ network -devel,
124+ any.network-info ==0.2.1,
125+ any.network-uri ==2.6.4.2,
126+ any.old-locale ==1.0.0.7,
127+ any.old-time ==1.1.0.4,
128+ any.optparse-applicative ==0.18.1.0,
129+ optparse-applicative +process,
130+ any.os-string ==2.0.6,
131+ any.parsec ==3.1.16.1,
132+ any.parser-combinators ==1.3.0,
133+ parser-combinators -dev,
134+ any.pem ==0.2.4,
135+ any.pretty ==1.1.3.6,
136+ any.prettyprinter ==1.7.1,
137+ prettyprinter -buildreadme +text,
138+ any.prettyprinter-ansi-terminal ==1.1.3,
139+ any.primitive ==0.8.0.0,
140+ any.process ==1.6.19.0,
141+ any.profunctors ==5.6.2,
142+ any.random ==1.2.1.2,
143+ any.reflection ==2.1.8,
144+ reflection -slow +template-haskell,
145+ any.req ==3.13.4,
146+ req -dev,
147+ any.resourcet ==1.3.0,
148+ any.retry ==0.9.3.1,
149+ retry -lib-werror,
150+ any.rts ==1.0.2,
151+ any.scientific ==0.3.7.0,
152+ scientific -bytestring-builder -integer-simple,
153+ any.semialign ==1.3.1,
154+ semialign +semigroupoids,
155+ any.semigroupoids ==6.0.1,
156+ semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
157+ any.socks ==0.6.1,
158+ any.split ==0.2.5,
159+ any.splitmix ==0.1.0.5,
160+ splitmix -optimised-mixer,
161+ any.stm ==2.5.1.0,
162+ any.streaming-commons ==0.2.2.6,
163+ streaming-commons -use-bytestring-builder,
164+ any.strict ==0.5,
165+ any.tagged ==0.8.8,
166+ tagged +deepseq +transformers,
167+ any.template-haskell ==2.20.0.0,
168+ any.text ==2.0.2,
169+ any.text-short ==0.1.6,
170+ text-short -asserts,
171+ any.th-abstraction ==0.5.0.0,
172+ any.th-compat ==0.1.5,
173+ any.these ==1.2.1,
174+ any.time ==1.12.2,
175+ any.time-compat ==1.9.6.1,
176+ time-compat -old-locale,
177+ any.tls ==1.8.0,
178+ tls +compat -hans +network,
179+ any.transformers ==0.6.1.0,
180+ any.transformers-base ==0.4.6,
181+ transformers-base +orphaninstances,
182+ any.transformers-compat ==0.7.2,
183+ transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
184+ any.unix ==2.8.4.0,
185+ any.unix-time ==0.4.15,
186+ any.unliftio-core ==0.2.1.0,
187+ any.unordered-containers ==0.2.20,
188+ unordered-containers -debug,
189+ any.uuid ==1.3.15,
190+ any.uuid-types ==1.0.5.1,
191+ any.vector ==0.13.1.0,
192+ vector +boundschecks -internalchecks -unsafechecks -wall,
193+ any.vector-algorithms ==0.9.0.2,
194+ vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks,
195+ any.vector-stream ==0.1.0.1,
196+ any.witherable ==0.4.2,
197+ any.yaml ==0.11.11.2,
198+ yaml +no-examples +no-exe,
199+ any.zlib ==0.6.3.0,
200+ zlib -bundled-c-zlib -non-blocking-ffi -pkg-config
201+index-state: hackage.haskell.org 2025-03-23T06:19:38Z
connexpay-optparse/connexpay-optparse.cabal+4
@@ -1,5 +1,6 @@
1cabal-version: 3.0
1cabal-version: 3.0
2name: connexpay-optparse
2name: connexpay-optparse
3+description: Parsing CLI arguments for connexpay
3version: 0.1
4version: 0.1
4synopsis: Optparse Applicative combinators for Connexpay
5synopsis: Optparse Applicative combinators for Connexpay
5license: MIT
6license: MIT
@@ -10,6 +11,9 @@ copyright: Antorica LLC
10category: System
11category: System
11build-type: Simple
12build-type: Simple
12
13
14+
15+tested-with: GHC ==9.8.4 || ==9.6.6
16+
13common warnings
17common warnings
14 ghc-options: -Wall
18 ghc-options: -Wall
15
19
connexpay/LICENSEnew file+21
@@ -0,0 +1,21 @@
1+MIT License
2+
3+Copyright (c) 2023 Typeable
4+
5+Permission is hereby granted, free of charge, to any person obtaining a copy
6+of this software and associated documentation files (the "Software"), to deal
7+in the Software without restriction, including without limitation the rights
8+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+copies of the Software, and to permit persons to whom the Software is
10+furnished to do so, subject to the following conditions:
11+
12+The above copyright notice and this permission notice shall be included in all
13+copies or substantial portions of the Software.
14+
15+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+SOFTWARE.
connexpay/connexpay.cabal+27−33
@@ -1,21 +1,39 @@
1cabal-version: 3.0
1cabal-version: 3.0
2name: connexpay
2name: connexpay
3+description: Interacting with Connexpay API
3version: 0.1
4version: 0.1
4synopsis: ConnexPay library for Haskell
5synopsis: ConnexPay library for Haskell
5homepage: https://github.com/typeable/connexpay
6homepage: https://github.com/typeable/connexpay
6−license: NONE
7+license: MIT
7author: Nick
8author: Nick
8maintainer: nick@typeable.io
9maintainer: nick@typeable.io
9copyright: Typeable.io
10copyright: Typeable.io
10category: Web
11category: Web
11build-type: Simple
12build-type: Simple
12−-- extra-source-files:
13
13
14+
15+tested-with: GHC ==9.8.4 || ==9.6.6
16+
14−common warnings
17+common common
18+ default-extensions:
19+ BlockArguments
20+ DeriveAnyClass
21+ DerivingVia
22+ DuplicateRecordFields
23+ LambdaCase
24+ MultiWayIf
25+ NoFieldSelectors
26+ OverloadedLabels
27+ OverloadedRecordDot
28+ OverloadedStrings
29+ RecordWildCards
30+ default-language: GHC2021
15− ghc-options: -Wall
31+ ghc-options:
32+ -Wall -Wmissing-deriving-strategies -Wprepositive-qualified-module
33+ -Wunused-packages -Wredundant-constraints
16
34
17library
35library
18− import: warnings
36+ import: common
19 exposed-modules: Web.Connexpay
37 exposed-modules: Web.Connexpay
20 Web.Connexpay.Auth
38 Web.Connexpay.Auth
21 Web.Connexpay.Data
39 Web.Connexpay.Data
@@ -23,12 +41,6 @@ library
23 Web.Connexpay.Payments
41 Web.Connexpay.Payments
24 Web.Connexpay.Types
42 Web.Connexpay.Types
25 Web.Connexpay.Utils
43 Web.Connexpay.Utils
26− default-extensions: DuplicateRecordFields
27− OverloadedLabels
28− OverloadedRecordDot
29− NoFieldSelectors
30− -- other-modules:
31− -- other-extensions:
32 build-depends: base >=4.14 && < 5.0
44 build-depends: base >=4.14 && < 5.0
33 , aeson
45 , aeson
34 , async
46 , async
@@ -42,36 +54,18 @@ library
42 , text
54 , text
43 , uuid
55 , uuid
44 hs-source-dirs: src
56 hs-source-dirs: src
45− default-language: GHC2021
46
57
47executable connexpay-tool
58executable connexpay-tool
48− import: warnings
59+ import: common
49− default-extensions: DuplicateRecordFields
50− OverloadedLabels
51− OverloadedRecordDot
52− NoFieldSelectors
53 build-depends: base >= 4.17
60 build-depends: base >= 4.17
54 , aeson
61 , aeson
55− , async
56 , bucks
62 , bucks
57− , bytestring
63+ , connexpay
58− , http-api-data
59 , http-client
64 , http-client
60 , http-client-tls
65 , http-client-tls
61− , http-types
62− , mtl
63 , optparse-applicative
66 , optparse-applicative
64− , req
65 , text
67 , text
66 , uuid
68 , uuid
67 , yaml
69 , yaml
68− hs-source-dirs: src
70+ hs-source-dirs: tool
69− other-modules: Web.Connexpay
70− Web.Connexpay.Auth
71− Web.Connexpay.Data
72− Web.Connexpay.Init
73− Web.Connexpay.Payments
74− Web.Connexpay.Types
75− Web.Connexpay.Utils
76− main-is: Tool.hs
71+ main-is: Main.hs
77− default-language: GHC2021
connexpay/src/Web/Connexpay/Auth.hs+2−2
@@ -1,5 +1,5 @@
1{-# LANGUAGE OverloadedLists #-}
1{-# LANGUAGE OverloadedLists #-}
2−{-# LANGUAGE OverloadedStrings #-}
2+
3module Web.Connexpay.Auth (authenticate) where
3module Web.Connexpay.Auth (authenticate) where
4
4
5import Web.Connexpay.Types
5import Web.Connexpay.Types
@@ -33,7 +33,7 @@ mkAuthForm login passwd = ByteString.toStrict (urlEncodeAsForm form)
33
33
34data TokenReply = TokenReply { token :: BearerToken
34data TokenReply = TokenReply { token :: BearerToken
35 , expires_in :: Natural
35 , expires_in :: Natural
36− } deriving (Show)
36+ } deriving stock (Show)
37
37
38instance FromJSON TokenReply where
38instance FromJSON TokenReply where
39 parseJSON (Object v) = do typ <- v .: "token_type"
39 parseJSON (Object v) = do typ <- v .: "token_type"
connexpay/src/Web/Connexpay/Data.hs+4−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE OverloadedStrings #-}
2module Web.Connexpay.Data ( TransactionStatus(..)
1module Web.Connexpay.Data ( TransactionStatus(..)
3 , PaymentFailure(..)
2 , PaymentFailure(..)
4 , ConnectionError(..)
3 , ConnectionError(..)
@@ -24,7 +23,7 @@ data TransactionStatus = TransactionApproved -- ^ Obvious
24 | TransactionCreatedProcError -- ^ Processor errored out
23 | TransactionCreatedProcError -- ^ Processor errored out
25 | TransactionApprovedWarning -- ^ Wut 0__o FIXME: figure out what this is
24 | TransactionApprovedWarning -- ^ Wut 0__o FIXME: figure out what this is
26 | TransactionOther Text -- ^ In case they return something unexpected
25 | TransactionOther Text -- ^ In case they return something unexpected
27− deriving (Eq, Ord, Show)
26+ deriving stock (Eq, Ord, Show)
28
27
29statuses :: [(Text, TransactionStatus)]
28statuses :: [(Text, TransactionStatus)]
30statuses = [ ( "Transaction - Approved", TransactionApproved )
29statuses = [ ( "Transaction - Approved", TransactionApproved )
@@ -49,7 +48,7 @@ data PaymentFailure = CVVFailed -- ^ CVV verification failure
49 | GeneralDecline -- ^ They just decline
48 | GeneralDecline -- ^ They just decline
50 | LocalTransaction -- ^ Special case for transactions that were registered but did't go through somehow.
49 | LocalTransaction -- ^ Special case for transactions that were registered but did't go through somehow.
51 | OtherProcessingError Text -- ^ Some other processing error with 422 code
50 | OtherProcessingError Text -- ^ Some other processing error with 422 code
52− deriving (Eq, Show)
51+ deriving stock (Eq, Show)
53
52
54describeFailure :: PaymentFailure -> Text
53describeFailure :: PaymentFailure -> Text
55describeFailure CVVFailed = "CVV authorisation failure"
54describeFailure CVVFailed = "CVV authorisation failure"
@@ -81,7 +80,7 @@ data ConnectionError = ParseError String
81 | InvalidUrl String String
80 | InvalidUrl String String
82 | HttpFailure HttpExceptionContent
81 | HttpFailure HttpExceptionContent
83 | TokenError String
82 | TokenError String
84− deriving Show
83+ deriving stock Show
85
84
86-- | Error type for Connexpay.
85-- | Error type for Connexpay.
87-- There are two possible cases here:
86-- There are two possible cases here:
@@ -91,6 +90,6 @@ data ConnectionError = ParseError String
91-- No exception here, this must be handled as usual.
90-- No exception here, this must be handled as usual.
92data ConnexpayError = ConnectionError ConnectionError
91data ConnexpayError = ConnectionError ConnectionError
93 | PaymentFailure PaymentFailure (Maybe Text)
92 | PaymentFailure PaymentFailure (Maybe Text)
94− deriving (Show)
93+ deriving stock (Show)
95
94
96instance Exception ConnexpayError
95instance Exception ConnexpayError
connexpay/src/Web/Connexpay/Init.hs−1
@@ -1,4 +1,3 @@
1−{-# LANGUAGE OverloadedStrings #-}
2module Web.Connexpay.Init (initConnexpay) where
1module Web.Connexpay.Init (initConnexpay) where
3
2
4import Web.Connexpay.Auth
3import Web.Connexpay.Auth
connexpay/src/Web/Connexpay/Payments.hs+2−3
@@ -1,5 +1,4 @@
1{-# LANGUAGE DataKinds #-}
1{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE TemplateHaskell #-}
2{-# LANGUAGE TemplateHaskell #-}
4{-# LANGUAGE UndecidableInstances #-}
3{-# LANGUAGE UndecidableInstances #-}
5
4
@@ -132,7 +131,7 @@ data AuthResponse = AuthResponse { paymentGuid :: AuthOnlyGuid
132 , processorMessage :: Maybe Text
131 , processorMessage :: Maybe Text
133 , addressVerificationCode :: Maybe Text
132 , addressVerificationCode :: Maybe Text
134 , cvvVerificationCode :: Maybe Text
133 , cvvVerificationCode :: Maybe Text
135− } deriving (Show)
134+ } deriving stock (Show)
136
135
137instance FromJSON AuthResponse where
136instance FromJSON AuthResponse where
138 parseJSON (Object o) = AuthResponse <$> o .: "guid"
137 parseJSON (Object o) = AuthResponse <$> o .: "guid"
@@ -201,7 +200,7 @@ instance ToJSON CPTransaction where
201data CaptureResponse = CaptureResponse { captureGuid :: CaptureGuid
200data CaptureResponse = CaptureResponse { captureGuid :: CaptureGuid
202 , saleGuid :: SaleGuid
201 , saleGuid :: SaleGuid
203 , saleStatus :: TransactionStatus
202 , saleStatus :: TransactionStatus
204− } deriving (Show)
203+ } deriving stock (Show)
205
204
206instance FromJSON CaptureResponse where
205instance FromJSON CaptureResponse where
207 parseJSON (Object o) =
206 parseJSON (Object o) =
connexpay/src/Web/Connexpay/Types.hs+2−2
@@ -1,4 +1,3 @@
1−{-# LANGUAGE OverloadedStrings #-}
2module Web.Connexpay.Types where
1module Web.Connexpay.Types where
3
2
4import Web.Connexpay.Data
3import Web.Connexpay.Data
@@ -37,7 +36,8 @@ data Connexpay = Connexpay { logAction :: Text -> IO ()
37 }
36 }
38
37
39newtype ConnexpayM a = ConnexpayM (ReaderT Connexpay (ExceptT ConnexpayError IO) a)
38newtype ConnexpayM a = ConnexpayM (ReaderT Connexpay (ExceptT ConnexpayError IO) a)
39+ deriving newtype
40− deriving (Functor, Applicative, Monad, MonadIO, MonadReader Connexpay, MonadError ConnexpayError)
40+ (Functor, Applicative, Monad, MonadIO, MonadReader Connexpay, MonadError ConnexpayError)
41
41
42instance MonadHttp ConnexpayM where
42instance MonadHttp ConnexpayM where
43 handleHttpException (JsonHttpException e) = throwError (ConnectionError $ ParseError e)
43 handleHttpException (JsonHttpException e) = throwError (ConnectionError $ ParseError e)
connexpay/src/Tool.hs → connexpay/tool/Main.hsrenamed+2−2
@@ -1,5 +1,5 @@
1{-# LANGUAGE ApplicativeDo #-}
1{-# LANGUAGE ApplicativeDo #-}
2−{-# LANGUAGE OverloadedStrings #-}
2+
3module Main where
3module Main where
4
4
5import Control.Concurrent (yield)
5import Control.Concurrent (yield)
@@ -28,7 +28,7 @@ data Config = Config { login :: Text
28 , use_tls :: Bool
28 , use_tls :: Bool
29 , proxy_host :: Maybe Text
29 , proxy_host :: Maybe Text
30 , proxy_port :: Maybe Word
30 , proxy_port :: Maybe Word
31− } deriving Generic
31+ } deriving stock Generic
32
32
33instance FromJSON Config
33instance FromJSON Config
34
34