Compare commits

..

No commits in common. "master" and "0.11.0.0.x1" have entirely different histories.

632 changed files with 12877 additions and 12873 deletions

View File

@ -1,30 +0,0 @@
ARG UBUNTU_TAG=20.04
FROM ubuntu:"$UBUNTU_TAG"
ENV LANG=C.UTF-8
RUN \
apt-get update && \
apt-get install --assume-yes curl gcc git libgmp-dev libtinfo-dev make sudo
ARG GHCUP_VERSION=0.1.17.4
RUN \
curl --output /usr/local/bin/ghcup "https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/x86_64-linux-ghcup-$GHCUP_VERSION" && \
chmod +x /usr/local/bin/ghcup && \
ghcup --version
ARG USER_NAME=haskell
RUN \
useradd --create-home --shell "$( which bash )" "$USER_NAME" && \
echo "$USER_NAME ALL=(ALL) NOPASSWD: ALL" | tee "/etc/sudoers.d/$USER_NAME"
USER "$USER_NAME"
ENV PATH="/home/$USER_NAME/.cabal/bin:/home/$USER_NAME/.ghcup/bin:$PATH"
ARG GHC_VERSION=9.0.1
RUN \
ghcup install ghc "$GHC_VERSION" --set && \
ghc --version
ARG CABAL_VERSION=3.6.2.0
RUN \
ghcup install cabal "$CABAL_VERSION" --set && \
cabal --version

View File

@ -1,6 +0,0 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"postCreateCommand": "cabal update"
}

View File

