Skip to content

Commit a099f73

Browse files
committed
Fix expose of Haq module within haskell spec
Fix the setup of this Haskell project within CircleCI and when setting up on a new machine or within Docker. This required that `Haq` not be considered a Library (without an executable), but instead an exposed module that was built and included within both the base project, as well as its tests. This should resolve problems that where occurring when running `cabal install` == Notes: - Change the order of `cabal update` with `cabal sandbox init`, since update will only run it there is a sandbox available, which is not present in the Haskell image container - Add `--enable-tests` and `--enable-documentation` to cabal install to slience other warnings == References: - [How to write a Haskell program \- HaskellWiki] (https://wiki.haskell.org/How_to_write_a_Haskell_program#Add_some_tests) - [cabal \- Set up Haskell Project and run tests \- Stack Overflow] (https://stackoverflow.com/questions/38928802/set-up-haskell-project-and-run-tests) - [Cabal\-Install \- HaskellWiki] (https://wiki.haskell.org/Cabal-Install) - [Invoking Haddock — Haddock 1\.0 documentation] (http://haskell-haddock.readthedocs.io/en/latest/invoking.html) - [new\-build failure with custom\-setup when setup\-depends don't contain Cabal · Issue \#4288 · haskell/cabal] (haskell/cabal#4288) - [2\.1\. Configuration — Cabal <release> User's Guide] (https://www.haskell.org/cabal/users-guide/installing-packages.html)
1 parent f39de10 commit a099f73

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

.circleci/config.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@ jobs:
55
- image: haskell:latest
66
steps:
77
- checkout
8-
- run: cabal update
98
- run: cabal sandbox init
10-
- run: cabal install -j
9+
- run: cabal update
10+
# - run: cabal install -j
11+
- run: cabal install --enable-tests --enable-documentation
1112
- run: cabal build
1213

1314
test:
1415
docker:
1516
- image: haskell:latest
1617
steps:
1718
- checkout
18-
- run: cabal update
1919
- run: cabal sandbox init
20-
- run: cabal install --enable-tests
20+
- run: cabal update
21+
- run: cabal install --enable-tests --enable-documentation
2122
- run: cabal test
2223

2324
workflows:

toy-robot-haskell.cabal

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,24 @@ build-type: Simple
4646
extra-source-files: ChangeLog.md
4747

4848
-- Constraint on the version of Cabal needed to build this package.
49-
cabal-version: >=1.10
49+
-- cabal-version: >=1.10
50+
cabal-version: >=2.0
5051

5152

52-
library haq
53-
-- other-modules: Haq
54-
exposed-modules: Haq
55-
build-depends: base >=4.10 && <4.11
56-
hs-source-dirs: src
57-
default-language: Haskell2010
53+
-- library haq
54+
-- -- other-modules: Haq
55+
-- exposed-modules: Haq
56+
-- build-depends: base >=4.10 && <4.11
57+
-- hs-source-dirs: src
58+
-- default-language: Haskell2010
5859

5960

6061
executable toy-robot-haskell
6162
-- .hs or .lhs file containing the Main module.
6263
main-is: Main.hs
6364

6465
-- Modules included in this executable, other than Main.
65-
-- other-modules: Haq
66+
other-modules: Haq
6667
-- exposed-modules: Haq
6768

6869
-- LANGUAGE extensions used by modules in this package.
@@ -92,9 +93,8 @@ test-suite tests
9293
main-is: HSpecTests.hs
9394
hs-source-dirs: src, spec
9495
build-depends: base,
95-
haq,
96+
-- haq,
9697
hspec >= 1.8
9798
default-language: Haskell2010
9899
-- Required due to including src/Haq.hs
99100
other-modules: Haq
100-

0 commit comments

Comments
 (0)