1
1
mirror of https://github.com/anoma/juvix.git synced 2024-09-17 19:47:45 +03:00
juvix/.devcontainer/Dockerfile
Jan Mas Rovira 13f64afbc1
upgrade to Ghc 9.8.1 (#2624)
This PR updates the stackage LTS resolver to `nightly-2024-02-06` which
uses GHC 9.8.1

## Upgrade notes

You will need to update your HLS to
[2.6.0.0](https://github.com/haskell/haskell-language-server/releases/tag/2.6.0.0),
this release contains support for GHC 9.8.1

## Fixes

### `haskeline` / `repline`

We have removed the custom haskeline / repline forks used in the build.
This is because we had trouble overriding haskeline as it is bundled
with GHC and the stackage resolver uses this bundled version. We were
using a custom fork of haskeline to implement
[mapInputT_](15c0685c91/app/Commands/Repl.hs (L409))
in the Juvix REPL, required to implement error handling. This requires
private API from the Haskeline library.

Instead of using a custom fork we use TemplateHaskell to obtain access
to the private API we need. See
[DarkArts.hs](15c0685c91/src/Juvix/Prelude/DarkArts.hs)
and
[HaskelineJB.hs](15c0685c91/app/HaskelineJH.hs).

To obtain access to the private API, we adapted a method from [a Tweag
blogpost](https://www.tweag.io/blog/2021-01-07-haskell-dark-arts-part-i/)
and [repo](https://github.com/tweag/th-jailbreak) - updating it for GHC
9.8.1.

### `aeson-better-errors`

The `aeson-better-errors` library has not been updated to work with
`mtl-2.3.0` so it cannot work with the new stackage resolver. We are
using a [fork](https://github.com/Vekhir/aeson-better-errors.git) which
has been updated.

We should consider replacing this library in future, see
https://github.com/anoma/juvix/issues/2621

###  `path`

The `path` library now includes API `splitDrive` and `dropDrive` so we
can remove our versions of those functions from the prelude.

### `with-utf8`

We no longer need to depend on `with-utf8`. We were using this package
for UTF-8 versions of `readFile` and `writeFile` APIs. These APIs are
now available in the `text` package.

### Compiler warnings

GHC 9.8.1 introduces several new compiler warnings. 

* We have suppressed `missing-role-annotations` and
`missing-poly-kind-signatures`
* We added our own versions of `head` and `tail` to work around the new
`partial-tx` warning introduced for those functions in `Data.List`.
* We fixed up the code to avoid the
[term-variable-capture](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/using-warnings.html#ghc-flag--Wterm-variable-capture)
warning.
2024-02-07 09:47:48 +00:00

86 lines
2.6 KiB
Docker

# OS
ARG VARIANT="ubuntu-22.04"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
ENV DEBIAN_FRONTEND=noninteractive
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE=1
ENV BOOTSTRAP_HASKELL_GHC_VERSION=9.8.1
ENV BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0
ENV BOOTSTRAP_HASKELL_STACK_VERSION=2.11.1
ENV BOOTSTRAP_HASKELL_INSTALL_STACK=1
ENV BOOTSTRAP_HASKELL_INSTALL_HLS=1
# OS packages for ghcup and juvix runtime
RUN apt-get update && \
apt-get -y install --no-install-recommends \
curl \
sudo \
wget \
unzip \
git \
jq \
bc \
make \
cmake \
clang \
lldb \
lld \
llvm \
automake \
rsync \
htop \
build-essential \
lsb-release \
pkg-config \
libffi-dev \
libgmp-dev \
libgmp10 \
software-properties-common \
libssl-dev \
libicu-dev \
libtinfo-dev \
libsystemd-dev \
zlib1g-dev \
g++ \
libncurses-dev \
libncursesw5 \
libtinfo5 \
libtool \
autoconf && apt-get clean
RUN sudo bash -c 'curl -sSL https://get.haskellstack.org/ | sh'
ENV PATH=${PATH}:/home/vscode/.ghcup/bin
RUN sudo bash -c "curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh"
ENV PATH=${PATH}:/home/vscode/.local/bin
RUN sudo bash -c 'mkdir -p /home/vscode/.local/bin'
RUN sudo bash -c "chown -R vscode /home/vscode/.local/"
RUN sudo bash -c 'curl https://get.wasmer.io -sSfL | sudo WASMER_DIR=/home/vscode/.local sh'
# to be used by the juvix extension
RUN sudo bash -c 'mkdir -p /home/vscode/.local/juvix'
RUN sudo bash -c 'chmod -R a+rXw /home/vscode/.local/juvix'
RUN sudo bash -c 'curl --proto "=https" --tlsv1.2 -sSfL https://get.juvix.org \
| sudo XDG_BIN_HOME=/home/vscode/.local/bin JUVIX_INSTALLER_INSTALL_VAMPIR_YES=true JUVIX_INSTALLER_ASSUME_YES=true sh'
RUN sudo bash -c 'mkdir -p /home/vscode/.local/wasi-sysroot'
RUN sudo bash -c 'curl -s https://api.github.com/repos/WebAssembly/wasi-sdk/releases/tags/wasi-sdk-16 \
| grep -a "browser_download_url.*wasi-sysroot-16.*tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget --output-document wasi-sysroot.tar.gz -qi - \
&& tar xvf wasi-sysroot.tar.gz --directory /home/vscode/.local/wasi-sysroot/'
ENV WASI_SYSROOT_PATH=/home/vscode/.local/wasi-sysroot/
RUN sudo bash -c 'curl -s https://api.github.com/repos/jonaprieto/smoke/releases/latest \
| grep -a "browser_download_url.*Linux" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget --output-document smoke -qi - \
&& mv smoke /home/vscode/.local/bin/smoke \
&& chmod a+x /home/vscode/.local/bin/smoke'