@ -1,105 +0,0 @@
name: CI
on:
pull_request:
branches:
- main
- master
push:
branches:
- main
- master
release:
types:
- created
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { os: macos-11, ghc: 9.0.1, cabal: 3.6.2.0 }
- { os: ubuntu-20.04, ghc: 9.0.1, cabal: 3.6.2.0 }
- { os: windows-2019, ghc: 9.0.1, cabal: 3.6.2.0, ext: .exe }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: mkdir artifact
- run: mkdir artifact/${{ matrix.os }}
- id: setup-haskell
uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- run: cabal configure --enable-tests --flags pedantic --jobs
- run: cabal freeze
- run: cat cabal.project.freeze
- uses: actions/cache@v2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-
${{ matrix.os }}-${{ matrix.ghc }}-
- run: cabal build
- run: cabal install --installdir artifact/${{ matrix.os }} --install-method copy
- run: cabal test --test-show-details direct
- run: cabal check
- run: cabal sdist --output-dir artifact/${{ matrix.os }}
- uses: svenstaro/upx-action@v2
with:
file: artifact/${{ matrix.os }}/brittany${{ matrix.ext }}
- uses: actions/upload-artifact@v2
with:
path: artifact
name: brittany-${{ github.sha }}
release:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: brittany-${{ github.sha }}
path: artifact
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/octet-stream
asset_name: brittany-${{ github.event.release.tag_name }}-ubuntu
asset_path: artifact/ubuntu-20.04/brittany
upload_url: ${{ github.event.release.upload_url }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/octet-stream
asset_name: brittany-${{ github.event.release.tag_name }}-macos
asset_path: artifact/macos-11/brittany
upload_url: ${{ github.event.release.upload_url }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/octet-stream
asset_name: brittany-${{ github.event.release.tag_name }}-windows.exe
asset_path: artifact/windows-2019/brittany.exe
upload_url: ${{ github.event.release.upload_url }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_content_type: application/gzip
asset_name: brittany-${{ github.event.release.tag_name }}.tar.gz
asset_path: artifact/ubuntu-20.04/brittany-${{ github.event.release.tag_name }}.tar.gz
upload_url: ${{ github.event.release.upload_url }}
- run: cabal upload --publish --username '${{ secrets.HACKAGE_USERNAME }}' --password '${{ secrets.HACKAGE_PASSWORD }}' artifact/ubuntu-20.04/brittany-${{ github.event.release.tag_name }}.tar.gz

5
.gitignore vendored
View File

@ -8,8 +8,7 @@ dist/
dist-newstyle/ dist-newstyle/
local/ local/
.cabal-sandbox/ .cabal-sandbox/
.stack-work/
cabal.sandbox.config cabal.sandbox.config
cabal.project.local* cabal.project.local
cabal.project.freeze
.ghc.environment.* .ghc.environment.*
result

View File

@ -5,12 +5,20 @@
# This file contains a template configuration file, which is typically # This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project # placed as .hlint.yaml in the root of your project
- ignore: { name: 'Use :' } # Specify additional command line arguments
- ignore: { name: Eta reduce }
- ignore: { name: Move brackets to avoid $ } - arguments:
- ignore: { name: Redundant $ } [ "--cpp-include=srcinc"
- ignore: { name: Redundant bracket } , "--language=GADTs"
- ignore: { name: Use newtype instead of data } , "--language=LambdaCase"
, "--language=MultiWayIf"
, "--language=KindSignatures"
, "--cross"
, "--threads=0"
]
- ignore: {name: "Use camelCase"}
- ignore: {name: "Redundant as"}
- ignore: {name: "Redundant do"} - ignore: {name: "Redundant do"}
- ignore: {name: "Redundant return"} - ignore: {name: "Redundant return"}
- ignore: {name: "Use camelCase"} - ignore: {name: "Redundant guard", whithin: "lrdrNameToTextAnn"}

298
.travis.yml Normal file
View File

@ -0,0 +1,298 @@
# Use new container infrastructure to enable caching
sudo: false
# Do not choose a language; we provide our own build tools.
language: generic
# Caching so the next build will be fast too.
cache:
directories:
- $HOME/.cabsnap
- $HOME/.cabal/packages
- $HOME/.stack
- $HOME/.cabal/store
# alternatively:
#- $HOME/.stack/bin
#- $HOME/.stack/precompiled
#- $HOME/.stack/programs
#- $HOME/.stack/setup-exe-cache
#- $HOME/.stack/snapshots
before_cache:
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
# remove files that are regenerated by 'cabal update'
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
# The different configurations we want to test. We have
# - BUILD=cabal which uses cabal-install(<2.0)
# - BUILD=canew which uses cabal-install 2.0 "new-build"
# - BUILD=stack which uses Stack.
#
# We set the compiler values here to tell Travis to use a different
# cache file per set of arguments.
#
# If you need to have different apt packages for each combination in the
# matrix, you can use a line such as:
# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
matrix:
include:
# We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
# https://github.com/hvr/multi-ghc-travis
#- env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.0.4"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.2.2"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.4.2"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.6.3"
# addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.8.4"
# addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
#- env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC 7.10.3"
# addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
##### OSX test via stack #####
# Build on macOS in addition to Linux
- env: BUILD=stack ARGS="--stack-yaml stack-8.2.2.yaml"
compiler: ": #stack 8.2.2 osx"
os: osx
##### CABAL #####
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #cabal 8.0.2"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #cabal 8.2.2"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
- env: BUILD=cabal GHCVER=8.4.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #cabal 8.4.1"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.4.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
# Build with the newest GHC and cabal-install. This is an accepted failure,
# see below.
#- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
# compiler: ": #GHC HEAD"
# addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
##### CABAL DIST CHECK
- env: BUILD=cabaldist GHCVER=8.2.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #cabal 8.2.2 dist"
addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
##### CANEW #####
- env: BUILD=canew GHCVER=8.2.2 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7
compiler: ": #cabal new 8.2.2"
addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
##### STACK #####
# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
# variable, such as using --stack-yaml to point to a different file.
- env: BUILD=stack ARGS=""
compiler: ": #stack default"
addons: {apt: {packages: [libgmp-dev]}}
#- env: BUILD=stack ARGS="--resolver lts-2"
# compiler: ": #stack 7.8.4"
# addons: {apt: {packages: [libgmp-dev]}}
#- env: BUILD=stack ARGS="--resolver lts-3"
# compiler: ": #stack 7.10.2"
# addons: {apt: {packages: [libgmp-dev]}}
#- env: BUILD=stack ARGS="--resolver lts-6"
# compiler: ": #stack 7.10.3"
# addons: {apt: {packages: [libgmp-dev]}}
#- env: BUILD=stack ARGS="--resolver lts-7"
# compiler: ": #stack 8.0.1"
# addons: {apt: {packages: [libgmp-dev]}}
- env: BUILD=stack ARGS="--stack-yaml stack-8.0.2.yaml"
compiler: ": #stack 8.0.2"
addons: {apt: {packages: [libgmp-dev]}}
- env: BUILD=stack ARGS="--stack-yaml stack-8.2.2.yaml"
compiler: ": #stack 8.2.2"
addons: {apt: {packages: [libgmp-dev]}}
# Nightly builds are allowed to fail
- env: BUILD=stack ARGS="--resolver nightly"
compiler: ": #stack nightly"
addons: {apt: {packages: [libgmp-dev]}}
# Travis includes an macOS which is incompatible with GHC 7.8.4
#- env: BUILD=stack ARGS="--resolver lts-2"
# compiler: ": #stack 7.8.4 osx"
# os: osx
#- env: BUILD=stack ARGS="--resolver lts-3"
# compiler: ": #stack 7.10.2 osx"
# os: osx
#- env: BUILD=stack ARGS="--resolver lts-6"
# compiler: ": #stack 7.10.3 osx"
# os: osx
#- env: BUILD=stack ARGS="--resolver lts-7"
# compiler: ": #stack 8.0.1 osx"
# os: osx
#- env: BUILD=stack ARGS="--resolver lts-8"
# compiler: ": #stack 8.0.2 osx"
# os: osx
#- env: BUILD=stack ARGS="--resolver nightly"
# compiler: ": #stack nightly osx"
# os: osx
allow_failures:
#- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
- env: BUILD=stack ARGS="--resolver nightly"
- env: BUILD=stack ARGS=""
before_install:
# Using compiler above sets CC to an invalid value, so unset it
- unset CC
# We want to always allow newer versions of packages when building on GHC HEAD
- CABALARGS=""
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
# Download and unpack the stack executable
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH
- mkdir -p ~/.local/bin
- |
if [ `uname` = "Darwin" ]
then
travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
else
travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
fi
# Use the more reliable S3 mirror of Hackage
#mkdir -p $HOME/.cabal
#echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
#echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
#if [ "$CABALVER" != "1.16" ]
#then
# echo 'jobs: $ncpus' >> $HOME/.cabal/config
#fi
- PKGNAME='brittany'
- JOBS='1'
- |
function better_wait() {
date
time "$@" & # send the long living command to background!
set +x
MINUTES=0
LIMIT=30
while kill -0 $! >/dev/null 2>&1; do
echo -n -e " \b" # never leave evidences!
if [ $MINUTES == $LIMIT ]; then
break;
fi
MINUTES=$((MINUTES+1))
sleep 60
done
wait $!
set -x
}
install:
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
- if [ -f configure.ac ]; then autoreconf -i; fi
- |
set -ex
case "$BUILD" in
stack)
stack -j$JOBS --no-terminal --install-ghc $ARGS test --bench --only-dependencies
;;
cabal*)
cabal --version
echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
then
zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >$HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
fi
travis_retry cabal update -v
sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
# check whether current requested install-plan matches cached package-db snapshot
if diff -u $HOME/.cabsnap/installplan.txt installplan.txt;
then
echo "cabal build-cache HIT";
rm -rfv .ghc;
cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
else
echo "cabal build-cache MISS";
rm -rf $HOME/.cabsnap;
mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
cabal install -j$JOBS --only-dependencies --enable-tests --enable-benchmarks --ghc-options="-j1 +RTS -M500M -RTS";
fi
# snapshot package-db on cache miss
if [ ! -d $HOME/.cabsnap ];
then
echo "snapshotting package-db to build-cache";
mkdir $HOME/.cabsnap;
cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
fi
;;
canew)
cabal --version
travis_retry cabal update -v
echo 'packages: .' > cabal.project
echo 'package brittany' > cabal.project.local
echo ' ghc-options: -Werror' >> cabal.project.local
rm -f cabal.project.freeze
cabal new-build -j$JOBS --enable-test --enable-benchmarks --dep
cabal new-build -j$JOBS --disable-tests --disable-benchmarks --dep
;;
esac
set +ex
script:
- |
set -ex
case "$BUILD" in
stack)
better_wait stack -j$JOBS --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps --ghc-options="-j1 +RTS -M500M -RTS -Werror"
;;
cabal)
if [ -f configure.ac ]; then autoreconf -i; fi
cabal configure --enable-tests --enable-benchmarks -v # -v2 provides useful information for debugging
better_wait cabal build -j$JOBS --ghc-options="-j1 +RTS -M500M -RTS -Werror" # this builds all libraries and executables (including tests/benchmarks)
cabal test
;;
cabaldist)
# cabal check
cabal sdist # tests that a source-distribution can be generated
# Check that the resulting source distribution can be built & installed.
# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
# `cabal install --force-reinstalls dist/*-*.tar.gz`
SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
(cd dist && better_wait cabal install -j$JOBS --force-reinstalls "$SRC_TGZ" --ghc-options="-j1 +RTS -M500M -RTS")
;;
canew)
better_wait cabal new-build -j$JOBS --disable-tests --disable-benchmarks
better_wait cabal new-build -j$JOBS --enable-tests --enable-benchmarks
cabal new-test --ghc-options="-j1 +RTS -M500M -RTS"
;;
esac
set +ex

View File

@ -1,5 +0,0 @@
{
"recommendations": [
"taylorfausak.purple-yolk"
]
}

View File

