Skip to content

Commit 266a2d3

Browse files
Merge branch 'develop-ghc-9.6.3'. Close #491.
**Description** `copilot-theorem` is failing to compile with GHC 9.6.3. This is because the module `Control.Monad.State` no longer re-exports `Control.Monad`, so the functions `ap`, `forM`, `when`, `liftM` and `liftM2` are not in scope. Another issue is that `System.Directory` can no longer be imported safely. These errors are causing the build to fail on hackage, which uses GHC 9.6.3. **Type** - Bug: Failure to compile with version of dependency. **Additional context** - haskell/directory#147 **Requester** - Ivan Perez **Method to check presence of bug** The following Dockerfile checks whether Copilot can be installed with GHC 9.6, in which case it prints the message Success: ```Dockerfile FROM ubuntu:focal RUN apt-get update RUN apt-get install --yes libz-dev RUN apt-get install --yes git RUN apt-get install --yes wget RUN mkdir -p $HOME/.ghcup/bin RUN wget https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -O $HOME/.ghcup/bin/ghcup RUN chmod a+x $HOME/.ghcup/bin/ghcup ENV PATH=$PATH:/root/.ghcup/bin/ ENV PATH=$PATH:/root/.cabal/bin/ RUN apt-get install --yes curl RUN apt-get install --yes gcc g++ make libgmp3-dev RUN ghcup install ghc 9.6.3 RUN ghcup install cabal 3.4 RUN ghcup set ghc 9.6.3 RUN cabal update SHELL ["/bin/bash", "-c"] CMD git clone $REPO \ && cd $NAME \ && git checkout $COMMIT \ && cabal install --lib copilot**/ \ && echo Success ``` Command (substitute variables based on new path after merge): ``` $ docker run -e "REPO=https://github.com/Copilot-Language/copilot" -e "NAME=copilot" -e "COMMIT=<HASH>" -it copilot-verify-491 ``` **Expected result** Compiling with GHC 9.6 succeeds. Running the above image prints the message Success, indicating that Copilot can be compile with GHC 9.6.3. **Solution implemented** Modify `copilot-theorem` to import `Control.Monad` explicitly, instead of via re-exports from other modules. Modify the module that imports `System.Directory` so that it is marked as trustworthy instead of Safe. **Further notes** None.
2 parents a53f532 + b9c7f58 commit 266a2d3

File tree

8 files changed

+13
-3
lines changed

8 files changed

+13
-3
lines changed

copilot-theorem/CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2024-01-07
2+
* Adjust to work with GHC 9.6. (#491)
3+
14
2024-01-07
25
* Version bump (3.18). (#487)
36
* Introduce testing infrastructure for Copilot.Theorem.What4. (#474)

copilot-theorem/src/Copilot/Theorem/IL/Translate.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import qualified Copilot.Core as C
1414

1515
import qualified Data.Map.Strict as Map
1616

17+
import Control.Monad (forM, liftM2, when)
1718
import Control.Monad.State
1819

1920
import Data.Char

copilot-theorem/src/Copilot/Theorem/Misc/Utils.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE Safe #-}
1+
{-# LANGUAGE Trustworthy #-}
22

33
-- | Utility / auxiliary functions.
44
module Copilot.Theorem.Misc.Utils

copilot-theorem/src/Copilot/Theorem/Prove.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import qualified Copilot.Core as Core
2222

2323
import Data.List (intercalate)
2424
import Control.Applicative (liftA2)
25+
import Control.Monad (ap, liftM)
2526
import Control.Monad.Writer
2627

2728
-- | Output produced by a prover, containing the 'Status' of the proof and

copilot-theorem/src/Copilot/Theorem/TransSys/Translate.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import Copilot.Theorem.TransSys.Spec
4747
import Copilot.Theorem.TransSys.Cast
4848
import Copilot.Theorem.Misc.Utils
4949

50+
import Control.Monad (liftM, liftM2, unless)
5051
import Control.Monad.State.Lazy
5152

5253
import Data.Char (isNumber)

copilot-theorem/src/Copilot/Theorem/What4.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import qualified What4.InterpretedFloatingPoint as WFP
5757
import qualified What4.Solver as WS
5858
import qualified What4.Solver.DReal as WS
5959

60+
import Control.Monad (forM)
6061
import Control.Monad.State
6162
import qualified Data.BitVector.Sized as BV
6263
import Data.Foldable (foldrM)

copilot/CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2024-01-07
2+
* Update README to reflect support for GHC 9.6. (#491)
3+
14
2024-01-07
25
* Version bump (3.18). (#487)
36
* Enable tests for copilot-theorem in CI script. (#474)

copilot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ghci> ghci> Leaving GHCi.
8181
On other Linux distributions or older Debian-based distributions, to use
8282
Copilot you must install a Haskell compiler (GHC) and the package manager
8383
Cabal. We currently support all versions of GHC from 8.6.5 to modern versions
84-
(9.4 as of this writing). You can install the toolchain using
84+
(9.6 as of this writing). You can install the toolchain using
8585
[ghcup](https://www.haskell.org/ghcup/) or, if you are on Debian/Ubuntu,
8686
directly with `apt-get`:
8787

@@ -111,7 +111,7 @@ ghci> ghci> Leaving GHCi.
111111

112112
To use Copilot you must have a Haskell compiler (GHC) and the package manager
113113
Cabal. We currently support all versions of GHC from 8.6.5 to modern versions
114-
(9.4 as of this writing). You can install the toolchain using
114+
(9.6 as of this writing). You can install the toolchain using
115115
[ghcup](https://www.haskell.org/ghcup/), as well as with Homebrew:
116116

117117
```sh

0 commit comments

Comments
 (0)