Skip to content
Permalink
Browse files

Lint Prelude (#571)

Fixes #563

This change does a few things:

* First, this fixes the hashes in the Prelude

* Second, this adds CI support for keeping the hashes in sync with a
  specific revision of the Haskell Dhall implementation

* Third, this adds a `./script/lint-prelude.sh` script for regenerating
  the expected hashes for convenience

* Update `dhall-haskell` reference
  • Loading branch information...
Gabriel439 committed Jun 4, 2019
1 parent 136a349 commit 542e3abdf26d7d021b35b3170571046f562e2e3b
Showing with 73 additions and 67 deletions.
  1. +11 −1 Prelude/JSON/Tagged
  2. +4 −4 Prelude/Text/package.dhall
  3. +1 −1 Prelude/package.dhall
  4. +0 −49 nix/fetchNixpkgs.nix
  5. +3 −3 nixops/dhall-haskell.json
  6. +1 −1 nixops/logical.nix
  7. +48 −8 release.nix
  8. +5 −0 scripts/lint-prelude.sh
@@ -62,6 +62,16 @@ in { provisioners =
-}
let Tagged
: Type Type
= λ(a : Type) { field : Text, nesting : ./Nesting, contents : a }
= λ ( a
: Type
)
{ field :
Text
, nesting :
./Nesting sha256:6284802edd41d5d725aa1ec7687e614e21ad1be7e14dd10996bfa9625105c335
? ./Nesting
, contents :
a
}

in Tagged
@@ -1,14 +1,14 @@
{ concat =
./concat sha256:35e20d9403fbadb1a0061edb84e076ed56313709fa4bc8124d86ff54896f20ac
./concat sha256:731265b0288e8a905ecff95c97333ee2db614c39d69f1514cb8eed9259745fc0
? ./concat
, concatMap =
./concatMap sha256:175d893ad7f2b2c05fff9e32f0d9cbadc7f5fce57945071508cf3603f8aa298e
./concatMap sha256:7a0b0b99643de69d6f94ba49441cd0fa0507cbdfa8ace0295f16097af37e226f
? ./concatMap
, concatMapSep =
./concatMapSep sha256:46b81a9e211fb8278bf2793e75e8175fef79e0e3e478ef1016e3233ecc2ddfe6
./concatMapSep sha256:c272aca80a607bc5963d1fcb38819e7e0d3e72ac4d02b1183b1afb6a91340840
? ./concatMapSep
, concatSep =
./concatSep sha256:d28e61f5057a240e857e09dba1b040fa3477bddb9659c5606c760852a9165890
./concatSep sha256:e4401d69918c61b92a4c0288f7d60a6560ca99726138ed8ebc58dca2cd205e58
? ./concatSep
, show =
./show sha256:c9dc5de3e5f32872dbda57166804865e5e80785abe358ff61f1d8ac45f1f4784
@@ -23,6 +23,6 @@
./JSON/package.dhall sha256:7f0c25a292e5d34ddfbbf3f6d90505567382f95d822b04f5810745f81ab1ef35
? ./JSON/package.dhall
, Text =
./Text/package.dhall sha256:c8bc93456397476051dc674c180ddd5db098546861c8df24bda8284511d3305e
./Text/package.dhall sha256:3b6ed813caf2388b91056d625c6b958b72009f85a6af262d4a7b935b18caf62b
? ./Text/package.dhall
}

This file was deleted.

@@ -1,7 +1,7 @@
{
"url": "https://github.com/dhall-lang/dhall-haskell.git",
"rev": "d0fb71b0ba9ae13777b107d9f2050a6be9b07a06",
"date": "2019-04-13T21:08:34-07:00",
"sha256": "06bkrp571sxl8jg5a8d4zx70nimvz2hnmy76jhz0b7hsv0bzh8rs",
"rev": "98c7d4dfca32fc65d270634f959ba1e6ca73a247",
"date": "2019-06-02T14:16:47-07:00",
"sha256": "1p8mkxz81x8bx2vhj92d8rjklh546zjj964769166yz4krbk4z52",
"fetchSubmodules": true
}
@@ -173,7 +173,7 @@

repo = "dhall-haskell";

inherit (json) rev sha256;
inherit (json) rev sha256 fetchSubmodules;
};

dhall-haskell-derivations =
@@ -1,16 +1,33 @@
{ src, ... }:
{ src ? { rev = ""; }, ... }:

let
fetchNixpkgs = import ./nix/fetchNixpkgs.nix;
nixpkgs =
builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/804060ff9a79ceb0925fe9ef79ddbf564a225d47.tar.gz";

nixpkgs = fetchNixpkgs {
rev = "804060ff9a79ceb0925fe9ef79ddbf564a225d47";
sha256 = "0ga345hgw6v2kzyhvf5kw96hf60mx5pbd9c4qj5q4nan4lr7nkxn";
};

sha256 = "01pb6p07xawi60kshsxxq1bzn8a0y4s5jjqvhkwps4f5xjmmwav3";
overlay = pkgsNew: pkgsOld: {
dhall =
let
json = builtins.fromJSON (builtins.readFile ./nixops/dhall-haskell.json);

outputSha256 = "0ga345hgw6v2kzyhvf5kw96hf60mx5pbd9c4qj5q4nan4lr7nkxn";
};
dhall-haskell =
pkgs.fetchFromGitHub {
owner = "dhall-lang";

repo = "dhall-haskell";

inherit (json) rev sha256 fetchSubmodules;
};

dhall-haskell-derivations =
import "${dhall-haskell}/default.nix";

in
dhall-haskell-derivations.dhall;

overlay = pkgsNew: pkgsOld: {
instaparse-check = pkgsNew.writeText "build.boot" ''
(require '[instaparse.core :refer [parser]])
@@ -44,6 +61,26 @@ let
touch $out
'';

expected-prelude = pkgsNew.runCommand "expected-prelude" {} ''
${pkgsNew.rsync}/bin/rsync --archive ${./Prelude}/ "$out"
${pkgsNew.coreutils}/bin/chmod --recursive u+w "$out"
for FILE in $(${pkgsNew.findutils}/bin/find "$out" -type f); do
${pkgsNew.dhall}/bin/dhall lint --inplace "$FILE"
${pkgsNew.dhall}/bin/dhall freeze --all --cache --inplace "$FILE"
done
'';

prelude-lint = pkgsNew.runCommand "prelude-lint" {} ''
${pkgsNew.rsync}/bin/rsync --archive ${pkgsNew.expected-prelude}/ ./Prelude.expected
${pkgsNew.rsync}/bin/rsync --archive ${./Prelude}/ ./Prelude.actual
${pkgsNew.diffutils}/bin/diff --recursive ./Prelude.{actual,expected}
touch $out
'';
};

pkgs = import nixpkgs { config = {}; overlays = [ overlay ]; };
@@ -61,7 +98,10 @@ in

constituents = [
pkgs.dhall-grammar
pkgs.prelude-lint
rev
];
};

inherit (pkgs) expected-prelude;
}
@@ -0,0 +1,5 @@
set -eu

nix build --file ./release.nix expected-prelude
rsync --archive --delete result/ ./Prelude
chmod --recursive u+w ./Prelude

0 comments on commit 542e3ab

Please sign in to comment.
You can’t perform that action at this time.