on master help sign in
Run the build with 3 latest GHC versions
commit1e089f7dc81f39ccb29ae00ca26655008f565145 authorMark Karpov <markkarpov92@gmail.com> dateTue 14 Apr 2020, 15:14 (7 years ago) parente7c080e
6 files changed+55−37
.buildkite/pipeline.yml+14−3 default.nix+26−19 nix/nixpkgs/default.nix+2−2 src/Ormolu/Parser/Pragma.hs+4−4 src/Ormolu/Printer/Meat/Declaration.hs+1−1 src/Ormolu/Printer/Operators.hs+8−8
.buildkite/pipeline.yml+14−3
@@ -1,7 +1,18 @@
11steps:
2− - label: Build and test
2+ - label: Build and test with GHC 8.6.5
3+ command: |
4+ nix-build --keep-going --no-out-link --argstr ormoluCompiler ghc865
5+ timeout: 100
6+ - label: Build and test with GHC 8.8.3
7+ command: |
8+ nix-build --keep-going --no-out-link --argstr ormoluCompiler ghc883
9+ timeout: 100
10+ - label: Build and test with GHC 8.10.1
11+ command: |
12+ nix-build --keep-going --no-out-link --argstr ormoluCompiler ghc8101
13+ timeout: 100
14+ - wait
15+ - label: Check formatting
316 command: |
4− nix-build --keep-going --no-out-link
517 ./format.sh
618 git diff --exit-code --color=always
7− timeout: 100
default.nix+26−19
@@ -1,7 +1,8 @@
1−{ pkgs ? (import ./nix/nixpkgs) }:
1+{ pkgs ? (import ./nix/nixpkgs)
2+, ormoluCompiler ? "ghc883" # the shell doesn't work with ghc8101 yet
3+}:
24
35let
4− ormoluCompiler = "ghc865";
56 source = pkgs.lib.sourceByRegex ./. [
67 "^.*\.md$"
78 "^app.*$"
@@ -14,16 +15,12 @@ let
1415 overrides = ormoluOverlay;
1516 };
1617 ormoluOverlay = self: super: {
17− "ormolu" = pkgs.haskell.lib.enableCabalFlag
18− (super.callCabal2nix "ormolu" source { }) "dev";
19− # Nixpkgs provides ghc-lib-parser-8.8.0.20190424, but we want
20− # ghc-lib-parser-8.10.1. We disable Haddock generation because it's way
21− # too slow.
18+ "ormolu" = super.callCabal2nixWithOptions "ormolu" source "-fdev" { };
2219 "ghc-lib-parser" = pkgs.haskell.lib.dontHaddock
2320 (super.callHackageDirect {
2421 pkg = "ghc-lib-parser";
25− ver = "8.10.1.20200324";
26− sha256 = "0f2c68fzdj2lw6da2zpx7a0cx631im3kylwd85dzx1npsm1vzlbg";
22+ ver = "8.10.1.20200412";
23+ sha256 = "sha256-EjMzp8xRT3xVFKDI1fAfopkylGB0hv35Av2+uZeETRU=";
2724 } {});
2825 };
2926 ormolize = import ./nix/ormolize {
@@ -51,15 +48,22 @@ let
5148 }) haskellPackages;
5249in {
5350 ormolu = haskellPackages.ormolu;
54− ormoluShell = haskellPackages.shellFor {
55− packages = ps: [
56− ps.ormolu
57− ];
58− buildInputs = [
59− haskellPackages.cabal-install
60− haskellPackages.ghcid
61− ];
62− };
51+ ormoluShell =
52+ if ormoluCompiler == "ghc8101"
53+ # HACK The shell doesn't compile with GHC 8.10.1
54+ then haskellPackages.shellFor {
55+ packages = ps: [];
56+ buildInputs = [];
57+ }
58+ else haskellPackages.shellFor {
59+ packages = ps: [
60+ ps.ormolu
61+ ];
62+ buildInputs = [
63+ haskellPackages.cabal-install
64+ haskellPackages.ghcid
65+ ];
66+ };
6367 withOrmolu = haskellPackages.shellFor {
6468 packages = ps: [];
6569 buildInputs = [
@@ -81,7 +85,6 @@ in {
8185 "cryptonite"
8286 "diagrams-core"
8387 "distributed-process"
84− "esqueleto"
8588 "fay"
8689 "hakyll"
8790 "haxl"
@@ -98,6 +101,10 @@ in {
98101 "tls"
99102 "yesod-core"
100103
104+ # Uses CPP to concatenate strings in a deprecation annotation
105+
106+ # "esqueleto"
107+
101108 # Comment idempotence issue
102109
103110 # "Agda"
nix/nixpkgs/default.nix+2−2
@@ -1,6 +1,6 @@
11let
2− rev = "19.09";
3− sha256 = "0mhqhq21y5vrr1f30qd2bvydv4bbbslvyzclhw0kdxmkgg3z4c92";
2+ rev = "807ca93fadd5197c2260490de0c76e500562dc05";
3+ sha256 = "10yq8bnls77fh3pk5chkkb1sv5lbdgyk1rr2v9xn71rr1k2x563p";
44 nixpkgs = builtins.fetchTarball {
55 url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
66 inherit sha256;
src/Ormolu/Parser/Pragma.hs+4−4
@@ -10,7 +10,7 @@ where
1010
1111import Control.Monad
1212import Data.Char (isSpace, toLower)
13−import Data.List
13+import qualified Data.List as L
1414import qualified EnumSet as ES
1515import FastString (mkFastString, unpackFS)
1616import qualified Lexer as L
@@ -35,8 +35,8 @@ parsePragma ::
3535 String ->
3636 Maybe Pragma
3737parsePragma input = do
38− inputNoPrefix <- stripPrefix "{-#" input
39− guard ("#-}" `isSuffixOf` input)
38+ inputNoPrefix <- L.stripPrefix "{-#" input
39+ guard ("#-}" `L.isSuffixOf` input)
4040 let contents = take (length inputNoPrefix - 3) inputNoPrefix
4141 (pragmaName, cs) = (break isSpace . dropWhile isSpace) contents
4242 case toLower <$> pragmaName of
@@ -46,7 +46,7 @@ parsePragma input = do
4646 _ -> Nothing
4747 where
4848 trimSpaces :: String -> String
49− trimSpaces = dropWhileEnd isSpace . dropWhile isSpace
49+ trimSpaces = L.dropWhileEnd isSpace . dropWhile isSpace
5050
5151-- | Assuming the input consists of a series of tokens from a language
5252-- pragma, return the set of enabled extensions.
src/Ormolu/Printer/Meat/Declaration.hs+1−1
@@ -164,7 +164,7 @@ p_instDecl style = \case
164164
165165p_derivDecl :: DerivDecl GhcPs -> R ()
166166p_derivDecl = \case
167− d@DerivDecl {..} -> p_standaloneDerivDecl d
167+ d@DerivDecl {} -> p_standaloneDerivDecl d
168168 XDerivDecl x -> noExtCon x
169169
170170-- | Determine if these declarations should be grouped together.
src/Ormolu/Printer/Operators.hs+8−8
@@ -11,7 +11,7 @@ module Ormolu.Printer.Operators
1111where
1212
1313import Data.Function (on)
14−import Data.List
14+import qualified Data.List as L
1515import Data.Maybe (fromMaybe, mapMaybe)
1616import Data.Ord (Down (Down), comparing)
1717import GHC
@@ -105,7 +105,7 @@ buildFixityMap ::
105105buildFixityMap getOpName opTree =
106106 concatMap (\(i, ns) -> map (\(n, _) -> (n, fixity i InfixL)) ns)
107107 . zip [0 ..]
108− . groupBy (doubleWithinEps 0.00001 `on` snd)
108+ . L.groupBy (doubleWithinEps 0.00001 `on` snd)
109109 . (overrides ++)
110110 . modeScores
111111 $ score opTree
@@ -143,22 +143,22 @@ buildFixityMap getOpName opTree =
143143 -- Pick the most common score per 'RdrName'.
144144 modeScores :: [(RdrName, Double)] -> [(RdrName, Double)]
145145 modeScores =
146− sortOn snd
146+ L.sortOn snd
147147 . mapMaybe
148148 ( \case
149149 [] -> Nothing
150150 xs@((n, _) : _) -> Just (n, mode $ map snd xs)
151151 )
152− . groupBy ((==) `on` fst)
153− . sort
152+ . L.groupBy ((==) `on` fst)
153+ . L.sort
154154 -- Return the most common number, leaning to the smaller
155155 -- one in case of a tie.
156156 mode :: [Double] -> Double
157157 mode =
158158 head
159− . minimumBy (comparing (Down . length))
160− . groupBy (doubleWithinEps 0.0001)
161− . sort
159+ . L.minimumBy (comparing (Down . length))
160+ . L.groupBy (doubleWithinEps 0.0001)
161+ . L.sort
162162 -- The start column of the rightmost operator.
163163 maxCol = go opTree
164164 where