@ -1,6 +0,0 @@
{
"purple-yolk.brittany.command": "cabal exec -- brittany --write-mode inplace",
"purple-yolk.ghci.command": "cabal repl --repl-options -ddump-json",
"purple-yolk.hlint.command": "false",
"purple-yolk.hlint.onSave": false
}

View File

@ -1,118 +1,5 @@
# Revision history for brittany # Revision history for brittany
## 0.14.0.0 -- November 2021
* #357: Added support for GHC 9.0. Dropped support for all other versions of GHC.
* ab59e9acc3069551ac4132321b285d000f5f5691: Removed runtime dependency on `ghc-paths`.
* fa8365a7fa9372043d5a1018f2f7669ce3853edd: Started providing pre-built binaries for Linux, MacOS, and Windows.
* Many other changes to Brittany's internals and exposed Haskell interface, but (hopefully) no changes to its command-line interface.
## 0.13.1.2 -- May 2021
* #347: Allowed hspec 2.8. Thanks @felixonmars!
## 0.13.1.1 -- February 2021
* #333: Allowed random 1.2. Thanks @felixonmars!
* #334: Updated Arch install instructions. Thanks @ahstro!
* #343: Allowed ghc-exactprint 0.6.4. Thanks @maralorn!
## 0.13.1.0 -- December 2020
* #330: Started sorting imports. Thanks @expipiplus1!
## 0.13.0.0 -- December 2020
* #324: Added support for GHC 8.10.
* Dropped support for GHC 8.4, 8.2, and 8.0.
* Thanks @jneira, @bubba, @infinity0, and @expipiplus1!
## 0.12.2.0 -- November 2020
* #207: Fix newtype indent in associated type family.
* #231: Improve comments-affecting-layout behaviour for tuples.
* #259: Data declaration for newtype and records. Thanks @eborden!
* #263: Fix non-idempotent newlines with comment + where.
* #273: Error handling.
* #281: Fix moving comment in export list (haddock header).
* #286: Fix comments in instance/type instances.
* #287: Add support for pattern synonyms. Thanks @RaoulHC!
* #293: Expose main function as a module. Thanks @soareschen!
* #303: Readme: Supports 8.8. Thanks @andys8!
* #311: Allows aeson-1.5.*. Thanks @jkachmar!
* #313: Nondecreasing export list formatting. Thanks @expipiplus1!
## 0.12.1.1 -- December 2019
* Bugfixes:
- Fix layouting regression of record update for many/large fields
- Fix whitespace regression on ExplicitForall notation
(`foo :: forall a . Show a => a -> a`, note the double space)
introduced in 0.12. (#264)
- Fix roundtripping of type equality constraint
`f :: ((~) a b) => a -> b` (#267)
* One experimental feature addition: Turning brace notation semicolons into
newlines when formatting (see #270)
## 0.12.1.0 -- September 2019
* Support ghc-8.8
* Support for OverloadedLabels extension
(thanks to Evan Rutledge Borden @eborden)
* Support for Implicit Params extension (thanks to pepe iborra @pepeiborra)
* Add flag `--no-user-config` to enable only using manually passed config
* Disable the performance test suite by default to prevent spurious failures
on certain CI setups. The github/travis brittany CI still has all tests
enabled. See the `brittany-test-perf` flag in the cabal file.
* Bugfixes:
- Fix one wandering-comment bug for let-in expressions
- Fix invalid result for prefix operator pattern matches
- Fix lambda expression with laziness/strictness annotation
- Fix parenthesis handling for infix pattern matches with 3+ arguments
* Changes to layouting behaviour:
- For pattern matching and data/instance definitions, the usage of
parenthesis is now "normalized", i.e. superfluous parens are removed by
brittany.
## 0.12.0.0 -- June 2019
* Support for ghc-8.6 (basic support, not necessarily all new syntactic
extensions)
* Support -XExplicitNamespaces and -XPatternSynonyms
* Allow a --dry-run sort of operation via flag "-c/--check-mode"
(thanks to Doug Beardsley @mightybyte)
* Include file name in errors about unsupported syntax nodes (thanks to @5outh)
* Partially implement layouting class instances: Layouts children, but
falls back on ghc-exactprint for the instance head
(thanks to Rupert Horlick @ruhatch)
* Implement layouting for type synonyms (thanks to Rupert Horlick @ruhatch)
* Support -XMagicHash, -XUnboxedTuples (thanks to Sergey Vinokurov @sergv)
* Support -XQuasiQuotes (no formatting applied to the splices; they are simply
retained without causing the dreaded "Unknown construct: HsSpliceE{}")
- `lconfig_allowHangingQuasiQuotes` controls whether multi-line
QuasiQuotes are allowed to start at the end of the current line, or
whether they are always placed in new lines.
* Bugfixes:
- Fix rare-case alignment bug with IndentPolicyMultiple (#144)
- Make inline layout config apply to module header (#151)
- Fix unaligned import-hiding layout (#150)
- Fix idempotence violation for comments around if-then-else (#167)
- Fix comments having an effect on far-away parent node's layout (#159)
- Fix imports of type operators ("symbolic data types")
(thanks to Phil Hazelden @ChickenProp)
- Work around GHC and cabal-install misfeature ".ghc.environment files"
that could break brittany in unexpected and hard-to-understand ways
- Stop removing empty lines before `where` keyword in a couple of cases
- Fix functions with mixing prefix/infix style causing error (#234)
* Changes to layout:
- Align usage of spaces for record update vs record construction (#126)
- More indentation to import-hiding-paragraph (follow-up to #150 fix)
- Record construction and update now are layouted in the same way
(thanks to Evan Rutledge Borden @eborden)
- Stop allowing single-line layout when there are comments between
arguments (#214) (thanks to @matt-noonan)
* Various build-instructions and editor integrations
## 0.11.0.0 -- May 2018 ## 0.11.0.0 -- May 2018
* Support for ghc-8.4 * Support for ghc-8.4
@ -132,13 +19,13 @@
multiline-comments are supported too, although multiline-comments are supported too, although
the specification must still be a single line. E.g. the specification must still be a single line. E.g.
> "{- brittany --columns 50 -}" > "{- brittany --columns 50 -}"
CONFIG is either: CONFIG is either:
1) one or more flags in the form of what brittany accepts 1) one or more flags in the form of what brittany accepts
on the commandline, e.g. "--columns 50", or on the commandline, e.g. "-- columns 50", or
2) one or more specifications in the form of what brittany 2) one or more specifications in the form of what brittany
accepts in its config files for the layouting config accepts in its config files for the layouting config
(a one-line yaml document), e.g. "{ lconfig_cols: 50 }" (a one-line yaml document), e.g. "{ lconfig_cols: 50 }"

106
README.md
View File

@ -1,11 +1,4 @@
# brittany [![Hackage version](https://img.shields.io/hackage/v/brittany.svg?label=Hackage)](https://hackage.haskell.org/package/brittany) [![Stackage version](https://www.stackage.org/package/brittany/badge/lts?label=Stackage)](https://www.stackage.org/package/brittany) [![Build Status](https://secure.travis-ci.org/lspitzner/brittany.svg?branch=master)](http://travis-ci.org/lspitzner/brittany) # brittany [![Hackage version](https://img.shields.io/hackage/v/brittany.svg?label=Hackage)](https://hackage.haskell.org/package/brittany) [![Stackage version](https://www.stackage.org/package/brittany/badge/lts?label=Stackage)](https://www.stackage.org/package/brittany) [![Build Status](https://secure.travis-ci.org/lspitzner/brittany.svg?branch=master)](http://travis-ci.org/lspitzner/brittany)
:warning:
This project is effectively unmaintained!
I ([@tfausak](https://github.com/tfausak)) would recommend switching to another formatter.
At time of writing (2022-11-11), I would suggest [Ormolu](https://github.com/tweag/ormolu).
Or if you prefer some configuration, I would suggest [Fourmolu](https://github.com/fourmolu/fourmolu).
haskell source code formatter haskell source code formatter
![Output sample](https://github.com/lspitzner/brittany/raw/master/brittany-sample.gif) ![Output sample](https://github.com/lspitzner/brittany/raw/master/brittany-sample.gif)
@ -20,7 +13,7 @@ This project's goals roughly are to:
(but excluding `-XCPP` which is too hard); (but excluding `-XCPP` which is too hard);
- Retain newlines and comments unmodified; - Retain newlines and comments unmodified;
- Be clever about using the available horizontal space while not overflowing - Be clever about using the available horizontal space while not overflowing
the column maximum unless it cannot be avoided; the column maximum if it cannot be avoided;
- Be clever about aligning things horizontally (this can be turned off - Be clever about aligning things horizontally (this can be turned off
completely however); completely however);
- Have linear complexity in the size of the input. - Have linear complexity in the size of the input.
@ -38,7 +31,7 @@ require fixing:
other module elements (data-decls, classes, instances, etc.) other module elements (data-decls, classes, instances, etc.)
are not transformed in any way; this extends to e.g. **bindings inside class are not transformed in any way; this extends to e.g. **bindings inside class
instance definitions** - they **won't be touched** (yet). instance definitions** - they **won't be touched** (yet).
- By using `ghc-exactprint` as the parser, brittany supports full GHC - By using `ghc-exactprint` as the parser, brittany supports full GHC
including extensions, but **some of the less common syntactic elements including extensions, but **some of the less common syntactic elements
(even of 2010 haskell) are not handled**. (even of 2010 haskell) are not handled**.
- **There are some known issues regarding handling of in-source comments.** - **There are some known issues regarding handling of in-source comments.**
@ -55,7 +48,7 @@ log the size of the input, but _not_ the full input/output of requests.)
# Other usage notes # Other usage notes
- Supports GHC version `9.0.x`. - Supports GHC versions `8.0`, `8.2` and `8.4`.
- included in stackage with lts>=10.0 (or nightlies dating to >=2017-11-15) - included in stackage with lts>=10.0 (or nightlies dating to >=2017-11-15)
- config (file) documentation is lacking. - config (file) documentation is lacking.
- some config values can not be configured via commandline yet. - some config values can not be configured via commandline yet.
@ -65,43 +58,41 @@ log the size of the input, but _not_ the full input/output of requests.)
# Installation # Installation
- via `stack` - via `cabal` "old-build"
~~~~.sh ~~~~.sh
stack install brittany # --resolver lts-16.31 # optionally:
# mkdir brittany
# cd brittany
# cabal sandbox init
cabal install brittany --bindir=$HOME/.cabal/bin # -w $PATH_TO_GHC_8_0
~~~~ ~~~~
If you use an lts that includes brittany this should just work; otherwise - via `cabal new-build`
you may want to clone the repo and try again.
- via `cabal`
Due to constant changes to the cabal UI, I have given up on making sure
these instructions work before releases. Please do not expect these
instructions to be up-to-date; they may produce incomprehensible error
messages, they may be broken otherwise, they may work now but break with
the next cabal release. Thanks for your understanding, and feel free to
open issues for any problems you encounter. -- lennart
If you are using cabal-3.0, using
`cabal install brittany --installdir=$HOME/.cabal/bin`
might work. Keep in mind that cabal merely puts a symlink to the "store"
into the installdir, so you have to re-install if you ever clean your
store. On cabal-2.4, try `cabal v2-install brittany`. On cabal-2.2 or
earlier you might be succesful using
```cabal new-build exe:brittany; cp `find dist-newstyle/ -name brittany -type f | xargs -x ls -t | head -n1` $HOME/.cabal/bin/```.
Alternatively, you can also use the v1-approach with sandboxes as
`cabal v1-sandbox init; cabal v1-install brittany --bindir=$HOME/.cabal/bin`.
(TODO: These instructions are more confusing than helpful. I am inclined
to just remove them.)
- on ArchLinux:
~~~~.sh ~~~~.sh
pacman -S haskell-brittany cabal unpack brittany
cd brittany-0.11.0.0
# cabal new-configure -w $PATH_TO_GHC_8_0
cabal new-build exe:brittany
# and it should be safe to just copy the executable, e.g.
cp `./find dist-newstyle/build/ -type f -name brittany` $HOME/.cabal/bin/
~~~~ ~~~~
# Development tips - via `stack` using a sufficiently recent stackage snapshot (dated to >= 2017-11-15)
~~~~.sh
stack install brittany # --resolver lts-10.0
~~~~
(earlier ltss did not include `brittany` yet, but the repo should contain a
`stack.yaml` that works with ghc-8.0.)
- on ArchLinux via [the britanny AUR package](https://aur.archlinux.org/packages/brittany/)
using `aura`:
~~~~.sh
aura -A brittany
~~~~
# Editor Integration # Editor Integration
@ -111,30 +102,26 @@ log the size of the input, but _not_ the full input/output of requests.)
#### VSCode #### VSCode
[This extension](https://marketplace.visualstudio.com/items?itemName=MaxGabriel.brittany) [This extension](https://marketplace.visualstudio.com/items?itemName=MaxGabriel.brittany)
connects commandline `brittany` to VSCode formatting API. Thanks to @MaxGabriel. connects commandline `brittany` to VSCode formatting API. Thanks to @MaxGabriel.
#### Via HLS #### Via HIE
[haskell-language-server](https://github.com/haskell/haskell-language-server) [haskell-ide-engine](https://github.com/haskell/haskell-ide-engine)
includes a `brittany` plugin that directly uses the brittany library. includes a `brittany` plugin that directly uses the brittany library.
Relevant for any editors that properly support the language-server-protocol. Relevant for any editors that properly support the language-server-protocol.
#### Neovim / Vim 8 #### Neovim / Vim 8
The [Neoformat](https://github.com/sbdchd/neoformat) plugin comes with support for The [Neoformat](https://github.com/sbdchd/neoformat) plugin comes with support for
brittany built in. brittany built in.
#### Atom
[Atom Beautify](https://atom.io/packages/atom-beautify) supports brittany as a formatter for Haskell. Since the default formatter is set to hindent, you will need to change this setting to brittany, after installing the extension.
#### Emacs
[format-all](https://github.com/lassik/emacs-format-all-the-code) support brittany as the default formatter for Haskell.
# Usage # Usage
- Default mode of operation: Transform a single module, from `stdin` to `stdout`. - Default mode of operation: Transform a single module, from `stdin` to `stdout`.
Can pass one or multiple files as input, and there is a flag to override them Can pass one or multiple files as input, and there is a flag to override them
in place instead of using `stdout` (since 0.9.0.0). So: in place instead of using `stdout` (since 0.9.0.0). So:
~~~~ .sh ~~~~ .sh
brittany # stdin -> stdout brittany # stdin -> stdout
brittany mysource.hs # ./mysource.hs -> stdout brittany mysource.hs # ./mysource.hs -> stdout
brittany --write-mode=inplace *.hs # apply formatting to all ./*.hs inplace brittany --write-mode=inplace *.hs # apply formatting to all ./*.hs inplace
~~~~ ~~~~
- For stdin/stdout usage it makes sense to enable certain syntactic extensions - For stdin/stdout usage it makes sense to enable certain syntactic extensions
by default, i.e. to add something like this to your by default, i.e. to add something like this to your
`~/.config/brittany/config.yaml` (execute `brittany` once to create default): `~/.config/brittany/config.yaml` (execute `brittany` once to create default):
@ -158,30 +145,21 @@ log the size of the input, but _not_ the full input/output of requests.)
# Feature Requests, Contribution, Documentation # Feature Requests, Contribution, Documentation
For a long time this project has had a single maintainer, and as a consequence This currently is a one-person project in the sense that 90% of the code is
there have been some mildly large delays for reacting to feature requests written by one person. And (unfortunately) it is not my job to keep improving
and even PRs. this project. Please forgive that as a consequence my time to invest on new
features is rather limited.
Sorry about that. Nonetheless I consider it "in active development" :)
The good news is that this project is getting sponsored by PRODA LTD, and two One way of speeding things up is to make your own contributions. There is
previous contributors, Evan Borden and Taylor Fausak, have agreed on helping
with organisational aspects. Thanks!
Still, this project has a long queue of very sensible feature requests, so it
may take some time until new ones get our attention. But with the help of
the co-maintainers, at least the reaction-times on PRs and the frequency
of releases should improve significantly.
If you are interested in making your own contributions, there is
a good amount of high-level documentation at a good amount of high-level documentation at
[the documentation index](doc/implementation/index.md) [the documentation index](doc/implementation/index.md)
# License # License
Copyright (C) 2016-2019 Lennart Spitzner\ Copyright (C) 2016-2018 Lennart Spitzner
Copyright (C) 2019 PRODA LTD
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the it under the terms of the

2
Setup.hs Normal file
View File

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

View File

@ -1,149 +1,374 @@
cabal-version: 2.2
name: brittany name: brittany
version: 0.14.0.2 version: 0.11.0.0
synopsis: Haskell source code formatter synopsis: Haskell source code formatter
description: description: {
See <https://github.com/lspitzner/brittany/blob/master/README.md the README>. See <https://github.com/lspitzner/brittany/blob/master/README.md the README>.
. .
If you are interested in the implementation, have a look at <https://github.com/lspitzner/brittany/blob/master/doc/implementation/theory.md this document>; If you are interested in the implementation, have a look at <https://github.com/lspitzner/brittany/blob/master/doc/implementation/theory.md this document>;
. .
The implementation is documented in more detail <https://github.com/lspitzner/brittany/blob/master/doc/implementation/index.md here>. The implementation is documented in more detail <https://github.com/lspitzner/brittany/blob/master/doc/implementation/index.md here>.
license: AGPL-3.0-only }
license: AGPL-3
license-file: LICENSE license-file: LICENSE
author: Lennart Spitzner author: Lennart Spitzner
maintainer: Lennart Spitzner <hexagoxel@hexagoxel.de> maintainer: Lennart Spitzner <hexagoxel@hexagoxel.de>
copyright: Copyright (C) 2016-2019 Lennart Spitzner copyright: Copyright (C) 2016-2018 Lennart Spitzner
Copyright (C) 2019 PRODA LTD
category: Language category: Language
build-type: Simple build-type: Simple
cabal-version: 1.18
homepage: https://github.com/lspitzner/brittany/ homepage: https://github.com/lspitzner/brittany/
bug-reports: https://github.com/lspitzner/brittany/issues bug-reports: https://github.com/lspitzner/brittany/issues
extra-doc-files: extra-doc-files: {
ChangeLog.md ChangeLog.md
README.md README.md
doc/implementation/*.md doc/implementation/*.md
extra-source-files: }
data/brittany.yaml extra-source-files: {
data/*.hs src-literatetests/*.blt
}
source-repository head source-repository head {
type: git type: git
location: https://github.com/lspitzner/brittany.git location: https://github.com/lspitzner/brittany.git
}
flag pedantic flag brittany-dev-lib
description: set buildable false for anything but lib
default: False default: False
description: Enables @-Werror@, which turns warnings into errors.
manual: True manual: True
common library library {
build-depends: default-language:
, aeson ^>= 2.0.1 Haskell2010
, base ^>= 4.15.0 hs-source-dirs:
, butcher ^>= 1.3.3 src
, bytestring ^>= 0.10.12 install-includes: {
, cmdargs ^>= 0.10.21 srcinc/prelude.inc
, containers ^>= 0.6.4 }
, czipwith ^>= 1.0.1 exposed-modules: {
, data-tree-print ^>= 0.1.0
, deepseq ^>= 1.4.5
, directory ^>= 1.3.6
, extra ^>= 1.7.10
, filepath ^>= 1.4.2
, ghc ^>= 9.0.1
, ghc-boot ^>= 9.0.1
, ghc-boot-th ^>= 9.0.1
, ghc-exactprint ^>= 0.6.4
, monad-memo ^>= 0.5.3
, mtl ^>= 2.2.2
, multistate ^>= 0.8.0
, pretty ^>= 1.1.3
, random ^>= 1.2.1
, safe ^>= 0.3.19
, semigroups ^>= 0.19.2
, strict ^>= 0.4.0
, syb ^>= 0.7.2
, text ^>= 1.2.5
, transformers ^>= 0.5.6
, uniplate ^>= 1.6.13
, yaml ^>= 0.11.7
default-language: Haskell2010
ghc-options:
-Weverything
-Wno-all-missed-specialisations
-Wno-incomplete-uni-patterns
-Wno-missing-deriving-strategies
-Wno-missing-export-lists
-Wno-missing-import-lists
-Wno-missing-local-signatures
-Wno-missing-safe-haskell-mode
-Wno-monomorphism-restriction
-Wno-prepositive-qualified-module
-Wno-safe
-Wno-unsafe
if flag(pedantic)
ghc-options: -Werror
common executable
import: library
build-depends: brittany
ghc-options:
-rtsopts
-threaded
-Wno-implicit-prelude
-Wno-unused-packages
library
import: library
autogen-modules: Paths_brittany
hs-source-dirs: source/library
exposed-modules:
Language.Haskell.Brittany Language.Haskell.Brittany
Language.Haskell.Brittany.Internal Language.Haskell.Brittany.Internal
Language.Haskell.Brittany.Internal.Backend Language.Haskell.Brittany.Internal.Prelude
Language.Haskell.Brittany.Internal.BackendUtils Language.Haskell.Brittany.Internal.PreludeUtils
Language.Haskell.Brittany.Internal.Types
Language.Haskell.Brittany.Internal.Utils
Language.Haskell.Brittany.Internal.Config Language.Haskell.Brittany.Internal.Config
Language.Haskell.Brittany.Internal.Config.Types Language.Haskell.Brittany.Internal.Config.Types
Language.Haskell.Brittany.Internal.Config.Types.Instances Language.Haskell.Brittany.Internal.Config.Types.Instances
Language.Haskell.Brittany.Internal.ExactPrintUtils Language.Haskell.Brittany.Internal.Obfuscation
Paths_brittany
}
other-modules: {
Language.Haskell.Brittany.Internal.LayouterBasics Language.Haskell.Brittany.Internal.LayouterBasics
Language.Haskell.Brittany.Internal.Layouters.DataDecl Language.Haskell.Brittany.Internal.Backend
Language.Haskell.Brittany.Internal.BackendUtils
Language.Haskell.Brittany.Internal.ExactPrintUtils
Language.Haskell.Brittany.Internal.Layouters.Type
Language.Haskell.Brittany.Internal.Layouters.Decl Language.Haskell.Brittany.Internal.Layouters.Decl
Language.Haskell.Brittany.Internal.Layouters.Expr Language.Haskell.Brittany.Internal.Layouters.Expr
Language.Haskell.Brittany.Internal.Layouters.Stmt
Language.Haskell.Brittany.Internal.Layouters.Pattern
Language.Haskell.Brittany.Internal.Layouters.IE Language.Haskell.Brittany.Internal.Layouters.IE
Language.Haskell.Brittany.Internal.Layouters.Import Language.Haskell.Brittany.Internal.Layouters.Import
Language.Haskell.Brittany.Internal.Layouters.Module Language.Haskell.Brittany.Internal.Layouters.Module
Language.Haskell.Brittany.Internal.Layouters.Pattern
Language.Haskell.Brittany.Internal.Layouters.Stmt
Language.Haskell.Brittany.Internal.Layouters.Type
Language.Haskell.Brittany.Internal.Obfuscation
Language.Haskell.Brittany.Internal.ParseModule
Language.Haskell.Brittany.Internal.Prelude
Language.Haskell.Brittany.Internal.PreludeUtils
Language.Haskell.Brittany.Internal.Transformations.Alt Language.Haskell.Brittany.Internal.Transformations.Alt
Language.Haskell.Brittany.Internal.Transformations.Columns
Language.Haskell.Brittany.Internal.Transformations.Floating Language.Haskell.Brittany.Internal.Transformations.Floating
Language.Haskell.Brittany.Internal.Transformations.Indent
Language.Haskell.Brittany.Internal.Transformations.Par Language.Haskell.Brittany.Internal.Transformations.Par
Language.Haskell.Brittany.Internal.Types Language.Haskell.Brittany.Internal.Transformations.Columns
Language.Haskell.Brittany.Internal.Utils Language.Haskell.Brittany.Internal.Transformations.Indent
Language.Haskell.Brittany.Main }
Paths_brittany ghc-options: {
-Wall
-fno-warn-unused-imports
-fno-warn-redundant-constraints
}
build-depends:
{ base >=4.9 && <4.12
, ghc >=8.0.1 && <8.5
, ghc-paths >=0.1.0.9 && <0.2
, ghc-exactprint >=0.5.6.0 && <0.5.7
, transformers >=0.5.2.0 && <0.6
, containers >=0.5.7.1 && <0.6
, mtl >=2.2.1 && <2.3
, text >=1.2 && <1.3
, multistate >=0.7.1.1 && <0.9
, syb >=0.6 && <0.8
, neat-interpolation >=0.3.2 && <0.4
, data-tree-print
, pretty >=1.1.3.3 && <1.2
, bytestring >=0.10.8.1 && <0.11
, directory >=1.2.6.2 && <1.4
, butcher >=1.3.1 && <1.4
, yaml >=0.8.18 && <0.9
, aeson >=1.0.1.0 && <1.4
, extra >=1.4.10 && <1.7
, uniplate >=1.6.12 && <1.7
, strict >=0.3.2 && <0.4
, monad-memo >=0.4.1 && <0.5
, unsafe >=0.0 && <0.1
, safe >=0.3.9 && <0.4
, deepseq >=1.4.2.0 && <1.5
, semigroups >=0.18.2 && <0.19
, cmdargs >=0.10.14 && <0.11
, czipwith >=1.0.1.0 && <1.1
, ghc-boot-th >=8.0.1 && <8.5
, filepath >=1.4.1.0 && <1.5
, random >= 1.1 && <1.2
}
default-extensions: {
CPP
NoImplicitPrelude
GADTs
FlexibleContexts
FlexibleInstances
ScopedTypeVariables
MonadComprehensions
LambdaCase
MultiWayIf
KindSignatures
}
include-dirs:
srcinc
}
executable brittany executable brittany
import: executable if flag(brittany-dev-lib) {
buildable: False
hs-source-dirs: source/executable } else {
main-is: Main.hs buildable: True
}
test-suite brittany-test-suite main-is: Main.hs
import: executable other-modules: {
Paths_brittany
}
-- other-extensions:
build-depends: build-depends:
, hspec ^>= 2.8.3 { brittany
hs-source-dirs: source/test-suite , base
main-is: Main.hs , ghc
type: exitcode-stdio-1.0 , ghc-paths
, ghc-exactprint
, transformers
, containers
, mtl
, text
, multistate
, syb
, neat-interpolation
, data-tree-print
, pretty
, bytestring
, directory
, butcher
, yaml
, aeson
, extra
, uniplate
, strict
, monad-memo
, unsafe
, safe
, deepseq
, semigroups
, cmdargs
, czipwith
, ghc-boot-th
, filepath >=1.4.1.0 && <1.5
}
hs-source-dirs: src-brittany
default-language: Haskell2010
default-extensions: {
CPP
NoImplicitPrelude
GADTs
FlexibleContexts
FlexibleInstances
ScopedTypeVariables
MonadComprehensions
LambdaCase
MultiWayIf
KindSignatures
}
ghc-options: {
-Wall
-fno-spec-constr
-fno-warn-unused-imports
-fno-warn-redundant-constraints
-rtsopts
-with-rtsopts "-M2G"
}
test-suite unittests
if flag(brittany-dev-lib) {
buildable: False
} else {
buildable: True
}
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends:
{ brittany
, base
, ghc
, ghc-paths
, ghc-exactprint
, transformers
, containers
, mtl
, text
, multistate
, syb
, neat-interpolation
, data-tree-print
, pretty
, bytestring
, directory
, butcher
, yaml
, aeson
, extra
, uniplate
, strict
, monad-memo
, unsafe
, safe
, deepseq
, semigroups
, cmdargs
, czipwith
, ghc-boot-th
, hspec >=2.4.1 && <2.6
}
main-is: TestMain.hs
other-modules: TestUtils
AsymptoticPerfTests
hs-source-dirs: src-unittests
default-extensions: {
CPP
NoImplicitPrelude
GADTs
FlexibleContexts
FlexibleInstances
ScopedTypeVariables
MonadComprehensions
LambdaCase
MultiWayIf
KindSignatures
}
ghc-options: {
-Wall
-fno-warn-unused-imports
-rtsopts
-with-rtsopts "-M2G"
}
test-suite littests
if flag(brittany-dev-lib) {
buildable: False
} else {
buildable: True
}
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends:
{ brittany
, base
, ghc
, ghc-paths
, ghc-exactprint
, transformers
, containers
, mtl
, text
, multistate
, syb
, neat-interpolation
, data-tree-print
, pretty
, bytestring
, directory
, butcher
, yaml
, aeson
, extra
, uniplate
, strict
, monad-memo
, unsafe
, safe
, deepseq
, semigroups
, cmdargs
, czipwith
, ghc-boot-th
, hspec >=2.4.1 && <2.6
, filepath
, parsec >=3.1.11 && <3.2
}
main-is: Main.hs
other-modules:
hs-source-dirs: src-literatetests
default-extensions: {
CPP
NoImplicitPrelude
GADTs
FlexibleContexts
FlexibleInstances
ScopedTypeVariables
MonadComprehensions
LambdaCase
MultiWayIf
KindSignatures
}
ghc-options: {
-Wall
-fno-warn-unused-imports
-rtsopts
-with-rtsopts "-M2G"
}
test-suite libinterfacetests
if flag(brittany-dev-lib) {
buildable: False
} else {
buildable: True
}
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends:
{ brittany
, base
, text
, transformers
, hspec >=2.4.1 && <2.6
}
main-is: Main.hs
other-modules:
hs-source-dirs: src-libinterfacetests
default-extensions: {
FlexibleContexts
FlexibleInstances
ScopedTypeVariables
MonadComprehensions
LambdaCase
MultiWayIf
KindSignatures
}
ghc-options: {
-Wall
-fno-warn-unused-imports
-rtsopts
-with-rtsopts "-M2G"
}

View File

@ -1,4 +0,0 @@
conf_layout:
lconfig_columnAlignMode:
tag: ColumnAlignModeDisabled
lconfig_indentPolicy: IndentPolicyLeft

View File

@ -1,9 +0,0 @@
packages: .
allow-newer:
-- https://github.com/lspitzner/butcher/issues/7
, butcher:base
-- https://github.com/lspitzner/data-tree-print/pull/2
, data-tree-print:base
-- https://github.com/lspitzner/multistate/pull/8
, multistate:base

View File

@ -1 +0,0 @@
func :: a -> a

View File

@ -1,3 +0,0 @@
func
:: lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
-> (lakjsdlkjasldkj -> lakjsdlkjasldkj)

View File

@ -1 +0,0 @@
func = klajsdas klajsdas klajsdas

View File

@ -1,3 +0,0 @@
func = lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd

View File

@ -1,3 +0,0 @@
func = lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd lakjsdlajsdljas
lakjsdlajsdljas
lakjsdlajsdljas

View File

@ -1 +0,0 @@
func = (1 +)

View File

@ -1 +0,0 @@
func = (+ 1)

View File

@ -1 +0,0 @@
func = (1 `abc`)

View File

@ -1 +0,0 @@
func = (`abc` 1)

View File

@ -1 +0,0 @@
func = (abc, def)

View File

@ -1 +0,0 @@
func = (abc, )

View File

@ -1 +0,0 @@
func = (, abc)

View File

@ -1,3 +0,0 @@
func
:: (lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd -> lakjsdlkjasldkj)
-> lakjsdlkjasldkj

View File

@ -1,6 +0,0 @@
myTupleSection =
( verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargefirstelement
,
, verylaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargethirdelement
,
)

View File

@ -1,4 +0,0 @@
func =
( lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
, lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
)

View File

@ -1,6 +0,0 @@
foo = if True
then
-- iiiiii
"a "
else
"b "

View File

@ -1,5 +0,0 @@
func = if cond
then pure 42
else do
-- test
abc

View File

@ -1,3 +0,0 @@
func = case x of
False -> False
True -> True

View File

@ -1,7 +0,0 @@
func =
case
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
of
False -> False
True -> True

View File

@ -1,7 +0,0 @@
func = do
case
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
of
False -> False
True -> True

View File

@ -1 +0,0 @@
func = case x of {}

View File

@ -1,5 +0,0 @@
func =
case
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
of {}

View File

@ -1,5 +0,0 @@
func = do
case
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
lakjsdlajsdljasdlkjasldjasldjasldjalsdjlaskjd
of {}

View File

@ -1,5 +0,0 @@
func
:: ( lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
-> lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
)
-> lakjsdlkjasldkj

View File

@ -1,3 +0,0 @@
func = do
stmt
stmt

View File

@ -1,3 +0,0 @@
func = do
x <- stmt
stmt x

View File

@ -1,3 +0,0 @@
func = do
let x = 13
stmt x

View File

@ -1,7 +0,0 @@
func =
foooooo
$ [ case
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
of
_ -> True
]

View File

@ -1,4 +0,0 @@
testMethod foo bar baz qux =
let x = undefined foo bar baz qux qux baz bar :: String
-- some comment explaining the in expression
in undefined foo x :: String

View File

@ -1,4 +0,0 @@
testMethod foo bar baz qux =
let x = undefined :: String
-- some comment explaining the in expression
in undefined :: String

View File

@ -1,3 +0,0 @@
testMethod foo bar baz qux =
-- some comment explaining the in expression
let x = undefined :: String in undefined :: String

View File

@ -1,6 +0,0 @@
foo foo bar baz qux =
let a = 1
b = 2
c = 3
-- some comment explaining the in expression
in undefined :: String

View File

@ -1,6 +0,0 @@
func =
foo
$ [ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
]
++ [ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc]

View File

@ -1 +0,0 @@
module Main where

View File

@ -1,5 +0,0 @@
func
:: ( ( lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
-> lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
)
)

View File

@ -1 +0,0 @@
module Main () where

View File

@ -1 +0,0 @@
module Main (main) where

View File

@ -1 +0,0 @@
module Main (main, test1, test2) where

View File

@ -1,12 +0,0 @@
module Main
( main
, test1
, test2
, test3
, test4
, test5
, test6
, test7
, test8
, test9
) where

View File

@ -1,12 +0,0 @@
module Main
( main
-- main
, test1
, test2
-- Test 3
, test3
, test4
-- Test 5
, test5
-- Test 6
) where

View File

@ -1 +0,0 @@
module Main (Test(..)) where

View File

@ -1 +0,0 @@
module Main (module Main) where

View File

@ -1 +0,0 @@
module Main (Test(Test, a, b)) where

View File

@ -1,6 +0,0 @@
-- comment1
module Main
( Test(Test, a, b)
, foo -- comment2
) -- comment3
where

View File

@ -1 +0,0 @@
module Main (Test()) where

View File

@ -1 +0,0 @@
func :: asd -> Either a b

View File

@ -1 +0,0 @@
-- Intentionally left empty

View File

@ -1 +0,0 @@
import Data.List

View File

@ -1 +0,0 @@
import Data.List as L

View File

@ -1 +0,0 @@
import qualified Data.List

View File

@ -1 +0,0 @@
import qualified Data.List as L

View File

@ -1 +0,0 @@
import safe Data.List as L

View File

@ -1 +0,0 @@
import {-# SOURCE #-} Data.List ( )

View File

@ -1 +0,0 @@
import safe qualified Data.List

View File

@ -1 +0,0 @@
import {-# SOURCE #-} safe qualified Data.List

View File

@ -1 +0,0 @@
import qualified "base" Data.List

View File

@ -1,5 +0,0 @@
func
:: asd
-> Either
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd

View File

@ -1,3 +0,0 @@
import {-# SOURCE #-} safe qualified "base" Data.List as L
import {-# SOURCE #-} safe qualified "base" Data.List ( )
import {-# SOURCE #-} safe qualified Data.List hiding ( )

View File

@ -1 +0,0 @@
import qualified Data.List ( )

View File

@ -1 +0,0 @@
import Data.List ( nub )

View File

@ -1,4 +0,0 @@
import Data.List ( foldl'
, indexElem
, nub
)

View File

@ -1,14 +0,0 @@
import Test ( Long
, anymore
, fit
, items
, line
, list
, not
, onA
, quite
, single
, that
, will
, with
)

View File

@ -1,11 +0,0 @@
import Test ( (+)
, (:!)(..)
, (:*)((:.), T7, t7)
, (:.)
, T
, T2()
, T3(..)
, T4(T4)
, T5(T5, t5)
, T6((<|>))
)

View File

@ -1,3 +0,0 @@
import Test hiding ( )
import Test as T
hiding ( )

View File

@ -1,13 +0,0 @@
import Prelude as X
hiding ( head
, init
, last
, maximum
, minimum
, pred
, read
, readFile
, succ
, tail
, undefined
)

View File

@ -1,3 +0,0 @@
import TestJustAbitToLongModuleNameLikeThisOneIs
( )
import TestJustShortEnoughModuleNameLikeThisOne ( )

View File

@ -1,3 +0,0 @@
import TestJustAbitToLongModuleNameLikeThisOneI
as T
import TestJustShortEnoughModuleNameLikeThisOn as T

View File

@ -1,6 +0,0 @@
func
:: asd
-> Trither
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd

View File

@ -1,3 +0,0 @@
import TestJustAbitToLongModuleNameLikeTh
hiding ( )
import TestJustShortEnoughModuleNameLike hiding ( )

View File

@ -1,10 +0,0 @@
import MoreThanSufficientlyLongModuleNameWithSome
( compact
, fit
, inA
, items
, layout
, not
, that
, will
)

View File

@ -1,11 +0,0 @@
import TestJustAbitToLongModuleNameLikeTh
hiding ( abc
, def
, ghci
, jklm
)
import TestJustShortEnoughModuleNameLike hiding ( abc
, def
, ghci
, jklm
)

View File

@ -1,9 +0,0 @@
import {-# SOURCE #-} safe qualified "qualifier" A hiding ( )
import {-# SOURCE #-} safe qualified "qualifiers" A
hiding ( )
import {-# SOURCE #-} safe qualified "qualifiers" AlsoAf as T
import {-# SOURCE #-} safe qualified "qualifiers" AlsoAff ( )
import {-# SOURCE #-} safe qualified "qualifiers" AlsoAff
as T
import {-# SOURCE #-} safe qualified "qualifiers" AlsoAffe
( )

View File

@ -1,7 +0,0 @@
-- Test
import Data.List ( nub ) -- Test
{- Test -}
import qualified Data.List as L
( foldl' ) {- Test -}
-- Test
import Test ( test )

View File

@ -1,4 +0,0 @@
import Test ( abc
, def
-- comment
)

View File

@ -1,3 +0,0 @@
import Test ( abc
-- comment
)

View File

@ -1,8 +0,0 @@
import Test ( abc
-- comment
, def
, ghi
{- comment -}
, jkl
-- comment
)

View File

@ -1,2 +0,0 @@
import Test ( -- comment
)

View File

@ -1,8 +0,0 @@
import Test ( longbindingNameThatoverflowsColum
)
import Test ( Long
( List
, Of
, Things
)
)

View File

@ -1,6 +0,0 @@
func
:: Trither
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
lkasdlkjalsdjlakjsdlkjasldkjalskdjlkajsd
-> asd

View File

@ -1,18 +0,0 @@
import Test ( Thing
( -- Comments
)
)
import Test ( Thing
( Item
-- and Comment
)
)
import Test ( Thing
( With
-- Comments
, and
-- also
, items
-- !
)
)

View File

@ -1,2 +0,0 @@
import VeryLongModuleNameThatCouldEvenCauseAnEmptyBindingListToExpandIntoMultipleLine
( )

View File

@ -1,26 +0,0 @@
{-# LANGUAGE BangPatterns #-}
{-
- Test module
-}
module Test
( test1
-- ^ test
, test2
-- | test
, test3
, test4
, test5
, test6
, test7
, test8
, test9
, test10
-- Test 10
) where
-- Test
import Data.List ( nub ) -- Test
{- Test -}
import qualified Data.List as L
( foldl' ) {- Test -}
-- Test
import Test ( test )

View File

@ -1,2 +0,0 @@
import Aaa
import Baa

View File

@ -1,5 +0,0 @@
import Zaa
import Zab
import Aaa
import Baa

View File

@ -1,2 +0,0 @@
import Boo
import qualified Zoo

View File

@ -1,3 +0,0 @@
import Boo ( a )
import Boo ( b )

Some files were not shown because too many files have changed in this diff Show More