Skip to content

Commit

Permalink
Add 'source-constraints/' from commit '981153627d72a2cf445c8394e84961…
Browse files Browse the repository at this point in the history
…16271e1329'

git-subtree-dir: source-constraints
git-subtree-mainline: 9ef210c
git-subtree-split: 9811536
  • Loading branch information
mbj committed Jun 13, 2021
2 parents 9ef210c + 9811536 commit 8f56579
Show file tree
Hide file tree
Showing 20 changed files with 908 additions and 0 deletions.
32 changes: 32 additions & 0 deletions source-constraints/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on: push

jobs:
ci:
runs-on: ${{ matrix.os }}
env:
STACK_YAML: stack-${{ matrix.ghc }}.yaml
strategy:
fail-fast: false
matrix:
ghc: ['8.8', '8.10']
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
enable-stack: true
ghc-version: ${{ matrix.ghc }}
stack-version: '2.3'
- name: Cache
uses: actions/cache@v2
with:
path: ~/.stack
key: b-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('stack-*.yaml', '**/*.cabal') }}
- name: Install dependencies
run: stack build --test --only-dependencies
- name: Build
run: stack build --fast --test --no-run-tests
- name: Run tests
run: stack build --fast --test
3 changes: 3 additions & 0 deletions source-constraints/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.stack-work
/test/*.hi
/test/*.o
11 changes: 11 additions & 0 deletions source-constraints/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2019-2020 Markus Schirp

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 changes: 22 additions & 0 deletions source-constraints/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
![CI](https://github.com/mbj/source-constraints/workflows/CI/badge.svg)

# source-constraints

An in progress GHC plugin to add constraints on the GHC AST.

## Installation

Add the following extra-dep to your `stack.yml`:

```yaml
extra-deps:
- git: ssh://git@github.com/mbj/source-constraints
commit: $use_current_commit_hash
```
Add the plugin to your `packages.yml`

```yaml
ghc-options:
- -fplugin=SourceConstraints
```
91 changes: 91 additions & 0 deletions source-constraints/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: source-constraints
version: 0.0.2
synopsis: Source constraints GHC plugin
homepage: https://github.com/mbj/source-constraints#readme
author: Markus Schirp
maintainer: mbj@schirp-dso.com
copyright: 2018 Markus Schirp
category: CodeQuality
github: mbj/source-constraints
license: BSD3
tested-with: GHC ==8.8.4 || ==8.10.2
description: |
Please visit the README at <https://github.com/mbj/source-constraints#readme>
for usage information.
dependencies:
- attoparsec ^>= 0.13
- base ^>= 4.13 || ^>= 4.14
- bytestring ^>= 0.10
- filepath ^>= 1.4
- ghc ^>= 8.8 || ^>= 8.10
- syb ^>= 0.7
- text ^>= 1.2

extra-doc-files:
- README.md

flags:
development:
description: Run GHC with development flags
default: false
manual: true

extra-source-files:
- test/LocalModuleExplicitImport.hs
- test/MissingDerivingStrategy.hs
- test/UnsortedIE.hs
- test/UnsortedIEThingWith.hs
- test/UnsortedImportStatement.hs
- test/UnsortedMultipleDeriving.hs

ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wimplicit-prelude
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-exported-signatures
- -Wmissing-local-signatures
- -Wmonomorphism-restriction

when:
- condition: flag(development)
then:
ghc-options: -Werror
else:
ghc-options: -Wwarn

default-extensions:
- CPP
- DerivingStrategies
- GeneralizedNewtypeDeriving
- LambdaCase
- NoImplicitPrelude
- OverloadedStrings
- RecordWildCards
- ScopedTypeVariables
- Strict

library:
source-dirs:
- src
exposed-modules:
- SourceConstraints
- SourceConstraints.LocalModule

tests:
hspec:
main: Spec.hs
source-dirs: test
other-modules: []
ghc-options:
- -rtsopts
- -threaded
- -with-rtsopts=-N
dependencies:
- ghc-paths ^>= 0.1
- heredoc ^>= 0.2
- hspec ^>= 2.7
- source-constraints
90 changes: 90 additions & 0 deletions source-constraints/source-constraints.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
cabal-version: 1.18

-- This file has been generated from package.yaml by hpack version 0.33.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: 7f4b65ce85cf869179da0d6dbb1879986a3279f7fb002c2254e841c7431f2818

name: source-constraints
version: 0.0.2
synopsis: Source constraints GHC plugin
description: Please visit the README at <https://github.com/mbj/source-constraints#readme>
for usage information.
category: CodeQuality
homepage: https://github.com/mbj/source-constraints#readme
bug-reports: https://github.com/mbj/source-constraints/issues
author: Markus Schirp
maintainer: mbj@schirp-dso.com
copyright: 2018 Markus Schirp
license: BSD3
license-file: LICENSE
tested-with: GHC ==8.8.4 || ==8.10.2
build-type: Simple
extra-source-files:
test/LocalModuleExplicitImport.hs
test/MissingDerivingStrategy.hs
test/UnsortedIE.hs
test/UnsortedIEThingWith.hs
test/UnsortedImportStatement.hs
test/UnsortedMultipleDeriving.hs
extra-doc-files:
README.md

source-repository head
type: git
location: https://github.com/mbj/source-constraints

flag development
description: Run GHC with development flags
manual: True
default: False

library
exposed-modules:
SourceConstraints
SourceConstraints.LocalModule
other-modules:
Paths_source_constraints
hs-source-dirs:
src
default-extensions: CPP DerivingStrategies GeneralizedNewtypeDeriving LambdaCase NoImplicitPrelude OverloadedStrings RecordWildCards ScopedTypeVariables Strict
ghc-options: -Wall -Wcompat -Widentities -Wimplicit-prelude -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-exported-signatures -Wmissing-local-signatures -Wmonomorphism-restriction
build-depends:
attoparsec >=0.13 && <0.14
, base >=4.13 && <4.14 || >=4.14 && <4.15
, bytestring >=0.10 && <0.11
, filepath >=1.4 && <1.5
, ghc >=8.8 && <8.9 || >=8.10 && <8.11
, syb >=0.7 && <0.8
, text >=1.2 && <1.3
if flag(development)
ghc-options: -Werror
else
ghc-options: -Wwarn
default-language: Haskell2010

test-suite hspec
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs:
test
default-extensions: CPP DerivingStrategies GeneralizedNewtypeDeriving LambdaCase NoImplicitPrelude OverloadedStrings RecordWildCards ScopedTypeVariables Strict
ghc-options: -Wall -Wcompat -Widentities -Wimplicit-prelude -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-exported-signatures -Wmissing-local-signatures -Wmonomorphism-restriction -rtsopts -threaded -with-rtsopts=-N
build-depends:
attoparsec >=0.13 && <0.14
, base >=4.13 && <4.14 || >=4.14 && <4.15
, bytestring >=0.10 && <0.11
, filepath >=1.4 && <1.5
, ghc >=8.8 && <8.9 || >=8.10 && <8.11
, ghc-paths >=0.1 && <0.2
, heredoc >=0.2 && <0.3
, hspec >=2.7 && <2.8
, source-constraints
, syb >=0.7 && <0.8
, text >=1.2 && <1.3
if flag(development)
ghc-options: -Werror
else
ghc-options: -Wwarn
default-language: Haskell2010
Loading

0 comments on commit 8f56579

Please sign in to comment.