Skip to content

Commit

Permalink
Merge pull request #201 from unsplash/ghc94
Browse files Browse the repository at this point in the history
GHC 9.4
  • Loading branch information
samhh authored Sep 14, 2023
2 parents 2d3f50c + d874b0f commit 257e66a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 69 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v22
- run: nix flake check
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v22
- run: nix develop -c cabal update
- run: nix develop -c cabal freeze
- uses: actions/cache@v3
Expand All @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v22
- run: nix develop -c cabal update
- run: nix develop -c cabal freeze
- uses: actions/cache@v3
Expand All @@ -45,14 +45,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v22
- run: nix develop -c hlint lib cli test
fmt:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v22
# stylish-haskell doesn't have a check/dry run option, so we'll run it
# against files in place and test if there are any diffs with Git.
- run: |
Expand All @@ -66,7 +66,7 @@ jobs:
working-directory: .golden/ts/
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: cachix/install-nix-action@v22
- uses: actions/cache@v3
with:
path: ~/.cache/yarn/v6
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ The description is optional and ignored by intlc. It can be used documentatively

Check out `ARCHITECTURE.md`.

Currently building against GHC 9.2.4. A Nix flake is included with all necessary dependencies. Contributors on Apple silicon will need to source GHC and HLS externally, for example via ghcup.
Currently building against GHC 9.4.6. A Nix flake is included with all necessary dependencies.
32 changes: 25 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 8 additions & 49 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
# There are two major considerations when picking a version of GHC for this
# project.
#
# Firstly, we'd like the version we choose to have tooling available in Nix's
# binary cache, without contributors having to mess around with additional
# caches. This limits us to the "default" version of GHC in nixpkgs.
#
# With this in mind, we could simply use the `ghc` and `haskellPackages`
# package and package set, however the following has been written with
# flexibility in mind. Note that using `haskellPackages` implicitly brings the
# default version of GHC into scope as it's merely an alias for the default
# package set [1].
#
# Secondly, HLS is currently marked as broken on aarch64-darwin [2], which
# impacts Apple silicon contributors. With this in mind we're also keen to
# ensure that our chosen version of GHC is supported by HLS as distributed via
# ghcup.
#
# This means we're effectively stuck with whichever version of GHC is both the
# default for nixpkgs at some point in time - in the past is okay, as nixpkgs
# is pinned and the cache is long-lived - and which has the requisite support
# in ghcup as well. At time of writing that version is 9.2.4.
#
# Further complicating matters, GHC and HLS need to be sourced from the same
# place to ensure that HLS was compiled against that same version of GHC, lest
# we see "ABIs don't match" errors. Therefore aarch64-darwin contributors must
# not only source HLS externally but also GHC.
#
# But that's not all! A subset of Apple silicon contributors have reported being
# unable to run compiled 9.2.4 code. 9.2.5 fixes it. These users are encouraged
# to use 9.2.5 for the timebeing irrespective of the configuration here.
#
# In short, don't upgrade GHC until it's the default in nixpkgs, and available
# in ghcup and supported by HLS there as well.
#
# [1]: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/haskell.section.md#available-packages-haskell-available-packages
# [2]: https://github.com/NixOS/nixpkgs/blob/a410420844fe1ad6415cf9586308fe7538cc7584/pkgs/development/compilers/llvm/7/compiler-rt/default.nix#L108
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
Expand All @@ -45,30 +8,26 @@
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};

ghcVer = "924";
# We'll stick with the "default" version of GHC in nixpkgs to benefit
# from the binary cache:
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/haskell.section.md#available-packages-haskell-available-packages
ghcVer = "ghc946";

hask = if system == flake-utils.lib.system.aarch64-darwin
then [ ]
else with pkgs; [
haskell.compiler."ghc${ghcVer}"
(haskell-language-server.override { supportedGhcVersions = [ ghcVer ];})
];

haskPkgs = pkgs.haskell.packages."ghc${ghcVer}";
haskPkgs = pkgs.haskell.packages."${ghcVer}";
in {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
git

cabal-install
haskell.compiler."${ghcVer}"
haskPkgs.haskell-language-server
hlint
haskPkgs.hspec-golden
stylish-haskell

# For typechecking golden output
nodejs
yarn
] ++ hask;
];
};
});
}
12 changes: 6 additions & 6 deletions intlc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ common common
ghc-options:
-Wall
build-depends:
base ^>=4.16
base ^>=4.17
, bytestring ^>=0.11
, comonad ^>=5.0
, containers ^>=0.6
Expand All @@ -24,8 +24,8 @@ common common
, free ^>=5.1
, mtl ^>=2.2
, recursion-schemes ^>=5.2
, relude ^>=1.1
, text ^>=1.2
, relude ^>=1.2
, text ^>=2.0
, validation ^>=1.1
mixins:
base hiding (Prelude)
Expand All @@ -48,7 +48,7 @@ library
hs-source-dirs: lib/
build-depends:
parser-combinators ^>=1.2
, megaparsec ^>=9.0
, megaparsec ^>=9.5
exposed-modules:
Intlc.Compiler
Intlc.Backend.JavaScript.Language
Expand Down Expand Up @@ -79,10 +79,10 @@ test-suite test-intlc
build-depends:
intlc
, filepath ^>=1.4
, hspec ^>=2.7
, hspec ^>=2.11
, hspec-golden ^>=0.2
, hspec-megaparsec ^>=2.2
, megaparsec ^>=9.0
, megaparsec ^>=9.5
, raw-strings-qq ^>=1.1
build-tool-depends:
hspec-discover:hspec-discover
Expand Down

0 comments on commit 257e66a

Please sign in to comment.