Skip to content

Instantly share code, notes, and snippets.

@utdemir
Last active August 12, 2019 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save utdemir/a28a45739819a65a52983f7701a4554b to your computer and use it in GitHub Desktop.
Save utdemir/a28a45739819a65a52983f7701a4554b to your computer and use it in GitHub Desktop.
{ old, new, pkgs ? import <nixpkgs> {}}:
let
packages = [
"aeson" "Agda" "attoparsec" "cassava" "conduit" "cryptonite"
"diagrams-core" "distributed-process" "esqueleto" "git-annex" "hakyll"
"hedgehog" "hlint" "http-client" "idris" "lens" "pandoc" "pipes"
"purescript" "QuickCheck" "servant" "servant-server" "ShellCheck"
"singletons" "tls"
];
ormoluOld = import old;
ormoluNew = import new;
in
pkgs.runCommand "ormolu-batch" {} ''
printf "%20s %5s %5s %8s\n" name old new result >> $out
${pkgs.lib.concatMapStringsSep
"\n"
(n: ''
name=${n}
old=$(wc -l "${ormoluOld.hackage.${n}}/log.txt" | cut -f 1 -d ' ')
new=$(wc -l "${ormoluNew.hackage.${n}}/log.txt" | cut -f 1 -d ' ')
if [ "$new" -eq 0 ] && [ "$old" -gt 0 ]; then
res="perfect"
elif [ "$new" -lt "$old" ]; then
res="better"
elif [ "$new" -gt "$old" ]; then
res="worse"
else
res="same"
fi
printf "%20s %5s %5s %8s\n" $name $old $new $res >> $out
'')
packages
}
''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment