├── .github └── workflows │ └── haskell-ci.yml ├── .gitignore ├── ChangeLog.md ├── LICENSE.GPLv2 ├── LICENSE.GPLv3 ├── Makefile ├── README.md ├── Setup.hs ├── build-in-docker.sh ├── cabal-plan.cabal ├── cabal.haskell-ci ├── cabal.project ├── example ├── cabal-plan.html └── cabal-plan.md ├── fixtures ├── acme-kmett-8.4.json ├── acme-kmett-8.6.json ├── lens-4.17-ghc-7.8.json └── lens-4.17-ghc-8.4.json ├── license-report.css ├── src-exe ├── CText.hs ├── Flag.hs ├── LicenseReport.hs ├── ProcessLazyByteString.hs └── cabal-plan.hs └── src └── Cabal └── Plan.hs /.github/workflows/haskell-ci.yml: -------------------------------------------------------------------------------- 1 | # This GitHub workflow config has been generated by a script via 2 | # 3 | # haskell-ci 'github' 'cabal.project' 4 | # 5 | # To regenerate the script (for example after adjusting tested-with) run 6 | # 7 | # haskell-ci regenerate 8 | # 9 | # For more information, see https://github.com/haskell-CI/haskell-ci 10 | # 11 | # version: 0.19.20240608 12 | # 13 | # REGENDATA ("0.19.20240608",["github","cabal.project"]) 14 | # 15 | name: Haskell-CI 16 | on: 17 | push: 18 | branches: 19 | - master 20 | pull_request: 21 | branches: 22 | - master 23 | jobs: 24 | linux: 25 | name: Haskell-CI - Linux - ${{ matrix.compiler }} 26 | runs-on: ubuntu-20.04 27 | timeout-minutes: 28 | 60 29 | container: 30 | image: buildpack-deps:jammy 31 | continue-on-error: ${{ matrix.allow-failure }} 32 | strategy: 33 | matrix: 34 | include: 35 | - compiler: ghc-9.10.1 36 | compilerKind: ghc 37 | compilerVersion: 9.10.1 38 | setup-method: ghcup 39 | allow-failure: false 40 | - compiler: ghc-9.8.2 41 | compilerKind: ghc 42 | compilerVersion: 9.8.2 43 | setup-method: ghcup 44 | allow-failure: false 45 | - compiler: ghc-9.6.5 46 | compilerKind: ghc 47 | compilerVersion: 9.6.5 48 | setup-method: ghcup 49 | allow-failure: false 50 | - compiler: ghc-9.4.8 51 | compilerKind: ghc 52 | compilerVersion: 9.4.8 53 | setup-method: ghcup 54 | allow-failure: false 55 | - compiler: ghc-9.2.8 56 | compilerKind: ghc 57 | compilerVersion: 9.2.8 58 | setup-method: ghcup 59 | allow-failure: false 60 | - compiler: ghc-9.0.2 61 | compilerKind: ghc 62 | compilerVersion: 9.0.2 63 | setup-method: ghcup 64 | allow-failure: false 65 | - compiler: ghc-8.10.7 66 | compilerKind: ghc 67 | compilerVersion: 8.10.7 68 | setup-method: ghcup 69 | allow-failure: false 70 | - compiler: ghc-8.8.4 71 | compilerKind: ghc 72 | compilerVersion: 8.8.4 73 | setup-method: ghcup 74 | allow-failure: false 75 | - compiler: ghc-8.6.5 76 | compilerKind: ghc 77 | compilerVersion: 8.6.5 78 | setup-method: ghcup 79 | allow-failure: false 80 | fail-fast: false 81 | steps: 82 | - name: apt 83 | run: | 84 | apt-get update 85 | apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 86 | mkdir -p "$HOME/.ghcup/bin" 87 | curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" 88 | chmod a+x "$HOME/.ghcup/bin/ghcup" 89 | "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) 90 | "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) 91 | env: 92 | HCKIND: ${{ matrix.compilerKind }} 93 | HCNAME: ${{ matrix.compiler }} 94 | HCVER: ${{ matrix.compilerVersion }} 95 | - name: Set PATH and environment variables 96 | run: | 97 | echo "$HOME/.cabal/bin" >> $GITHUB_PATH 98 | echo "LANG=C.UTF-8" >> "$GITHUB_ENV" 99 | echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" 100 | echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" 101 | HCDIR=/opt/$HCKIND/$HCVER 102 | HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") 103 | HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') 104 | HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') 105 | echo "HC=$HC" >> "$GITHUB_ENV" 106 | echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" 107 | echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" 108 | echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" 109 | HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') 110 | echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" 111 | echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" 112 | echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" 113 | echo "HEADHACKAGE=false" >> "$GITHUB_ENV" 114 | echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" 115 | echo "GHCJSARITH=0" >> "$GITHUB_ENV" 116 | env: 117 | HCKIND: ${{ matrix.compilerKind }} 118 | HCNAME: ${{ matrix.compiler }} 119 | HCVER: ${{ matrix.compilerVersion }} 120 | - name: env 121 | run: | 122 | env 123 | - name: write cabal config 124 | run: | 125 | mkdir -p $CABAL_DIR 126 | cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz 159 | echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - 160 | xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan 161 | rm -f cabal-plan.xz 162 | chmod a+x $HOME/.cabal/bin/cabal-plan 163 | cabal-plan --version 164 | - name: checkout 165 | uses: actions/checkout@v4 166 | with: 167 | path: source 168 | - name: initial cabal.project for sdist 169 | run: | 170 | touch cabal.project 171 | echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project 172 | cat cabal.project 173 | - name: sdist 174 | run: | 175 | mkdir -p sdist 176 | $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist 177 | - name: unpack 178 | run: | 179 | mkdir -p unpacked 180 | find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; 181 | - name: generate cabal.project 182 | run: | 183 | PKGDIR_cabal_plan="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/cabal-plan-[0-9.]*')" 184 | echo "PKGDIR_cabal_plan=${PKGDIR_cabal_plan}" >> "$GITHUB_ENV" 185 | rm -f cabal.project cabal.project.local 186 | touch cabal.project 187 | touch cabal.project.local 188 | echo "packages: ${PKGDIR_cabal_plan}" >> cabal.project 189 | echo "package cabal-plan" >> cabal.project 190 | echo " ghc-options: -Werror=missing-methods" >> cabal.project 191 | cat >> cabal.project <> cabal.project.local 196 | cat cabal.project 197 | cat cabal.project.local 198 | - name: dump install plan 199 | run: | 200 | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all 201 | cabal-plan 202 | - name: restore cache 203 | uses: actions/cache/restore@v4 204 | with: 205 | key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} 206 | path: ~/.cabal/store 207 | restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- 208 | - name: install dependencies 209 | run: | 210 | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all 211 | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all 212 | - name: build w/o tests 213 | run: | 214 | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all 215 | - name: build 216 | run: | 217 | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always 218 | - name: cabal check 219 | run: | 220 | cd ${PKGDIR_cabal_plan} || false 221 | ${CABAL} -vnormal check 222 | - name: haddock 223 | run: | 224 | $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all 225 | - name: unconstrained build 226 | run: | 227 | rm -f cabal.project.local 228 | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all 229 | - name: save cache 230 | uses: actions/cache/save@v4 231 | if: always() 232 | with: 233 | key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} 234 | path: ~/.cabal/store 235 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | /dist-newstyle/ 3 | /dist/ 4 | /.ghc.environment.* 5 | /cabal.project.local 6 | /tags 7 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Revision history for `cabal-plan` 2 | 3 | ## 0.7.5.0 4 | 5 | * No changes in the library 6 | * Add `-f` filter flag to `tred` command to only show parts of the graph to given package(s). 7 | This essentially answers "why that package" is in the build plan. 8 | 9 | ## 0.7.4.0 10 | 11 | * Use Cabal-syntax-3.12 12 | * Support GHC-8.6.5...9.10.1 13 | 14 | ## 0.7.3.0 15 | 16 | * Use Cabal-syntax-3.10 17 | 18 | ## 0.7.2.3 19 | 20 | * Fix issue in previous release (license generation didn't work at all) 21 | 22 | ## 0.7.2.2 23 | 24 | * Use Cabal-syntax-3.8.1.0 25 | 26 | ## 0.7.2.1 27 | 28 | * Support Cabal-3.6 29 | * Support aeson-2.0.0.0 30 | * Drop support for GHC prior 8.2 31 | 32 | ## 0.7.2.0 33 | 34 | ### `exe:cabal-plan` Executable 35 | 36 | * Use `cabal-install-parsers` to find and parse `~/cabal/config` 37 | * Fix ascii/unicode output in `tred` 38 | * Add flags to hide setup and executable components in dot command 39 | * Update dependencies (support `base16-bytestring-1.0.0.0`) 40 | 41 | ### Library 42 | 43 | * Update dependencies (support `base16-bytestring-1.0.0.0`) 44 | 45 | ## 0.7.1.0 46 | 47 | ### `exe:cabal-plan` Executable 48 | 49 | * Add `--ascii` / `--unicode` flags to control output character set 50 | * Add `dot-png` command as a version of `dot` command with different defaults 51 | * Use `cabal-install-parsers`, 52 | this makes `license-report` work with non-default configurations 53 | 54 | ## 0.7.0.0 55 | 56 | ### `lib:cabal-plan` Library 57 | 58 | * Support `local+noindex` style repositories: New `Repo` constructor: `RepoLocalNoIndex`. 59 | * Support newer versions of dependencies (GHC-8.10, aeson-1.5, optics-core-0.3) 60 | 61 | ### `exe:cabal-plan` Executable 62 | 63 | * Support `Cabal-3.2` 64 | 65 | ## 0.6.2.0 66 | 67 | ### `lib:cabal-plan` Library 68 | 69 | * Add `findPlanJson` function 70 | 71 | ### `exe:cabal-plan` Executable 72 | 73 | * Drop `process-extras` dependency 74 | 75 | ## 0.6.1.0 76 | 77 | ### `lib:cabal-plan` Library 78 | 79 | No changes 80 | 81 | ### `exe:cabal-plan` Executable 82 | 83 | * `dot` command got new options 84 | * `--root` to limit graph to specific roots 85 | * `--output` to write directly to some file 86 | * `--run-dot-png` and `--run-dot-pdf` to run `dot` for you 87 | 88 | * `cabal-plan` executable depends on `optics-core` instead of `lens`. 89 | Therefore is buildable only with GHC-8.0+ 90 | 91 | ## 0.6.0.0 92 | 93 | ### `lib:cabal-plan` Library 94 | 95 | * `ExactPath` constructor to skip `find` in `findAndDecodePlanJson`. 96 | (Note: see also `decodePlanJson`) 97 | 98 | 99 | ### `exe:cabal-plan` Executable 100 | 101 | * `--plan-json` for exact `plan.json` location 102 | * `--relative` search for project root relative to that directory 103 | * `--colors=auto|never|always` flag 104 | * `tred` command to print transtive reduction of dependency graph 105 | * `diff` command to compare two plans 106 | * `list-bins` prints full selector "pkg:type:name", i.e. includes package name 107 | 108 | ## 0.5.0.0 109 | 110 | ### `lib:cabal-plan` Library 111 | 112 | * New `dispCompNameTarget` function for pretty-printing `CompName`s in cabal's target-selector syntax. 113 | * Add support for cabal 2.4's `pkg-src` package provenience metadata. 114 | * Add support for cabal 2.4.1's `pkg-cabal-sha256` package description checksum field. 115 | 116 | ### `exe:cabal-plan` Executable 117 | 118 | * Add support for including package description checksums in `fingerprint` output 119 | * Add support for printing flag selection in `topo` output 120 | * Fail gracefully in `license-report` when metadata cannot be found in index 121 | 122 | ## 0.4.0.0 123 | 124 | ### `lib:cabal-plan` Library 125 | 126 | * New `SearchPlanJson` type to specify strategy for locating `plan.json` 127 | * Add `SearchPlanJson` parameter to `findAndDecodePlanJson` function and change return type 128 | * Expose separate `findProjectRoot` operation 129 | 130 | ### `exe:cabal-plan` Executable 131 | 132 | * New command `license-report` (requires Cabal flag `license-report` to be active) 133 | 134 | ## 0.3.0.0 135 | 136 | ### `lib:cabal-plan` Library 137 | 138 | * Add support for foreign-lib components. 139 | * Add support for `dist-dir` `plan.json` field. 140 | * Make `Sha256` type abstract and add new `sha256{To,From}ByteString` 141 | conversion functions, as well as the new `parseSha256` function. 142 | * Introduce `FlagName` newtype. 143 | * Add `FromJSONKey`/`ToJSONKey` instances for `UnitId`, `PackageName`, and `PkgId`. 144 | 145 | ### `exe:cabal-plan` Executable 146 | 147 | * smart completer for list-bin/list-bins pattern 148 | * new command `topo` (printing out topographic sorting of install-plan) 149 | * `dot` prints component dependency graph. New options: 150 | - `--tred` transitive reduction 151 | - `--tred-weights` Adjust edge thickness during transitive reduction 152 | - `--path-from pkgA --path-from pkgB` Highlight dependency paths from *pkgA* to *pkgB* 153 | - `--revdep pkg` highlight reverse dependencies of pkg in the install plan 154 | 155 | ## 0.2.0.0 156 | 157 | * Add an optional `--builddir` argument to all commands and to `findAndDecodePlanJson` function. 158 | * Add experimental support for underlining. 159 | * Reimplement CLI with `optparse-applicative`. 160 | * Add new sub-command `list-bins` and change semantics of existing `list-bin` sub-cmd. 161 | 162 | ### 0.1.1.0 163 | 164 | * Add `cabal-plan fingerprint` command for printing 165 | sha256 sums of source tarballs. 166 | 167 | ## 0.1.0.0 168 | 169 | * First version. Released on an unsuspecting world. 170 | -------------------------------------------------------------------------------- /LICENSE.GPLv2: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /LICENSE.GPLv3: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all : 2 | cabal new-build all 3 | 4 | ghcid-exe : 5 | ghcid -c 'cabal new-repl cabal-plan:exe:cabal-plan' 6 | 7 | diff-demo : 8 | cabal new-run cabal-plan -- diff --plan-json=fixtures/lens-4.17-ghc-7.8.json --plan-json=fixtures/lens-4.17-ghc-8.4.json 9 | 10 | .PHONY: tags 11 | 12 | tags : 13 | hasktags -c src src-exe 14 | 15 | EXETARGET:=cabal-plan 16 | VERSION=0.7.3.0 17 | 18 | CABALPLAN:=$(HOME)/.local/bin/cabal-plan 19 | CABAL:=$(HOME)/.ghcup/bin/cabal 20 | GHC:=$(HOME)/.ghcup/bin/ghc-9.2.7 21 | GHCUP:=$(HOME)/.ghcup/bin/ghcup 22 | 23 | ALPINEVERSION:=3.17.3 24 | GHCUPVERSION:=0.1.19.2 25 | GHCVERSION:=9.2.7 26 | CABALVERSION:=3.10.1.0 27 | 28 | # docker run -ti -v $(pwd):/src alpine:3.17.3 29 | # cd /src 30 | # apk add make 31 | # make alpine-release 32 | # 33 | .PHONY: alpine-release 34 | alpine-release : 35 | apk add binutils-gold curl gcc git gmp-dev libc-dev libffi-dev make musl-dev ncurses-dev openssh-client perl tar tmux vim xz zlib-dev zlib-static 36 | mkdir -p $(HOME)/.ghcup/bin 37 | mkdir -p $(HOME)/.local/bin 38 | curl -L https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz 39 | xz -d < cabal-plan.xz > $(CABALPLAN) 40 | curl https://downloads.haskell.org/~ghcup/$(GHCUPVERSION)/x86_64-linux-ghcup-$(GHCUPVERSION) > $(GHCUP) 41 | chmod a+x $(GHCUP) 42 | $(GHCUP) install ghc $(GHCVERSION) 43 | $(GHCUP) install cabal $(CABALVERSION) 44 | $(CABAL) update --ignore-project 45 | $(CABAL) build exe:$(EXETARGET) -fexe --with-compiler $(GHC) --enable-executable-static 46 | strip $$($(CABALPLAN) list-bin $(EXETARGET)) 47 | @ls -l $$($(CABALPLAN) list-bin $(EXETARGET)) 48 | cat $$($(CABALPLAN) list-bin $(EXETARGET)) | xz > $(EXETARGET)-$(VERSION)-x86_64-linux.xz 49 | @ls -l $(EXETARGET)-$(VERSION)-x86_64-linux.xz 50 | sha256sum $(EXETARGET)-$(VERSION)-x86_64-linux.xz | tee $(EXETARGET)-$(VERSION).SHA256SUM 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `cabal-plan`: Library and utility for processing cabal's plan.json file [![Hackage](https://img.shields.io/hackage/v/cabal-plan.svg)](https://hackage.haskell.org/package/cabal-plan) [![Build Status](https://travis-ci.org/haskell-hvr/cabal-plan.svg)](https://travis-ci.org/haskell-hvr/cabal-plan) 2 | 3 | **Please refer to the [package description](https://hackage.haskell.org/package/cabal-plan#description) for an overview of `cabal-plan`.** 4 | -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /build-in-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run this script with 4 | # 5 | # sh build-in-docker.sh 6 | # 7 | # To produce a simple bindist in dist-newstyle/bindist 8 | 9 | set -ex 10 | 11 | if [ "x$DOCKER" = "xYES" ]; then 12 | cd /build 13 | cabal update 14 | 15 | cd /build/src 16 | cabal build --builddir=/build/builddir all 17 | 18 | TARGET=$(cabal run --builddir=/build/builddir -- cabal-plan list-bin --builddir=/build/builddir cabal-plan | tail -n1) 19 | VERSION=$("$TARGET" --version | awk '{ print $2 }') 20 | 21 | cp "$TARGET" /build/bindist/cabal-plan 22 | strip /build/bindist/cabal-plan 23 | xz -c < /build/bindist/cabal-plan > "/build/bindist/cabal-plan-${VERSION}-x86_64-linux.xz" 24 | 25 | ls -lh /build/bindist 26 | 27 | else 28 | 29 | mkdir -p dist-newstyle/bindist 30 | docker run --rm -ti -e DOCKER=YES -v "$(pwd):/build/src:ro" -v "$(pwd)/dist-newstyle/bindist:/build/bindist" phadej/ghc:8.6.5-xenial sh /build/src/build-in-docker.sh 31 | cd dist-newstyle/bindist 32 | sha256sum cabal-plan-*.xz > SHA256SUMS 33 | gpg2 --sign --detach-sig --armor SHA256SUMS 34 | 35 | fi 36 | -------------------------------------------------------------------------------- /cabal-plan.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.2 2 | name: cabal-plan 3 | version: 0.7.5.0 4 | synopsis: Library and utility for processing cabal's plan.json file 5 | description: 6 | This package provides a library (see "Cabal.Plan") for decoding @plan.json@ files as 7 | well as the simple tool @cabal-plan@ for extracting and pretty printing 8 | the information contained in the @plan.json@ file. 9 | . 10 | @plan.json@ files are generated by [cabal](https://hackage.haskell.org/package/cabal-install)'s [Nix-style local builds](http://cabal.readthedocs.io/en/latest/nix-local-build.html) and contain detailed information about the build/install plan computed by the cabal solver. 11 | . 12 | == @cabal-plan@ utility 13 | . 14 | The @cabal-plan@ executable (enabled via the @exe@ cabal flag) provides various operations: 15 | . 16 | [info] Show basic report of dependency tree 17 | [show] Dump 'PlanJson' data-structure via 'Show' instance 18 | [tred] Show dependency tree as a graph 19 | [diff] Diff two install plans 20 | [list-bins] List all binaries 21 | [list-bin] List single binary (useful for scripting, e.g. @cabal list-bin exe:cabal-plan@) 22 | [fingerprint] Print SHA256 sums of dependencies' source tarballs and cabal files 23 | [dot] Generate graph of dependencies in @.dot@ format 24 | [topo] Print plan topologically sorted 25 | [license-report] Generate license report for a component (only available when built with @license-report@ flag enabled); see () 26 | . 27 | See also ["New things in Haskell package QA" Blogpost](https://oleg.fi/gists/posts/2018-01-08-haskell-package-qa.html) for a description of the @topo@ and @dot@ operations as well as how to enable tab-completion. 28 | 29 | bug-reports: https://github.com/hvr/cabal-plan/issues 30 | license: GPL-2.0-or-later 31 | license-files: 32 | LICENSE.GPLv2 33 | LICENSE.GPLv3 34 | 35 | author: Herbert Valerio Riedel 36 | maintainer: hvr@gnu.org 37 | copyright: 2016 Herbert Valerio Riedel 38 | category: Development 39 | build-type: Simple 40 | tested-with: 41 | GHC ==8.6.5 42 | || ==8.8.4 43 | || ==8.10.7 44 | || ==9.0.2 45 | || ==9.2.8 46 | || ==9.4.8 47 | || ==9.6.5 48 | || ==9.8.2 49 | || ==9.10.1 50 | 51 | extra-source-files: 52 | ChangeLog.md 53 | example/cabal-plan.html 54 | example/cabal-plan.md 55 | 56 | ---------------------------------------------------------------------------- 57 | 58 | flag exe 59 | -- this automatic flag allows the cabal solver to disable the exe:cabal-plan component (& its build-deps); 60 | -- IOW, emulate https://github.com/haskell/cabal/issues/4660 61 | description: Enable @exe:cabal-plan@ component 62 | 63 | flag license-report 64 | description: 65 | Enable @license-report@ sub-command (only relevant when the @exe@ flag is active) 66 | 67 | manual: True 68 | default: False 69 | 70 | flag _ 71 | description: Enable underlining of primary unit-ids 72 | manual: True 73 | default: False 74 | 75 | library 76 | default-language: Haskell2010 77 | other-extensions: 78 | GeneralizedNewtypeDeriving 79 | OverloadedStrings 80 | RecordWildCards 81 | 82 | exposed-modules: Cabal.Plan 83 | build-depends: 84 | , aeson ^>=2.2.0.0 85 | , base ^>=4.12.0.0 || ^>=4.13.0.0 || ^>=4.14.0.0 || ^>=4.15.0.0 || ^>=4.16.0.0 || ^>=4.17.0.0 || ^>=4.18.0.0 || ^>=4.19.0.0 || ^>=4.20.0.0 86 | , base16-bytestring ^>=1.0.2.0 87 | , bytestring ^>=0.10.8.2 || ^>=0.11.1.0 || ^>=0.12.0.0 88 | , containers ^>=0.6.0.1 || ^>=0.7 89 | , directory ^>=1.3.0.2 90 | , filepath ^>=1.4.1.2 || ^>=1.5.2.0 91 | , text ^>=1.2.3.0 || ^>=2.0.1 || ^>=2.1 92 | 93 | hs-source-dirs: src 94 | ghc-options: -Wall 95 | 96 | executable cabal-plan 97 | default-language: Haskell2010 98 | other-extensions: RecordWildCards 99 | hs-source-dirs: src-exe 100 | main-is: cabal-plan.hs 101 | other-modules: 102 | Flag 103 | LicenseReport 104 | Paths_cabal_plan 105 | ProcessLazyByteString 106 | 107 | other-modules: CText 108 | autogen-modules: Paths_cabal_plan 109 | ghc-options: -Wall 110 | 111 | if flag(exe) 112 | -- dependencies w/ inherited version ranges via 'cabal-plan' library 113 | -- Note: exe is installable only with GHC-8.0+ 114 | build-depends: 115 | , base 116 | , bytestring 117 | , cabal-plan 118 | , containers 119 | , directory 120 | , text 121 | 122 | -- dependencies which require version bounds 123 | build-depends: 124 | , ansi-terminal ^>=1.1 125 | , async ^>=2.2.2 126 | , mtl ^>=2.2.2 || ^>=2.3.1 127 | , optics-core ^>=0.4 128 | , optparse-applicative ^>=0.18.1.0 129 | , parsec ^>=3.1.13 130 | , process ^>=1.6.1.0 131 | , semialign ^>=1.3 132 | , singleton-bool ^>=0.1.8 133 | , these ^>=1.2.1 134 | , topograph ^>=1.0.0.2 135 | , transformers ^>=0.5.6.2 || ^>=0.6.1.0 136 | , vector ^>=0.13.0.0 137 | 138 | if flag(license-report) 139 | build-depends: 140 | , cabal-install-parsers ^>=0.6.2 141 | , Cabal-syntax ^>=3.12.0.0 142 | , filepath ^>=1.4.1.2 || ^>=1.5.2.0 143 | , tar ^>=0.6.1.0 144 | , zlib ^>=0.7.1.0 145 | 146 | if flag(_) 147 | cpp-options: -DUNDERLINE_SUPPORT 148 | 149 | else 150 | buildable: False 151 | 152 | ghc-options: -Wall 153 | 154 | source-repository head 155 | type: git 156 | location: https://github.com/hvr/cabal-plan 157 | -------------------------------------------------------------------------------- /cabal.haskell-ci: -------------------------------------------------------------------------------- 1 | branches: master 2 | installed: +all -Cabal -Cabal-syntax 3 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: . 2 | 3 | package cabal-plan 4 | flags: +exe +license-report +_ 5 | 6 | allow-newer: cabal-install-parsers-0.6.1:base 7 | allow-newer: cabal-install-parsers-0.6.1:transformers 8 | -------------------------------------------------------------------------------- /example/cabal-plan.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Dependency License Report

13 |

Bold-faced package-names denote standard libraries bundled with ghc-8.2.2.

14 |

Direct dependencies of cabal-plan:exe:cabal-plan

15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 |
NameVersionSPDX License IdDescriptionAlso depended upon by
Cabal2.4.1.0BSD-3-ClauseA framework for packaging Haskell software
aeson1.4.2.0BSD-3-ClauseFast JSON parsing and encoding
ansi-terminal0.8.2BSD-3-ClauseSimple ANSI terminal support, with Windows compatibilityansi-wl-pprint
base4.10.1.0BSD-3-ClauseBasic libraries(core library)
base-compat0.10.5MITA compatibility layer for baseaeson
base-orphans0.8MITBackwards-compatible orphan instances for base
base16-bytestring0.1.1.6BSD-3-ClauseFast base16 (hex) encoding and decoding for ByteStrings
bytestring0.10.8.2BSD-3-ClauseFast, compact, strict and lazy byte strings with a list interfaceCabal, aeson, attoparsec, base16-bytestring, binary, hashable, parsec, scientific, tar, text, unix, uuid-types, zlib
containers0.5.10.2BSD-3-ClauseAssorted concrete container typesCabal, aeson, attoparsec, binary, scientific, tar, th-abstraction
directory1.3.0.2BSD-3-ClausePlatform-agnostic library for filesystem operationsCabal, process, tar
filepath1.4.1.2BSD-3-ClauseLibrary for manipulating FilePaths in a cross platform way.Cabal, directory, process, tar
mtl2.2.2BSD-3-ClauseMonad classes, using functional dependenciesCabal, parsec
optparse-applicative0.14.3.0BSD-3-ClauseUtilities and combinators for parsing command line options
parsec3.1.13.0BSD-3-ClauseMonadic parser combinatorsCabal
tar0.5.1.0BSD-3-ClauseReading, writing and manipulating ".tar" archive files.
text1.2.3.1BSD-2-ClauseAn efficient packed Unicode text type.Cabal, aeson, attoparsec, hashable, parsec, scientific, uuid-types
vector0.12.0.2BSD-3-ClauseEfficient Arraysaeson
zlib0.6.2BSD-3-ClauseCompression and decompression in the gzip and zlib formats
161 |

Indirect transitive dependencies

162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 |
NameVersionSPDX License IdDescriptionDepended upon by
StateVar1.1.1.1BSD-3-ClauseState variablescontravariant
ansi-wl-pprint0.6.8.2BSD-3-ClauseThe Wadler/Leijen Pretty Printer for colored ANSI terminal outputoptparse-applicative
array0.5.2.0BSD-3-ClauseMutable and immutable arraysCabal, attoparsec, binary, containers, deepseq, integer-logarithms, stm, tar, text
attoparsec0.13.2.2BSD-3-ClauseFast combinator parsing for bytestrings and textaeson
binary0.8.5.1BSD-3-ClauseBinary serialisation for Haskell values using lazy ByteStringsCabal, scientific, text, uuid-types
colour2.3.4MITA model for human colour/color perceptionansi-terminal
contravariant1.5BSD-3-ClauseContravariant functorsaeson
deepseq1.4.3.0BSD-3-ClauseDeep evaluation of data structuresCabal, aeson, attoparsec, bytestring, containers, dlist, hashable, pretty, process, scientific, tagged, tar, text, time, unordered-containers, uuid-types, vector
dlist0.8.0.5BSD-3-ClauseDifference listsaeson
ghc-boot-th8.2.2BSD-3-ClauseShared functionality between GHC and the @template-haskell@ librarytemplate-haskell
ghc-prim0.5.1.1BSD-3-ClauseGHC primitives(core library)
hashable1.2.7.0BSD-3-ClauseA class for types that can be converted to a hash valueaeson, scientific, unordered-containers, uuid-types
integer-gmp1.0.1.0BSD-3-ClauseInteger library based on GMP(core library)
integer-logarithms1.0.2.2MITInteger logarithms.scientific
pretty1.1.3.3BSD-3-ClausePretty-printing libraryCabal, template-haskell
primitive0.6.4.0BSD-3-ClausePrimitive memory-related operationsaeson, scientific, vector
process1.6.1.0BSD-3-ClauseProcess librariesCabal, optparse-applicative
random1.1BSD-3-Clauserandom number libraryuuid-types
scientific0.3.6.2BSD-3-ClauseNumbers represented using scientific notationaeson, attoparsec
stm2.5.0.0BSD-3-ClauseSoftware Transactional MemoryStateVar
tagged0.8.6BSD-3-ClauseHaskell 98 phantom types to avoid unsafely passing dummy argumentsaeson
template-haskell2.12.0.0BSD-3-ClauseSupport library for Template Haskellaeson, tagged, th-abstraction
th-abstraction0.2.8.0ISCNicer interface for reified information about data typesaeson
time1.8.0.2BSD-3-ClauseA time libraryCabal, aeson, directory, random, tar, time-locale-compat, unix
time-locale-compat0.1.1.5BSD-3-ClauseCompatibile module for time-format localeaeson
transformers0.5.2.0BSD-3-ClauseConcrete functor and monad transformersCabal, StateVar, attoparsec, contravariant, mtl, optparse-applicative, primitive, tagged, transformers-compat
transformers-compat0.6.2BSD-3-ClauseA small compatibility shim for the transformers libraryoptparse-applicative
unix2.7.2.2BSD-3-ClausePOSIX functionalityCabal, base-compat, directory, process
unordered-containers0.2.9.0BSD-3-ClauseEfficient hashing-based container typesaeson
uuid-types1.0.3BSD-3-ClauseType definitions for Universally Unique Identifiersaeson
392 | 393 | 394 | -------------------------------------------------------------------------------- /example/cabal-plan.md: -------------------------------------------------------------------------------- 1 | # Dependency License Report 2 | 3 | Bold-faced **`package-name`**s denote standard libraries bundled with `ghc-8.2.2`. 4 | 5 | ## Direct dependencies of `cabal-plan:exe:cabal-plan` 6 | 7 | | Name | Version | [SPDX](https://spdx.org/licenses/) License Id | Description | Also depended upon by | 8 | | --- | --- | --- | --- | --- | 9 | | `Cabal` | [`2.4.1.0`](http://hackage.haskell.org/package/Cabal-2.4.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/Cabal-2.4.1.0/src/LICENSE) | A framework for packaging Haskell software | | 10 | | `aeson` | [`1.4.2.0`](http://hackage.haskell.org/package/aeson-1.4.2.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/aeson-1.4.2.0/src/LICENSE) | Fast JSON parsing and encoding | | 11 | | `ansi-terminal` | [`0.8.2`](http://hackage.haskell.org/package/ansi-terminal-0.8.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ansi-terminal-0.8.2/src/LICENSE) | Simple ANSI terminal support, with Windows compatibility | `ansi-wl-pprint` | 12 | | **`base`** | [`4.10.1.0`](http://hackage.haskell.org/package/base-4.10.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/base-4.10.1.0/src/LICENSE) | Basic libraries | *(core library)* | 13 | | `base-compat` | [`0.10.5`](http://hackage.haskell.org/package/base-compat-0.10.5) | [`MIT`](http://hackage.haskell.org/package/base-compat-0.10.5/src/LICENSE) | A compatibility layer for base | `aeson` | 14 | | `base-orphans` | [`0.8`](http://hackage.haskell.org/package/base-orphans-0.8) | [`MIT`](http://hackage.haskell.org/package/base-orphans-0.8/src/LICENSE) | Backwards-compatible orphan instances for base | | 15 | | `base16-bytestring` | [`0.1.1.6`](http://hackage.haskell.org/package/base16-bytestring-0.1.1.6) | [`BSD-3-Clause`](http://hackage.haskell.org/package/base16-bytestring-0.1.1.6/src/LICENSE) | Fast base16 (hex) encoding and decoding for ByteStrings | | 16 | | **`bytestring`** | [`0.10.8.2`](http://hackage.haskell.org/package/bytestring-0.10.8.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/bytestring-0.10.8.2/src/LICENSE) | Fast, compact, strict and lazy byte strings with a list interface | `Cabal`, `aeson`, `attoparsec`, `base16-bytestring`, `binary`, `hashable`, `parsec`, `scientific`, `tar`, `text`, `unix`, `uuid-types`, `zlib` | 17 | | **`containers`** | [`0.5.10.2`](http://hackage.haskell.org/package/containers-0.5.10.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/containers-0.5.10.2/src/LICENSE) | Assorted concrete container types | `Cabal`, `aeson`, `attoparsec`, `binary`, `scientific`, `tar`, `th-abstraction` | 18 | | **`directory`** | [`1.3.0.2`](http://hackage.haskell.org/package/directory-1.3.0.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/directory-1.3.0.2/src/LICENSE) | Platform-agnostic library for filesystem operations | `Cabal`, `process`, `tar` | 19 | | **`filepath`** | [`1.4.1.2`](http://hackage.haskell.org/package/filepath-1.4.1.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/filepath-1.4.1.2/src/LICENSE) | Library for manipulating FilePaths in a cross platform way. | `Cabal`, `directory`, `process`, `tar` | 20 | | `mtl` | [`2.2.2`](http://hackage.haskell.org/package/mtl-2.2.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/mtl-2.2.2/src/LICENSE) | Monad classes, using functional dependencies | `Cabal`, `parsec` | 21 | | `optparse-applicative` | [`0.14.3.0`](http://hackage.haskell.org/package/optparse-applicative-0.14.3.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/optparse-applicative-0.14.3.0/src/LICENSE) | Utilities and combinators for parsing command line options | | 22 | | `parsec` | [`3.1.13.0`](http://hackage.haskell.org/package/parsec-3.1.13.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/parsec-3.1.13.0/src/LICENSE) | Monadic parser combinators | `Cabal` | 23 | | `tar` | [`0.5.1.0`](http://hackage.haskell.org/package/tar-0.5.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/tar-0.5.1.0/src/LICENSE) | Reading, writing and manipulating ".tar" archive files. | | 24 | | `text` | [`1.2.3.1`](http://hackage.haskell.org/package/text-1.2.3.1) | [`BSD-2-Clause`](http://hackage.haskell.org/package/text-1.2.3.1/src/LICENSE) | An efficient packed Unicode text type. | `Cabal`, `aeson`, `attoparsec`, `hashable`, `parsec`, `scientific`, `uuid-types` | 25 | | `vector` | [`0.12.0.2`](http://hackage.haskell.org/package/vector-0.12.0.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/vector-0.12.0.2/src/LICENSE) | Efficient Arrays | `aeson` | 26 | | `zlib` | [`0.6.2`](http://hackage.haskell.org/package/zlib-0.6.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/zlib-0.6.2/src/LICENSE) | Compression and decompression in the gzip and zlib formats | | 27 | 28 | ## Indirect transitive dependencies 29 | 30 | | Name | Version | [SPDX](https://spdx.org/licenses/) License Id | Description | Depended upon by | 31 | | --- | --- | --- | --- | --- | 32 | | `StateVar` | [`1.1.1.1`](http://hackage.haskell.org/package/StateVar-1.1.1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/StateVar-1.1.1.1/src/LICENSE) | State variables | `contravariant` | 33 | | `ansi-wl-pprint` | [`0.6.8.2`](http://hackage.haskell.org/package/ansi-wl-pprint-0.6.8.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ansi-wl-pprint-0.6.8.2/src/LICENSE) | The Wadler/Leijen Pretty Printer for colored ANSI terminal output | `optparse-applicative` | 34 | | **`array`** | [`0.5.2.0`](http://hackage.haskell.org/package/array-0.5.2.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/array-0.5.2.0/src/LICENSE) | Mutable and immutable arrays | `Cabal`, `attoparsec`, `binary`, `containers`, `deepseq`, `integer-logarithms`, `stm`, `tar`, `text` | 35 | | `attoparsec` | [`0.13.2.2`](http://hackage.haskell.org/package/attoparsec-0.13.2.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/attoparsec-0.13.2.2/src/LICENSE) | Fast combinator parsing for bytestrings and text | `aeson` | 36 | | **`binary`** | [`0.8.5.1`](http://hackage.haskell.org/package/binary-0.8.5.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/binary-0.8.5.1/src/LICENSE) | Binary serialisation for Haskell values using lazy ByteStrings | `Cabal`, `scientific`, `text`, `uuid-types` | 37 | | `colour` | [`2.3.4`](http://hackage.haskell.org/package/colour-2.3.4) | [`MIT`](http://hackage.haskell.org/package/colour-2.3.4/src/LICENSE) | A model for human colour/color perception | `ansi-terminal` | 38 | | `contravariant` | [`1.5`](http://hackage.haskell.org/package/contravariant-1.5) | [`BSD-3-Clause`](http://hackage.haskell.org/package/contravariant-1.5/src/LICENSE) | Contravariant functors | `aeson` | 39 | | **`deepseq`** | [`1.4.3.0`](http://hackage.haskell.org/package/deepseq-1.4.3.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/deepseq-1.4.3.0/src/LICENSE) | Deep evaluation of data structures | `Cabal`, `aeson`, `attoparsec`, `bytestring`, `containers`, `dlist`, `hashable`, `pretty`, `process`, `scientific`, `tagged`, `tar`, `text`, `time`, `unordered-containers`, `uuid-types`, `vector` | 40 | | `dlist` | [`0.8.0.5`](http://hackage.haskell.org/package/dlist-0.8.0.5) | [`BSD-3-Clause`](http://hackage.haskell.org/package/dlist-0.8.0.5/src/LICENSE) | Difference lists | `aeson` | 41 | | **`ghc-boot-th`** | [`8.2.2`](http://hackage.haskell.org/package/ghc-boot-th-8.2.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ghc-boot-th-8.2.2/src/LICENSE) | Shared functionality between GHC and the @template-haskell@ library | `template-haskell` | 42 | | **`ghc-prim`** | [`0.5.1.1`](http://hackage.haskell.org/package/ghc-prim-0.5.1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/ghc-prim-0.5.1.1/src/LICENSE) | GHC primitives | *(core library)* | 43 | | `hashable` | [`1.2.7.0`](http://hackage.haskell.org/package/hashable-1.2.7.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/hashable-1.2.7.0/src/LICENSE) | A class for types that can be converted to a hash value | `aeson`, `scientific`, `unordered-containers`, `uuid-types` | 44 | | **`integer-gmp`** | [`1.0.1.0`](http://hackage.haskell.org/package/integer-gmp-1.0.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/integer-gmp-1.0.1.0/src/LICENSE) | Integer library based on GMP | *(core library)* | 45 | | `integer-logarithms` | [`1.0.2.2`](http://hackage.haskell.org/package/integer-logarithms-1.0.2.2) | [`MIT`](http://hackage.haskell.org/package/integer-logarithms-1.0.2.2/src/LICENSE) | Integer logarithms. | `scientific` | 46 | | **`pretty`** | [`1.1.3.3`](http://hackage.haskell.org/package/pretty-1.1.3.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/pretty-1.1.3.3/src/LICENSE) | Pretty-printing library | `Cabal`, `template-haskell` | 47 | | `primitive` | [`0.6.4.0`](http://hackage.haskell.org/package/primitive-0.6.4.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/primitive-0.6.4.0/src/LICENSE) | Primitive memory-related operations | `aeson`, `scientific`, `vector` | 48 | | **`process`** | [`1.6.1.0`](http://hackage.haskell.org/package/process-1.6.1.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/process-1.6.1.0/src/LICENSE) | Process libraries | `Cabal`, `optparse-applicative` | 49 | | `random` | [`1.1`](http://hackage.haskell.org/package/random-1.1) | [`BSD-3-Clause`](http://hackage.haskell.org/package/random-1.1/src/LICENSE) | random number library | `uuid-types` | 50 | | `scientific` | [`0.3.6.2`](http://hackage.haskell.org/package/scientific-0.3.6.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/scientific-0.3.6.2/src/LICENSE) | Numbers represented using scientific notation | `aeson`, `attoparsec` | 51 | | `stm` | [`2.5.0.0`](http://hackage.haskell.org/package/stm-2.5.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/stm-2.5.0.0/src/LICENSE) | Software Transactional Memory | `StateVar` | 52 | | `tagged` | [`0.8.6`](http://hackage.haskell.org/package/tagged-0.8.6) | [`BSD-3-Clause`](http://hackage.haskell.org/package/tagged-0.8.6/src/LICENSE) | Haskell 98 phantom types to avoid unsafely passing dummy arguments | `aeson` | 53 | | **`template-haskell`** | [`2.12.0.0`](http://hackage.haskell.org/package/template-haskell-2.12.0.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/template-haskell-2.12.0.0/src/LICENSE) | Support library for Template Haskell | `aeson`, `tagged`, `th-abstraction` | 54 | | `th-abstraction` | [`0.2.8.0`](http://hackage.haskell.org/package/th-abstraction-0.2.8.0) | [`ISC`](http://hackage.haskell.org/package/th-abstraction-0.2.8.0/src/LICENSE) | Nicer interface for reified information about data types | `aeson` | 55 | | **`time`** | [`1.8.0.2`](http://hackage.haskell.org/package/time-1.8.0.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/time-1.8.0.2/src/LICENSE) | A time library | `Cabal`, `aeson`, `directory`, `random`, `tar`, `time-locale-compat`, `unix` | 56 | | `time-locale-compat` | [`0.1.1.5`](http://hackage.haskell.org/package/time-locale-compat-0.1.1.5) | [`BSD-3-Clause`](http://hackage.haskell.org/package/time-locale-compat-0.1.1.5/src/LICENSE) | Compatibile module for time-format locale | `aeson` | 57 | | **`transformers`** | [`0.5.2.0`](http://hackage.haskell.org/package/transformers-0.5.2.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-0.5.2.0/src/LICENSE) | Concrete functor and monad transformers | `Cabal`, `StateVar`, `attoparsec`, `contravariant`, `mtl`, `optparse-applicative`, `primitive`, `tagged`, `transformers-compat` | 58 | | `transformers-compat` | [`0.6.2`](http://hackage.haskell.org/package/transformers-compat-0.6.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/transformers-compat-0.6.2/src/LICENSE) | A small compatibility shim for the transformers library | `optparse-applicative` | 59 | | **`unix`** | [`2.7.2.2`](http://hackage.haskell.org/package/unix-2.7.2.2) | [`BSD-3-Clause`](http://hackage.haskell.org/package/unix-2.7.2.2/src/LICENSE) | POSIX functionality | `Cabal`, `base-compat`, `directory`, `process` | 60 | | `unordered-containers` | [`0.2.9.0`](http://hackage.haskell.org/package/unordered-containers-0.2.9.0) | [`BSD-3-Clause`](http://hackage.haskell.org/package/unordered-containers-0.2.9.0/src/LICENSE) | Efficient hashing-based container types | `aeson` | 61 | | `uuid-types` | [`1.0.3`](http://hackage.haskell.org/package/uuid-types-1.0.3) | [`BSD-3-Clause`](http://hackage.haskell.org/package/uuid-types-1.0.3/src/LICENSE) | Type definitions for Universally Unique Identifiers | `aeson` | 62 | 63 | -------------------------------------------------------------------------------- /fixtures/lens-4.17-ghc-8.4.json: -------------------------------------------------------------------------------- 1 | {"cabal-version":"2.5.0.0","cabal-lib-version":"2.5.0.0","compiler-id":"ghc-8.4.4","os":"linux","arch":"x86_64","install-plan":[{"type":"pre-existing","id":"Cabal-2.2.0.1","pkg-name":"Cabal","pkg-version":"2.2.0.1","depends":["array-0.5.2.0","base-4.11.1.0","bytestring-0.10.8.2","containers-0.5.11.0","deepseq-1.4.3.0","filepath-1.4.2","pretty-1.1.3.6","process-1.6.3.0","time-1.8.0.2","transformers-0.5.5.0","mtl-2.2.2","text-1.2.3.1","parsec-3.1.13.0","directory-1.3.1.5","binary-0.8.5.1","unix-2.7.2.2"]},{"type":"configured","id":"StateVar-1.1.1.1-2eb875c264a15b92a1b44f90d82dfd9fb87075415703c1fae2cbea49a7235ee2","pkg-name":"StateVar","pkg-version":"1.1.1.1","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"cd3b516a49faf0627ea31885e012611e63600824976dcb276bcb2e92cdb0790f","pkg-src-sha256":"eb6436516ab2d5e3d3e070b5a1595c4dceea760a58a9cc8d23dad5f6008f2223","depends":["base-4.11.1.0","stm-2.4.5.1","transformers-0.5.5.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"adjunctions-4.4-baa1013d06b3c204dfc5bd04cb64b0f6d3893707af63599e8e67f671553194b7","pkg-name":"adjunctions","pkg-version":"4.4","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"2738dd5f5d5e93749adb14a05472e58a96a75d0f299e46371c6f46dc4e97daf9","pkg-src-sha256":"507c2ef55337ae61c805f8cbc1213dfd7d2b85187342675d662254b8d8a16ae9","depends":["array-0.5.2.0","base-4.11.1.0","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","free-5.1-0e44f663f0bf474898f1af0512ef5940ddc863913177f7c730b38b3aede1b531","mtl-2.2.2","profunctors-5.3-814205977af3e2eb7377f727c28dc907e735304835277f8a95473651f3206c44","semigroupoids-5.3.2-e6e89883c8affe7e1f8203d8379eeed8e3791297bd638fb62ab1d69c15775520","semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f","void-0.7.2-3c24dc6d02aa019bb756137e8c54b80f56287b79e10db1cc3319a2fedfd56719"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"array-0.5.2.0","pkg-name":"array","pkg-version":"0.5.2.0","depends":["base-4.11.1.0"]},{"type":"pre-existing","id":"base-4.11.1.0","pkg-name":"base","pkg-version":"4.11.1.0","depends":["rts","ghc-prim-0.5.2.0","integer-gmp-1.0.2.0"]},{"type":"configured","id":"base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","pkg-name":"base-orphans","pkg-version":"0.8","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"4885caa82ab94fa5cb841d6d06a43a97cdc7e835f346be4f11c1cc5707b886db","pkg-src-sha256":"aceec656bfb4222ad3035c3d87d80130b42b595b72888f9ab59c6dbb7ed24817","depends":["base-4.11.1.0","ghc-prim-0.5.2.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"bifunctors-5.5.3-a194c1aebe4b492401c54896209c0184f5708d3a998a95b3c0486533553b7bc5","pkg-name":"bifunctors","pkg-version":"5.5.3","flags":{"semigroups":true,"tagged":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"8f6e90c3ae7a04dba36669e4fad5b9fbc973dbfc6978b4c7d410f9875e0e9d00","pkg-src-sha256":"d434528fd2ea765bace57c4ade0bc9fa32ba2c425f563b33a4b60f625ecfc9ca","depends":["base-4.11.1.0","base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","template-haskell-2.13.0.0","th-abstraction-0.2.11.0-ec5729467e7837cc6708bebf2b55de79f0b3fb869044298b4c4985483342b04f","transformers-0.5.5.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"binary-0.8.5.1","pkg-name":"binary","pkg-version":"0.8.5.1","depends":["base-4.11.1.0","bytestring-0.10.8.2","containers-0.5.11.0","array-0.5.2.0"]},{"type":"pre-existing","id":"bytestring-0.10.8.2","pkg-name":"bytestring","pkg-version":"0.10.8.2","depends":["base-4.11.1.0","ghc-prim-0.5.2.0","deepseq-1.4.3.0","integer-gmp-1.0.2.0"]},{"type":"configured","id":"cabal-doctest-1.0.6-8e4dd026c8c254f68695124ff71eb1a77f6614488ba4ac9bd250508d193d4b55","pkg-name":"cabal-doctest","pkg-version":"1.0.6","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"c0b4a5b1ff38d2867e7003b4be59f3bd7e8e204ab8c988d96d3a77472ae671cd","pkg-src-sha256":"decaaa5a73eaabaf3c4f8c644bd7f6e3f428b6244e935c0cf105f75f9b24ed2d","depends":["Cabal-2.2.0.1","base-4.11.1.0","directory-1.3.1.5","filepath-1.4.2"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"call-stack-0.1.0-b87174ed3fdf9db739064a0775bb7b48fb8ddf864d990f334095bedc2a51510d","pkg-name":"call-stack","pkg-version":"0.1.0","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"3453a0c5ed3a7a7de0cc0703907e05bd251c766cce8a38efe41b7188d228e3fa","pkg-src-sha256":"f25f5e0992a39371079cc25c2a14b5abb872fa7d868a32753aac3a258b83b1e2","depends":["base-4.11.1.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","pkg-name":"comonad","pkg-version":"5.0.4","flags":{"containers":true,"contravariant":true,"distributive":true,"test-doctests":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"522ca45fedc212d86b3f628275974378e821e7f3caf8055a64189ae4f8c59dbf","pkg-src-sha256":"78a89d7f9f0975b40b3294adcb70885649572b687ac5f5dc98e452471838e825","components":{"lib":{"depends":["base-4.11.1.0","containers-0.5.11.0","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f"],"exe-depends":[]},"setup":{"depends":["Cabal-2.2.0.1","base-4.11.1.0","cabal-doctest-1.0.6-8e4dd026c8c254f68695124ff71eb1a77f6614488ba4ac9bd250508d193d4b55"],"exe-depends":[]}}},{"type":"pre-existing","id":"containers-0.5.11.0","pkg-name":"containers","pkg-version":"0.5.11.0","depends":["base-4.11.1.0","array-0.5.2.0","deepseq-1.4.3.0","ghc-prim-0.5.2.0"]},{"type":"configured","id":"contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","pkg-name":"contravariant","pkg-version":"1.5","flags":{"safe":false,"semigroups":true,"statevar":true,"tagged":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"83f4d20073414561f2352aeb8f48207def31cc933eb058c141968fbbefaeb0d5","pkg-src-sha256":"6ef067b692ad69ffff294b953aa85f3ded459d4ae133c37896222a09280fc3c2","components":{"lib":{"depends":["StateVar-1.1.1.1-2eb875c264a15b92a1b44f90d82dfd9fb87075415703c1fae2cbea49a7235ee2","base-4.11.1.0","transformers-0.5.5.0"],"exe-depends":[]}}},{"type":"pre-existing","id":"deepseq-1.4.3.0","pkg-name":"deepseq","pkg-version":"1.4.3.0","depends":["base-4.11.1.0","array-0.5.2.0"]},{"type":"pre-existing","id":"directory-1.3.1.5","pkg-name":"directory","pkg-version":"1.3.1.5","depends":["base-4.11.1.0","time-1.8.0.2","filepath-1.4.2","unix-2.7.2.2"]},{"type":"configured","id":"distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","pkg-name":"distributive","pkg-version":"0.6","flags":{"semigroups":true,"tagged":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"26507cf231eb10db1eb54bc358477418ce87d5077ff76c66743925fb49494b54","pkg-src-sha256":"a4af1341a63a430dc569dd1e59631f127c40ebdd353a945a74d18682f6bdc1d4","components":{"lib":{"depends":["base-4.11.1.0","base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","transformers-0.5.5.0"],"exe-depends":[]},"setup":{"depends":["Cabal-2.2.0.1","base-4.11.1.0","cabal-doctest-1.0.6-8e4dd026c8c254f68695124ff71eb1a77f6614488ba4ac9bd250508d193d4b55"],"exe-depends":[]}}},{"type":"configured","id":"exceptions-0.10.0-c61957327abb7e41affafea074be6f6d2819e43ea624d990a499be679dfc07af","pkg-name":"exceptions","pkg-version":"0.10.0","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"ef6066c13de2dfd191dc810f9dfa9a474318abc9bb458413ffbdd2ece482312a","pkg-src-sha256":"1edd912e5ea5cbda37941b06738597d35214dc247d332b1bfffc82adadfa49d7","depends":["base-4.11.1.0","mtl-2.2.2","stm-2.4.5.1","template-haskell-2.13.0.0","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"filepath-1.4.2","pkg-name":"filepath","pkg-version":"1.4.2","depends":["base-4.11.1.0"]},{"type":"configured","id":"free-5.1-0e44f663f0bf474898f1af0512ef5940ddc863913177f7c730b38b3aede1b531","pkg-name":"free","pkg-version":"5.1","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"71aa48c5a5dde71ed2a7f3d1d23c6d3a66580859444f55c8b38dd1bb205aa298","pkg-src-sha256":"70424d5c82dea36a0a29c4f5f6bc047597a947ad46f3d66312e47bbee2eeea84","depends":["base-4.11.1.0","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","exceptions-0.10.0-c61957327abb7e41affafea074be6f6d2819e43ea624d990a499be679dfc07af","mtl-2.2.2","profunctors-5.3-814205977af3e2eb7377f727c28dc907e735304835277f8a95473651f3206c44","semigroupoids-5.3.2-e6e89883c8affe7e1f8203d8379eeed8e3791297bd638fb62ab1d69c15775520","template-haskell-2.13.0.0","transformers-0.5.5.0","transformers-base-0.4.5.2-f267c35b3d259b89d91bb4ae30554441c43623c150febdf2ae7d4ffb296acafe"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"ghc-boot-th-8.4.4","pkg-name":"ghc-boot-th","pkg-version":"8.4.4","depends":["base-4.11.1.0"]},{"type":"pre-existing","id":"ghc-prim-0.5.2.0","pkg-name":"ghc-prim","pkg-version":"0.5.2.0","depends":["rts"]},{"type":"configured","id":"hashable-1.2.7.0-cf28fb2fd2a82f2545516978171725626c3d29e37c4c686b7c97ff6de67c71b6","pkg-name":"hashable","pkg-version":"1.2.7.0","flags":{"examples":false,"integer-gmp":true,"sse2":true,"sse41":false},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"03b6836ca9cd3ad0e5a2f3cce989b001dd0e05f306a873db3196037adb30e0a4","pkg-src-sha256":"ecb5efc0586023f5a0dc861100621c1dbb4cbb2f0516829a16ebac39f0432abf","depends":["base-4.11.1.0","bytestring-0.10.8.2","deepseq-1.4.3.0","ghc-prim-0.5.2.0","integer-gmp-1.0.2.0","text-1.2.3.1"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"integer-gmp-1.0.2.0","pkg-name":"integer-gmp","pkg-version":"1.0.2.0","depends":["ghc-prim-0.5.2.0"]},{"type":"configured","id":"invariant-0.5.1-09ddf3bf3ce58b9546d4d803044ee7aba7a5725226aa3d2fe57e2cfe5001c9b0","pkg-name":"invariant","pkg-version":"0.5.1","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"04634f9af68954f7593180fc46ae5e101cac88c6a59224e11c85aabb98d20f80","pkg-src-sha256":"eb8c9c45ad24020af2978f22271458bf3787937d931c50c86b580c53ca3f122b","depends":["StateVar-1.1.1.1-2eb875c264a15b92a1b44f90d82dfd9fb87075415703c1fae2cbea49a7235ee2","array-0.5.2.0","base-4.11.1.0","bifunctors-5.5.3-a194c1aebe4b492401c54896209c0184f5708d3a998a95b3c0486533553b7bc5","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","ghc-prim-0.5.2.0","profunctors-5.3-814205977af3e2eb7377f727c28dc907e735304835277f8a95473651f3206c44","semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","stm-2.4.5.1","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","template-haskell-2.13.0.0","th-abstraction-0.2.11.0-ec5729467e7837cc6708bebf2b55de79f0b3fb869044298b4c4985483342b04f","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f","unordered-containers-0.2.10.0-b76929601719807fdf3335d9b9cda3ce1be5a2c69a418c133857aeef52f7c6ab"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"kan-extensions-5.2-49a5df59a460915fdeef17cade8a2881080a121c7c816f3cd8a6894090feddf9","pkg-name":"kan-extensions","pkg-version":"5.2","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"2407501562039dad6a3d19aacd0bbcca07aa28497cbd1cdaaf5aabc30146899d","pkg-src-sha256":"6b727e586f744b96529415eeabc745dfe05feea61f6b6bad90c224c879f4dbd3","components":{"lib":{"depends":["adjunctions-4.4-baa1013d06b3c204dfc5bd04cb64b0f6d3893707af63599e8e67f671553194b7","array-0.5.2.0","base-4.11.1.0","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","free-5.1-0e44f663f0bf474898f1af0512ef5940ddc863913177f7c730b38b3aede1b531","invariant-0.5.1-09ddf3bf3ce58b9546d4d803044ee7aba7a5725226aa3d2fe57e2cfe5001c9b0","mtl-2.2.2","profunctors-5.3-814205977af3e2eb7377f727c28dc907e735304835277f8a95473651f3206c44","semigroupoids-5.3.2-e6e89883c8affe7e1f8203d8379eeed8e3791297bd638fb62ab1d69c15775520","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f"],"exe-depends":[]}}},{"type":"configured","id":"lens-4.17-inplace","pkg-name":"lens","pkg-version":"4.17","flags":{"benchmark-uniplate":false,"dump-splices":false,"inlining":true,"j":false,"old-inline-pragmas":false,"safe":false,"test-doctests":true,"test-hunit":true,"test-properties":true,"test-templates":true,"trustworthy":true},"style":"local","pkg-src":{"type":"local","path":"/home/ogre/mess/lens-4.17/."},"dist-dir":"/home/ogre/mess/lens-4.17/dist-newstyle/build/x86_64-linux/ghc-8.4.4/lens-4.17","components":{"lib":{"depends":["array-0.5.2.0","base-4.11.1.0","base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","bifunctors-5.5.3-a194c1aebe4b492401c54896209c0184f5708d3a998a95b3c0486533553b7bc5","bytestring-0.10.8.2","call-stack-0.1.0-b87174ed3fdf9db739064a0775bb7b48fb8ddf864d990f334095bedc2a51510d","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","exceptions-0.10.0-c61957327abb7e41affafea074be6f6d2819e43ea624d990a499be679dfc07af","filepath-1.4.2","free-5.1-0e44f663f0bf474898f1af0512ef5940ddc863913177f7c730b38b3aede1b531","ghc-prim-0.5.2.0","hashable-1.2.7.0-cf28fb2fd2a82f2545516978171725626c3d29e37c4c686b7c97ff6de67c71b6","kan-extensions-5.2-49a5df59a460915fdeef17cade8a2881080a121c7c816f3cd8a6894090feddf9","mtl-2.2.2","parallel-3.2.2.0-e45c1ddf81407ca67f28fa14ecfaf119fb92b4494fea9d98ffdc187467ac9190","profunctors-5.3-814205977af3e2eb7377f727c28dc907e735304835277f8a95473651f3206c44","reflection-2.1.4-c6e23ad23330ae912a7822eafb504c851e3f656edad0a5d3b3faf0563541d115","semigroupoids-5.3.2-e6e89883c8affe7e1f8203d8379eeed8e3791297bd638fb62ab1d69c15775520","semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","template-haskell-2.13.0.0","text-1.2.3.1","th-abstraction-0.2.11.0-ec5729467e7837cc6708bebf2b55de79f0b3fb869044298b4c4985483342b04f","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f","unordered-containers-0.2.10.0-b76929601719807fdf3335d9b9cda3ce1be5a2c69a418c133857aeef52f7c6ab","vector-0.12.0.2-43363117aef63256234ab5e348a1ea7ed5b41be218beb1f8e895c9a6595f9c17","void-0.7.2-3c24dc6d02aa019bb756137e8c54b80f56287b79e10db1cc3319a2fedfd56719"],"exe-depends":[]},"setup":{"depends":["Cabal-2.2.0.1","base-4.11.1.0","cabal-doctest-1.0.6-8e4dd026c8c254f68695124ff71eb1a77f6614488ba4ac9bd250508d193d4b55","filepath-1.4.2"],"exe-depends":[]}}},{"type":"pre-existing","id":"mtl-2.2.2","pkg-name":"mtl","pkg-version":"2.2.2","depends":["base-4.11.1.0","transformers-0.5.5.0"]},{"type":"configured","id":"parallel-3.2.2.0-e45c1ddf81407ca67f28fa14ecfaf119fb92b4494fea9d98ffdc187467ac9190","pkg-name":"parallel","pkg-version":"3.2.2.0","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"83e6886134615ce146c47615fac30e131dbb21ee0a1650c75f81d6de1c41593b","pkg-src-sha256":"170453a71a2a8b31cca63125533f7771d7debeb639700bdabdd779c34d8a6ef6","depends":["array-0.5.2.0","base-4.11.1.0","containers-0.5.11.0","deepseq-1.4.3.0","ghc-prim-0.5.2.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"parsec-3.1.13.0","pkg-name":"parsec","pkg-version":"3.1.13.0","depends":["base-4.11.1.0","mtl-2.2.2","bytestring-0.10.8.2","text-1.2.3.1"]},{"type":"pre-existing","id":"pretty-1.1.3.6","pkg-name":"pretty","pkg-version":"1.1.3.6","depends":["base-4.11.1.0","deepseq-1.4.3.0","ghc-prim-0.5.2.0"]},{"type":"configured","id":"primitive-0.6.4.0-6bd81e4566d528621b49db41850e12ab77b36fb543d158e069d4384a8a16686d","pkg-name":"primitive","pkg-version":"0.6.4.0","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"5b6a2c3cc70a35aabd4565fcb9bb1dd78fe2814a36e62428a9a1aae8c32441a1","pkg-src-sha256":"4cbeaf7924dd79221f327ea101a29bf35c4976dc3319df157ff46ea68e6a0c64","depends":["base-4.11.1.0","ghc-prim-0.5.2.0","transformers-0.5.5.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"process-1.6.3.0","pkg-name":"process","pkg-version":"1.6.3.0","depends":["base-4.11.1.0","directory-1.3.1.5","filepath-1.4.2","deepseq-1.4.3.0","unix-2.7.2.2"]},{"type":"configured","id":"profunctors-5.3-814205977af3e2eb7377f727c28dc907e735304835277f8a95473651f3206c44","pkg-name":"profunctors","pkg-version":"5.3","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"ce641b72fd014b1f7b42a438f8c0360cb93fd277c7b843b7ef94a7c083c31ded","pkg-src-sha256":"74632acc5bb76e04ade95e187be432b607da0e863c0e08f3cabafb23d8b4a3b7","depends":["base-4.11.1.0","base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","bifunctors-5.5.3-a194c1aebe4b492401c54896209c0184f5708d3a998a95b3c0486533553b7bc5","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","transformers-0.5.5.0"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"reflection-2.1.4-c6e23ad23330ae912a7822eafb504c851e3f656edad0a5d3b3faf0563541d115","pkg-name":"reflection","pkg-version":"2.1.4","flags":{"slow":false,"template-haskell":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"fbdfe95dcbe7c2fe19e1e62664d7ab4b432b8685e310cb3f0da621d936e05b56","pkg-src-sha256":"f22fc478d43a36ec3d6c48c57ec53636c0bf936f3733b9a2b34e1a2e6351c44d","depends":["base-4.11.1.0","template-haskell-2.13.0.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"rts","pkg-name":"rts","pkg-version":"1.0","depends":[]},{"type":"configured","id":"semigroupoids-5.3.2-e6e89883c8affe7e1f8203d8379eeed8e3791297bd638fb62ab1d69c15775520","pkg-name":"semigroupoids","pkg-version":"5.3.2","flags":{"comonad":true,"containers":true,"contravariant":true,"distributive":true,"doctests":true,"tagged":true,"unordered-containers":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"7a00aa24d8129b153f19991b96341e6f725ba77cef46b151c84d6dac1d12b47e","pkg-src-sha256":"61a8213df437ee96a20b1c6dec8b5c573e4e0f338eb2061739a67f471d6b9d05","components":{"lib":{"depends":["base-4.11.1.0","base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","bifunctors-5.5.3-a194c1aebe4b492401c54896209c0184f5708d3a998a95b3c0486533553b7bc5","comonad-5.0.4-9aa99a0a060eceae3313f5ec49fd6968f970d7973a56b0f0e4b27c8aed2009f9","containers-0.5.11.0","contravariant-1.5-096664df30bdc019793f0df6b6bfd5c4c96739f884098562feb08fbfe6b71d95","distributive-0.6-ec017f219c36fd4b8609430ce2aef6dcdebb0310f814a580450740b721ce77dd","hashable-1.2.7.0-cf28fb2fd2a82f2545516978171725626c3d29e37c4c686b7c97ff6de67c71b6","tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","template-haskell-2.13.0.0","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f","unordered-containers-0.2.10.0-b76929601719807fdf3335d9b9cda3ce1be5a2c69a418c133857aeef52f7c6ab"],"exe-depends":[]},"setup":{"depends":["Cabal-2.2.0.1","base-4.11.1.0","cabal-doctest-1.0.6-8e4dd026c8c254f68695124ff71eb1a77f6614488ba4ac9bd250508d193d4b55"],"exe-depends":[]}}},{"type":"configured","id":"semigroups-0.18.5-2239a9e1c3e738f9063bf0d1b87ded355f0e0dc8598c2157984687667e8a6cf5","pkg-name":"semigroups","pkg-version":"0.18.5","flags":{"binary":true,"bytestring":true,"bytestring-builder":false,"containers":true,"deepseq":true,"hashable":true,"tagged":true,"text":true,"transformers":true,"unordered-containers":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"aaf0d3d5050aa120b2eb98682bc7f8aeed947c1eb51a80375f32775af3d2ff68","pkg-src-sha256":"ab2a96af6e81e31b909c37ba65f436f1493dbf387cfe0de10b6586270c4ce29d","depends":["base-4.11.1.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"stm-2.4.5.1","pkg-name":"stm","pkg-version":"2.4.5.1","depends":["base-4.11.1.0","array-0.5.2.0"]},{"type":"configured","id":"tagged-0.8.6-56c00178448594cba56221d18aaa6d867df6543a6df30327d92194cc79e030ef","pkg-name":"tagged","pkg-version":"0.8.6","flags":{"deepseq":true,"transformers":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"b5e1de3b14ff198b548928f686e5e8783301dc231413f751c23f4ee10cd47a7c","pkg-src-sha256":"ad16def0884cf6f05ae1ae8e90192cf9d8d9673fa264b249499bd9e4fac791dd","depends":["base-4.11.1.0","deepseq-1.4.3.0","template-haskell-2.13.0.0","transformers-0.5.5.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"template-haskell-2.13.0.0","pkg-name":"template-haskell","pkg-version":"2.13.0.0","depends":["base-4.11.1.0","ghc-boot-th-8.4.4","pretty-1.1.3.6"]},{"type":"pre-existing","id":"text-1.2.3.1","pkg-name":"text","pkg-version":"1.2.3.1","depends":["array-0.5.2.0","base-4.11.1.0","binary-0.8.5.1","deepseq-1.4.3.0","ghc-prim-0.5.2.0","bytestring-0.10.8.2","integer-gmp-1.0.2.0"]},{"type":"configured","id":"th-abstraction-0.2.11.0-ec5729467e7837cc6708bebf2b55de79f0b3fb869044298b4c4985483342b04f","pkg-name":"th-abstraction","pkg-version":"0.2.11.0","flags":{},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"5c286870277705796887d0cbfa48a6aa5e0f206152592a54fbc550d8ce0c5ab5","pkg-src-sha256":"51884bcc31d825b93e6788f5731bd7234478dd4ada379816a88228ccc8e0800c","depends":["base-4.11.1.0","containers-0.5.11.0","ghc-prim-0.5.2.0","template-haskell-2.13.0.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"time-1.8.0.2","pkg-name":"time","pkg-version":"1.8.0.2","depends":["base-4.11.1.0","deepseq-1.4.3.0"]},{"type":"pre-existing","id":"transformers-0.5.5.0","pkg-name":"transformers","pkg-version":"0.5.5.0","depends":["base-4.11.1.0"]},{"type":"configured","id":"transformers-base-0.4.5.2-f267c35b3d259b89d91bb4ae30554441c43623c150febdf2ae7d4ffb296acafe","pkg-name":"transformers-base","pkg-version":"0.4.5.2","flags":{"orphaninstances":true},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"e4d8155470905ba2942033a1537fc4cf91927d1c9b34693fd57ddf3bc02334af","pkg-src-sha256":"d0c80c63fdce6a077dd8eda4f1ff289b85578703a3f1272e141d400fe23245e8","depends":["base-4.11.1.0","base-orphans-0.8-30d38106db593062481806287d2039c4f628d713a2b57642421fb327a6b042de","stm-2.4.5.1","transformers-0.5.5.0","transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"transformers-compat-0.6.2-d23d41b1e6a9915855f992a34c72cae1258724f19f116ef02226eabc7e927c0f","pkg-name":"transformers-compat","pkg-version":"0.6.2","flags":{"five":false,"five-three":true,"four":false,"generic-deriving":true,"mtl":true,"three":false,"two":false},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"3569e3a38065c66c99eca44ce67fba2747628d1b87d8c1b6bba2e910d79f0df1","pkg-src-sha256":"dc06228b7b8a546f9d257b4fe2b369fc2cb279240bbe4312aa8f47bb2752e4be","depends":["base-4.11.1.0","ghc-prim-0.5.2.0","transformers-0.5.5.0"],"exe-depends":[],"component-name":"lib"},{"type":"pre-existing","id":"unix-2.7.2.2","pkg-name":"unix","pkg-version":"2.7.2.2","depends":["base-4.11.1.0","bytestring-0.10.8.2","time-1.8.0.2"]},{"type":"configured","id":"unordered-containers-0.2.10.0-b76929601719807fdf3335d9b9cda3ce1be5a2c69a418c133857aeef52f7c6ab","pkg-name":"unordered-containers","pkg-version":"0.2.10.0","flags":{"debug":false},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"97cbf75a606c5e4f499828cb11aa8410c5f3a0034b4ef088cf2fad8ca986af33","pkg-src-sha256":"65f117bdbdea9efc75fb9fd539873de7687e005d8898bb21821020a4b383c573","depends":["base-4.11.1.0","deepseq-1.4.3.0","hashable-1.2.7.0-cf28fb2fd2a82f2545516978171725626c3d29e37c4c686b7c97ff6de67c71b6"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"vector-0.12.0.2-43363117aef63256234ab5e348a1ea7ed5b41be218beb1f8e895c9a6595f9c17","pkg-name":"vector","pkg-version":"0.12.0.2","flags":{"boundschecks":true,"internalchecks":false,"unsafechecks":false,"wall":false},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"6a898f00b9850fb84836f187324fac1e64c998fb4eac290d4aa91b50a4c586f5","pkg-src-sha256":"52e89dacaff10bedb8653181963cae928f9674a099bb706713dae83994bbc0f3","depends":["base-4.11.1.0","deepseq-1.4.3.0","ghc-prim-0.5.2.0","primitive-0.6.4.0-6bd81e4566d528621b49db41850e12ab77b36fb543d158e069d4384a8a16686d"],"exe-depends":[],"component-name":"lib"},{"type":"configured","id":"void-0.7.2-3c24dc6d02aa019bb756137e8c54b80f56287b79e10db1cc3319a2fedfd56719","pkg-name":"void","pkg-version":"0.7.2","flags":{"safe":false},"style":"global","pkg-src":{"type":"repo-tar","repo":{"type":"secure-repo","uri":"http://hackage.haskell.org/"}},"pkg-cabal-sha256":"e07cd23407914833bc8bf726ad27fe4696c2e38685bc00031a2ca632230124ca","pkg-src-sha256":"d3fffe66a03e4b53db1e459edf75ad8402385a817cae415d857ec0b03ce0cf2b","depends":["base-4.11.1.0"],"exe-depends":[],"component-name":"lib"}]} -------------------------------------------------------------------------------- /license-report.css: -------------------------------------------------------------------------------- 1 | /* from https://gist.github.com/killercup/5917178 declared as public domain or CC0 2 | * 3 | * pandoc -c license-report.css --self-contained -s license.md > license.html 4 | * 5 | */ 6 | 7 | html { 8 | font-size: 100%; 9 | overflow-y: scroll; 10 | -webkit-text-size-adjust: 100%; 11 | -ms-text-size-adjust: 100%; 12 | } 13 | 14 | body { 15 | color: #444; 16 | font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif; 17 | font-size: 12px; 18 | line-height: 1.7; 19 | padding: 1em; 20 | margin: auto; 21 | /* max-width: 42em; */ 22 | background: #fefefe; 23 | } 24 | 25 | a { 26 | color: #0645ad; 27 | text-decoration: none; 28 | } 29 | 30 | a:visited { 31 | color: #0b0080; 32 | } 33 | 34 | a:hover { 35 | color: #06e; 36 | } 37 | 38 | a:active { 39 | color: #faa700; 40 | } 41 | 42 | a:focus { 43 | outline: thin dotted; 44 | } 45 | 46 | *::-moz-selection { 47 | background: rgba(255, 255, 0, 0.3); 48 | color: #000; 49 | } 50 | 51 | *::selection { 52 | background: rgba(255, 255, 0, 0.3); 53 | color: #000; 54 | } 55 | 56 | a::-moz-selection { 57 | background: rgba(255, 255, 0, 0.3); 58 | color: #0645ad; 59 | } 60 | 61 | a::selection { 62 | background: rgba(255, 255, 0, 0.3); 63 | color: #0645ad; 64 | } 65 | 66 | p { 67 | margin: 1em 0; 68 | } 69 | 70 | img { 71 | max-width: 100%; 72 | } 73 | 74 | h1, h2, h3, h4, h5, h6 { 75 | color: #111; 76 | line-height: 125%; 77 | margin-top: 2em; 78 | font-weight: normal; 79 | } 80 | 81 | h4, h5, h6 { 82 | font-weight: bold; 83 | } 84 | 85 | h1 { 86 | font-size: 2.5em; 87 | } 88 | 89 | h2 { 90 | font-size: 2em; 91 | } 92 | 93 | h3 { 94 | font-size: 1.5em; 95 | } 96 | 97 | h4 { 98 | font-size: 1.2em; 99 | } 100 | 101 | h5 { 102 | font-size: 1em; 103 | } 104 | 105 | h6 { 106 | font-size: 0.9em; 107 | } 108 | 109 | blockquote { 110 | color: #666666; 111 | margin: 0; 112 | padding-left: 3em; 113 | border-left: 0.5em #EEE solid; 114 | } 115 | 116 | hr { 117 | display: block; 118 | height: 2px; 119 | border: 0; 120 | border-top: 1px solid #aaa; 121 | border-bottom: 1px solid #eee; 122 | margin: 1em 0; 123 | padding: 0; 124 | } 125 | 126 | pre, code, kbd, samp { 127 | color: #000; 128 | font-family: monospace, monospace; 129 | _font-family: 'courier new', monospace; 130 | font-size: 0.98em; 131 | } 132 | 133 | pre { 134 | white-space: pre; 135 | white-space: pre-wrap; 136 | word-wrap: break-word; 137 | } 138 | 139 | b, strong { 140 | font-weight: bold; 141 | } 142 | 143 | dfn { 144 | font-style: italic; 145 | } 146 | 147 | ins { 148 | background: #ff9; 149 | color: #000; 150 | text-decoration: none; 151 | } 152 | 153 | mark { 154 | background: #ff0; 155 | color: #000; 156 | font-style: italic; 157 | font-weight: bold; 158 | } 159 | 160 | sub, sup { 161 | font-size: 75%; 162 | line-height: 0; 163 | position: relative; 164 | vertical-align: baseline; 165 | } 166 | 167 | sup { 168 | top: -0.5em; 169 | } 170 | 171 | sub { 172 | bottom: -0.25em; 173 | } 174 | 175 | ul, ol { 176 | margin: 1em 0; 177 | padding: 0 0 0 2em; 178 | } 179 | 180 | li p:last-child { 181 | margin-bottom: 0; 182 | } 183 | 184 | ul ul, ol ol { 185 | margin: .3em 0; 186 | } 187 | 188 | dl { 189 | margin-bottom: 1em; 190 | } 191 | 192 | dt { 193 | font-weight: bold; 194 | margin-bottom: .8em; 195 | } 196 | 197 | dd { 198 | margin: 0 0 .8em 2em; 199 | } 200 | 201 | dd:last-child { 202 | margin-bottom: 0; 203 | } 204 | 205 | img { 206 | border: 0; 207 | -ms-interpolation-mode: bicubic; 208 | vertical-align: middle; 209 | } 210 | 211 | figure { 212 | display: block; 213 | text-align: center; 214 | margin: 1em 0; 215 | } 216 | 217 | figure img { 218 | border: none; 219 | margin: 0 auto; 220 | } 221 | 222 | figcaption { 223 | font-size: 0.8em; 224 | font-style: italic; 225 | margin: 0 0 .8em; 226 | } 227 | 228 | table { 229 | margin-bottom: 2em; 230 | border-bottom: 1px solid #ddd; 231 | border-right: 1px solid #ddd; 232 | border-spacing: 0; 233 | border-collapse: collapse; 234 | } 235 | 236 | table th { 237 | padding: .2em 1em; 238 | background-color: #eee; 239 | border-top: 1px solid #ddd; 240 | border-left: 1px solid #ddd; 241 | } 242 | 243 | table td { 244 | padding: .2em 1em; 245 | border-top: 1px solid #ddd; 246 | border-left: 1px solid #ddd; 247 | vertical-align: top; 248 | } 249 | 250 | table tr.even { 251 | background-color: #fbfbfb; 252 | } 253 | 254 | .author { 255 | font-size: 1.2em; 256 | text-align: center; 257 | } 258 | 259 | @media only screen and (min-width: 480px) { 260 | body { 261 | font-size: 14px; 262 | } 263 | } 264 | @media only screen and (min-width: 768px) { 265 | body { 266 | font-size: 16px; 267 | } 268 | } 269 | @media print { 270 | * { 271 | background: transparent !important; 272 | color: black !important; 273 | filter: none !important; 274 | -ms-filter: none !important; 275 | } 276 | 277 | body { 278 | font-size: 12pt; 279 | max-width: 100%; 280 | } 281 | 282 | a, a:visited { 283 | text-decoration: underline; 284 | } 285 | 286 | hr { 287 | height: 1px; 288 | border: 0; 289 | border-bottom: 1px solid black; 290 | } 291 | 292 | a[href]:after { 293 | content: " (" attr(href) ")"; 294 | } 295 | 296 | abbr[title]:after { 297 | content: " (" attr(title) ")"; 298 | } 299 | 300 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { 301 | content: ""; 302 | } 303 | 304 | pre, blockquote { 305 | border: 1px solid #999; 306 | padding-right: 1em; 307 | page-break-inside: avoid; 308 | } 309 | 310 | tr, img { 311 | page-break-inside: avoid; 312 | } 313 | 314 | img { 315 | max-width: 100% !important; 316 | } 317 | 318 | @page :left { 319 | margin: 15mm 20mm 15mm 10mm; 320 | } 321 | 322 | @page :right { 323 | margin: 15mm 10mm 15mm 20mm; 324 | } 325 | 326 | p, h2, h3 { 327 | orphans: 3; 328 | widows: 3; 329 | } 330 | 331 | h2, h3 { 332 | page-break-after: avoid; 333 | } 334 | } 335 | -------------------------------------------------------------------------------- /src-exe/CText.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | {-# LANGUAGE DeriveFunctor #-} 3 | {-# LANGUAGE OverloadedStrings #-} 4 | module CText ( 5 | -- * CText 6 | CText (..), 7 | CPiece (..), 8 | T (..), fromT, fromText, 9 | -- ** Colorify 10 | recolorify, colorifyText, colorifyStr, 11 | underline, emphasise, 12 | -- * CWriter 13 | CWriter, 14 | runCWriterIO, 15 | MonadCWriter (..), 16 | UseColors (..), 17 | UseAscii (..), 18 | -- * Underline 19 | haveUnderlineSupport, 20 | -- * Re-exports 21 | module System.Console.ANSI, 22 | ) where 23 | 24 | import Control.Monad (ap, unless) 25 | import Control.Monad.State.Strict (StateT) 26 | import Control.Monad.Trans.Class (lift) 27 | import Data.Foldable (for_) 28 | import qualified Data.List as L 29 | import Data.Monoid (Endo (..)) 30 | import Data.Semigroup (Semigroup (..)) 31 | import Data.String (IsString (..)) 32 | import qualified Data.Text as T 33 | import qualified Data.Text.IO as T 34 | import GHC.IO.Encoding.Types (textEncodingName) 35 | import System.Console.ANSI 36 | import System.IO (hGetEncoding, stdout) 37 | 38 | haveUnderlineSupport :: Bool 39 | #if defined(UNDERLINE_SUPPORT) 40 | haveUnderlineSupport = True 41 | #else 42 | haveUnderlineSupport = False 43 | #endif 44 | 45 | data CPiece = CPiece !T [SGR] 46 | deriving (Eq, Show) 47 | 48 | data T 49 | = T !T.Text 50 | | Vert -- vertical 51 | | Junc -- junction 52 | | Corn -- corner 53 | | Spac -- space 54 | | Rest -- "ellipsis" 55 | deriving (Eq, Show) 56 | 57 | newtype CText = CText [CPiece] 58 | deriving (Eq, Show) 59 | 60 | instance IsString CText where 61 | fromString s 62 | | null s = mempty 63 | | otherwise = CText [CPiece (T (fromString s)) []] 64 | 65 | instance Semigroup CText where 66 | CText xs <> CText ys = CText (xs <> ys) 67 | 68 | instance Monoid CText where 69 | mempty = CText [] 70 | mappend = (<>) 71 | 72 | fromText :: T.Text -> CText 73 | fromText t = CText [CPiece (T t) []] 74 | 75 | fromT :: T -> CText 76 | fromT t = CText [CPiece t []] 77 | 78 | colorifyStr :: Color -> String -> CText 79 | colorifyStr c t = CText [CPiece (T (T.pack t)) [SetColor Foreground Vivid c]] 80 | 81 | colorifyText :: Color -> T.Text -> CText 82 | colorifyText c t = CText [CPiece (T t) [SetColor Foreground Vivid c]] 83 | 84 | recolorify :: Color -> CText -> CText 85 | recolorify c (CText xs) = CText 86 | [ CPiece t (SetColor Foreground Vivid c : sgr) 87 | | CPiece t sgr' <- xs 88 | , let sgr = filter notSetColor sgr' 89 | ] 90 | where 91 | notSetColor SetColor {} = False 92 | notSetColor _ = True 93 | 94 | -- | We decide to bold, we could do something else to. 95 | emphasise :: CText -> CText 96 | emphasise (CText xs) = CText 97 | [ CPiece t (SetConsoleIntensity BoldIntensity : sgr) 98 | | CPiece t sgr <- xs 99 | ] 100 | 101 | underline :: CText -> CText 102 | underline (CText xs) | haveUnderlineSupport = CText 103 | [ CPiece t (SetUnderlining SingleUnderline : sgr) 104 | | CPiece t sgr <- xs 105 | ] 106 | underline x = x 107 | 108 | -- | Colored writer (list is lines) 109 | newtype CWriter a = CWriter { unCWriter :: Endo [CText] -> (Endo [CText], a) } 110 | deriving Functor 111 | 112 | class Monad m => MonadCWriter m where 113 | putCTextLn :: CText -> m () 114 | 115 | instance MonadCWriter CWriter where 116 | putCTextLn t = CWriter $ \l -> (l <> Endo (t :), ()) 117 | 118 | instance MonadCWriter m => MonadCWriter (StateT s m) where 119 | putCTextLn = lift . putCTextLn 120 | 121 | instance Applicative CWriter where 122 | pure = return 123 | (<*>) = ap 124 | 125 | instance Monad CWriter where 126 | return x = CWriter $ \ls -> (ls, x) 127 | 128 | m >>= k = CWriter $ \ls0 -> 129 | let (ls1, x) = unCWriter m ls0 130 | in unCWriter (k x) ls1 131 | 132 | data UseColors = ColorsNever | ColorsAuto | ColorsAlways 133 | deriving (Eq, Show) 134 | 135 | data UseAscii = UseAscii | UseUnicode | UseAsciiAuto 136 | deriving (Eq, Show) 137 | 138 | runCWriterIO :: UseColors -> UseAscii -> CWriter () -> IO () 139 | runCWriterIO ColorsNever useAscii m = do 140 | useAscii' <- shouldUseAscii useAscii 141 | runCWriterIONoColors useAscii' m 142 | runCWriterIO ColorsAlways useAscii m = do 143 | useAscii' <- shouldUseAscii useAscii 144 | runCWriterIOColors useAscii' m 145 | runCWriterIO ColorsAuto useAscii m = do 146 | useAscii' <- shouldUseAscii useAscii 147 | supports <- hSupportsANSIColor stdout 148 | if supports 149 | then runCWriterIOColors useAscii' m 150 | else runCWriterIONoColors useAscii' m 151 | 152 | -- TODO: check environment variables? 153 | shouldUseAscii :: UseAscii -> IO Bool 154 | shouldUseAscii UseAscii = return True 155 | shouldUseAscii UseUnicode = return False 156 | shouldUseAscii UseAsciiAuto = do 157 | e <- hGetEncoding stdout 158 | return $ not $ fmap (L.isPrefixOf "UTF" . textEncodingName) e == Just True 159 | 160 | putT :: Bool -> T -> IO () 161 | putT _ (T t) = T.putStr t 162 | -- https://en.wikipedia.org/wiki/Box-drawing_character 163 | putT False Vert = T.putStr " \x2502 " 164 | putT False Junc = T.putStr " \x251c\x2500 " 165 | putT False Corn = T.putStr " \x2514\x2500 " 166 | putT False Rest = T.putStr " \x2504\x2504" 167 | -- ascii 168 | putT True Vert = T.putStr " | " 169 | putT True Junc = T.putStr " +- " 170 | putT True Corn = T.putStr " +- " 171 | putT True Rest = T.putStr " ..." 172 | -- space is just space 173 | putT _ Spac = T.putStr " " 174 | 175 | runCWriterIOColors :: Bool -> CWriter () -> IO () 176 | runCWriterIOColors useAscii (CWriter f) = 177 | for_ (appEndo (fst (f mempty)) []) $ \(CText l) -> do 178 | for_ l $ \(CPiece t sgr) -> do 179 | unless (null sgr) $ setSGR sgr 180 | putT useAscii t 181 | unless (null sgr) $ setSGR [] 182 | putChar '\n' 183 | 184 | runCWriterIONoColors :: Bool -> CWriter () -> IO () 185 | runCWriterIONoColors useAscii (CWriter f) = 186 | for_ (appEndo (fst (f mempty)) []) $ \(CText l) -> do 187 | for_ l $ \(CPiece t _) -> putT useAscii t 188 | putChar '\n' 189 | -------------------------------------------------------------------------------- /src-exe/Flag.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE KindSignatures, DataKinds #-} 2 | {-# LANGUAGE FunctionalDependencies, FlexibleContexts #-} 3 | {-# LANGUAGE ScopedTypeVariables #-} 4 | -- | Because 'Flag' constructor isn't exposed, 5 | -- we have to explicitly 'toFlag' and 'fromFlag'. 6 | -- That way it's less likely we mix up bare Booleans. 7 | module Flag ( 8 | -- * Flag 9 | Flag, toFlag, fromFlag, 10 | -- * HasDefault 11 | HasDefault, 12 | -- * optparse-applicative 13 | showHide, 14 | switchM, 15 | ) where 16 | 17 | import Control.Applicative ((<|>)) 18 | import Data.Semigroup (Semigroup (..)) 19 | import Data.Singletons.Bool 20 | import qualified Options.Applicative as O 21 | 22 | ------------------------------------------------------------------------------- 23 | -- Flag 24 | ------------------------------------------------------------------------------- 25 | 26 | newtype Flag t = Flag Bool 27 | 28 | toFlag :: t -> Bool -> Flag t 29 | toFlag _ = Flag 30 | 31 | fromFlag :: t -> Flag t -> Bool 32 | fromFlag _ (Flag b) = b 33 | 34 | ------------------------------------------------------------------------------- 35 | -- HasDefault 36 | ------------------------------------------------------------------------------- 37 | 38 | -- | Default value. 39 | -- 40 | -- With 'DeriveAnyClass' one could write 41 | -- 42 | -- @ 43 | -- data MyOpt = MyOpt deriving (HasDefault 'True) 44 | -- @ 45 | -- 46 | class SBoolI def => HasDefault (def :: Bool) t | t -> def 47 | 48 | def :: forall t def. HasDefault def t => t -> Flag t 49 | def t = toFlag t (reflectBool (P :: P def)) 50 | 51 | data P (def :: Bool) = P 52 | 53 | ------------------------------------------------------------------------------- 54 | -- optparse-applicative 55 | ------------------------------------------------------------------------------- 56 | 57 | showHide :: HasDefault def t => t -> String -> String -> O.Parser (Flag t) 58 | showHide t n d = 59 | O.flag' (toFlag t True) (O.long ("show-" ++ n) Data.Semigroup.<> O.help d) 60 | <|> O.flag' (toFlag t False) (O.long ("hide-" ++ n)) 61 | <|> pure (def t) 62 | 63 | switchM :: HasDefault 'False t => t -> String -> String -> O.Parser (Flag t) 64 | switchM t n d = fmap (toFlag t) $ O.switch $ O.long n <> d' where 65 | d' | null d = mempty 66 | | otherwise = O.help d 67 | -------------------------------------------------------------------------------- /src-exe/LicenseReport.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | {-# LANGUAGE OverloadedStrings #-} 3 | {-# LANGUAGE RecordWildCards #-} 4 | 5 | -- | SPDX-License-Identifier: GPL-2.0-or-later 6 | -- 7 | -- Implements @cabal-plan license-report@ functionality 8 | module LicenseReport 9 | ( generateLicenseReport 10 | ) where 11 | 12 | #if defined(MIN_VERSION_Cabal_syntax) 13 | import Cabal.Plan 14 | import qualified Codec.Archive.Tar as Tar 15 | import qualified Codec.Archive.Tar.Entry as Tar 16 | import qualified Codec.Compression.GZip as GZip 17 | import Control.Monad (forM, forM_, guard, unless, when) 18 | import qualified Data.ByteString.Lazy as BSL 19 | import qualified Data.ByteString as BS 20 | import Data.Functor.Identity (Identity (..)) 21 | import Data.Map (Map) 22 | import Data.List (nub) 23 | import qualified Data.Map as Map 24 | import Data.Semigroup 25 | import Data.Set (Set) 26 | import qualified Data.Set as Set 27 | import qualified Data.Text as T 28 | import qualified Data.Text.IO as T 29 | import qualified Data.Version as DV 30 | import Distribution.PackageDescription 31 | import Distribution.PackageDescription.Parsec 32 | import Distribution.Utils.Path 33 | import Distribution.Pretty 34 | import System.Directory 35 | import System.FilePath 36 | import System.IO (stderr) 37 | import Text.ParserCombinators.ReadP 38 | 39 | import Cabal.Config (readConfig, Config (..), cfgRepoIndex, hackageHaskellOrg) 40 | 41 | import Distribution.Utils.ShortText (fromShortText) 42 | 43 | -- | Read tarball lazily (and possibly decompress) 44 | readTarEntries :: FilePath -> IO [Tar.Entry] 45 | readTarEntries idxtar = do 46 | es <- case takeExtension idxtar of 47 | ".gz" -> Tar.read . GZip.decompress <$> BSL.readFile idxtar 48 | ".tar" -> Tar.read <$> BSL.readFile idxtar 49 | ext -> error ("unknown extension " ++ show ext) 50 | 51 | return (Tar.foldEntries (:) [] (\err -> error ("readTarEntries " ++ show err)) es) 52 | 53 | fp2pid :: FilePath -> Maybe PkgId 54 | fp2pid fn0 = do 55 | [pns,pvs,rest] <- Just (splitDirectories fn0) 56 | guard (rest == pns <.> "cabal") 57 | pv <- parseVer pvs 58 | pure (PkgId (PkgName $ T.pack pns) pv) 59 | 60 | 61 | parseVer :: String -> Maybe Ver 62 | parseVer str = case reverse $ readP_to_S DV.parseVersion str of 63 | (ver, "") : _ | not (null (DV.versionBranch ver)), all (>= 0) (DV.versionBranch ver) 64 | -> Just (Ver $ DV.versionBranch ver) 65 | _ -> Nothing 66 | 67 | 68 | readHackageIndex :: FilePath -> IO [(PkgId, BSL.ByteString)] 69 | readHackageIndex indexPath = do 70 | -- TODO: expose package index configuration as CLI flag 71 | ents <- readTarEntries indexPath 72 | 73 | pure [ (maybe (error $ show n) id $ fp2pid n,bsl) 74 | | e@(Tar.Entry { Tar.entryContent = Tar.NormalFile bsl _ }) <- ents 75 | , let n = Tar.entryPath e 76 | , takeExtension n == ".cabal" 77 | ] 78 | 79 | getLicenseFiles :: FilePath -> PkgId -> UnitId -> [FilePath] -> IO [BS.ByteString] 80 | getLicenseFiles storeDir compilerId (UnitId uidt) fns = do 81 | let docDir = storeDir T.unpack (dispPkgId compilerId) T.unpack uidt "share" "doc" 82 | forM fns $ \fn -> BS.readFile (docDir fn) 83 | 84 | {- WARNING: the code that follows will make you cry; a safety pig is provided below for your benefit. 85 | 86 | _ 87 | _._ _..._ .-', _.._(`)) 88 | '-. ` ' /-._.-' ',/ 89 | ) \ '. 90 | / _ _ | \ 91 | | a a / | 92 | \ .-. ; 93 | '-('' ).-' ,' ; 94 | '-; | .' 95 | \ \ / 96 | | 7 .__ _.-\ \ 97 | | | | ``/ /` / 98 | /,_| | /,_/ / 99 | /,_/ '`-' 100 | 101 | -} 102 | 103 | -- TODO: emit report to Text or Text builder 104 | generateLicenseReport :: Maybe FilePath -> PlanJson -> UnitId -> CompName -> IO () 105 | generateLicenseReport mlicdir plan uid0 cn0 = do 106 | -- find and read ~/.cabal/config 107 | cfg <- readConfig 108 | indexPath <- maybe (fail "No hackage.haskell.org repository") return $ cfgRepoIndex cfg hackageHaskellOrg 109 | let storeDir = runIdentity (cfgStoreDir cfg) 110 | 111 | let pidsOfInterest = Set.fromList (map uPId (Map.elems $ pjUnits plan)) 112 | 113 | indexDb <- Map.fromList . filter (flip Set.member pidsOfInterest . fst) <$> readHackageIndex indexPath 114 | 115 | let -- generally, units belonging to the same package as 'root' 116 | rootPkgUnits = [ u | u@(Unit { uPId = PkgId pn' _ }) <- Map.elems (pjUnits plan), pn' == pn0 ] 117 | rootPkgUnitIds = Set.fromList (map uId rootPkgUnits) 118 | 119 | -- the component of interest 120 | Just root@Unit { uPId = PkgId pn0 _ } = Map.lookup uid0 (pjUnits plan) 121 | 122 | fwdDeps = planJsonIdGraph' plan 123 | revDeps = invertMap fwdDeps 124 | 125 | let transUids = transDeps fwdDeps (uId root) Set.\\ rootPkgUnitIds 126 | 127 | indirectDeps = Set.fromList [ u | u <- Set.toList transUids, Set.null (Map.findWithDefault mempty u revDeps `Set.intersection` rootPkgUnitIds) ] 128 | 129 | directDeps = transUids Set.\\ indirectDeps 130 | 131 | 132 | let printInfo :: UnitId -> IO () 133 | printInfo uid = do 134 | let Just u = Map.lookup uid (pjUnits plan) 135 | 136 | PkgId (PkgName pn) pv = uPId u 137 | isB = uType u == UnitTypeBuiltin 138 | url = "http://hackage.haskell.org/package/" <> dispPkgId (uPId u) 139 | 140 | -- special core libs whose reverse deps are too noisy 141 | baseLibs = ["base", "ghc-prim", "integer-gmp", "integer-simple", "rts"] 142 | 143 | usedBy = Set.fromList [ uPId (Map.findWithDefault undefined unit (pjUnits plan)) 144 | | unit <- Set.toList (Map.findWithDefault mempty uid revDeps) 145 | , unit `Set.member` (directDeps <> indirectDeps) 146 | ] 147 | 148 | case BSL.toStrict <$> Map.lookup (uPId u) indexDb of 149 | Nothing 150 | | PkgId (PkgName "rts") _ <- uPId u -> pure () 151 | | otherwise -> do 152 | -- not found in index -- fail gracefully 153 | T.hPutStrLn stderr ("WARNING: couldn't find metadata for " <> dispPkgId (uPId u)) 154 | 155 | T.putStrLn $ mconcat 156 | [ if isB then "| **`" else "| `", pn, if isB then "`** | [`" else "` | [`", dispVer pv, "`](", url , ")", " | " 157 | , " *MISSING* | *MISSING* | " 158 | , if pn `elem` baseLibs then "*(core library)*" 159 | else T.intercalate ", " [ T.singleton '`' <> (j :: T.Text) <> "`" | PkgId (z@(PkgName j)) _ <- Set.toList usedBy, z /= pn0], " |" 160 | ] 161 | 162 | Just x -> do 163 | gpd <- maybe (fail "parseGenericPackageDescriptionMaybe") pure $ 164 | parseGenericPackageDescriptionMaybe x 165 | 166 | let desc = escapeDesc 167 | $ fromShortText 168 | $ synopsis $ packageDescription gpd 169 | lic = license $ packageDescription gpd 170 | -- cr = copyright $ packageDescription gpd 171 | lfs = licenseFiles $ packageDescription gpd 172 | 173 | 174 | let 175 | 176 | licurl = case lfs of 177 | [] -> url 178 | (l:_) 179 | | Just licdir <- mlicdir, uType u == UnitTypeGlobal -> T.pack (licdir T.unpack (dispPkgId (uPId u)) takeFileName (getSymbolicPath l)) 180 | | otherwise -> url <> "/src/" <> T.pack (getSymbolicPath l) 181 | 182 | T.putStrLn $ mconcat 183 | [ if isB then "| **`" else "| `", pn, if isB then "`** | [`" else "` | [`", dispVer pv, "`](", url , ")", " | " 184 | , "[`", T.pack (prettyShow lic), "`](", licurl , ")", " | " 185 | , T.pack desc, " | " 186 | , if pn `elem` baseLibs then "*(core library)*" 187 | else T.intercalate ", " [ T.singleton '`' <> (j :: T.Text) <> "`" | PkgId (z@(PkgName j)) _ <- Set.toList usedBy, z /= pn0], " |" 188 | ] 189 | 190 | -- print (pn, pv, prettyShow lic, cr, lfs, [ j | PkgId (PkgName j) _ <- Set.toList usedBy ]) 191 | 192 | forM_ mlicdir $ \licdir -> do 193 | 194 | case uType u of 195 | UnitTypeGlobal -> do 196 | let lfs' = nub (map (takeFileName . getSymbolicPath) lfs) 197 | 198 | when (length lfs' /= length lfs) $ do 199 | T.hPutStrLn stderr ("WARNING: Overlapping license filenames for " <> dispPkgId (uPId u)) 200 | 201 | crdat <- getLicenseFiles storeDir (pjCompilerId plan) uid lfs' 202 | 203 | forM_ (zip lfs' crdat) $ \(fn,txt) -> do 204 | let d = licdir T.unpack (dispPkgId (uPId u)) 205 | createDirectoryIfMissing True d 206 | BS.writeFile (d fn) txt 207 | 208 | -- forM_ crdat $ print 209 | pure () 210 | 211 | -- TODO: 212 | -- UnitTypeBuiltin 213 | -- UnitTypeLocal 214 | -- UnitTypeInplace 215 | 216 | UnitTypeBuiltin -> T.hPutStrLn stderr ("WARNING: license files for " <> dispPkgId (uPId u) <> " (global/GHC bundled) not copied") 217 | UnitTypeLocal -> T.hPutStrLn stderr ("WARNING: license files for " <> dispPkgId (uPId u) <> " (project-local package) not copied") 218 | UnitTypeInplace -> T.hPutStrLn stderr ("WARNING: license files for " <> dispPkgId (uPId u) <> " (project-inplace package) not copied") 219 | 220 | unless (length lfs == Set.size (Set.fromList lfs)) $ 221 | fail ("internal invariant broken for " <> show (uPId u)) 222 | 223 | pure () 224 | 225 | T.putStrLn "# Dependency License Report" 226 | T.putStrLn "" 227 | T.putStrLn ("Bold-faced **`package-name`**s denote standard libraries bundled with `" <> dispPkgId (pjCompilerId plan) <> "`.") 228 | T.putStrLn "" 229 | 230 | T.putStrLn ("## Direct dependencies of `" <> unPkgN pn0 <> ":" <> dispCompNameTarget pn0 cn0 <> "`") 231 | T.putStrLn "" 232 | T.putStrLn "| Name | Version | [SPDX](https://spdx.org/licenses/) License Id | Description | Also depended upon by |" 233 | T.putStrLn "| --- | --- | --- | --- | --- |" 234 | forM_ directDeps $ printInfo 235 | T.putStrLn "" 236 | 237 | T.putStrLn "## Indirect transitive dependencies" 238 | T.putStrLn "" 239 | T.putStrLn "| Name | Version | [SPDX](https://spdx.org/licenses/) License Id | Description | Depended upon by |" 240 | T.putStrLn "| --- | --- | --- | --- | --- |" 241 | forM_ indirectDeps $ printInfo 242 | T.putStrLn "" 243 | 244 | pure () 245 | 246 | escapeDesc :: String -> String 247 | escapeDesc [] = [] 248 | escapeDesc ('\n':rest) = ' ':escapeDesc rest 249 | escapeDesc ('|':rest) = '\\':'|':escapeDesc rest 250 | escapeDesc (x:xs) = x:escapeDesc xs 251 | 252 | unPkgN :: PkgName -> T.Text 253 | unPkgN (PkgName t) = t 254 | 255 | planItemAllLibDeps :: Unit -> Set.Set UnitId 256 | planItemAllLibDeps Unit{..} = mconcat [ ciLibDeps | (cn,CompInfo{..}) <- Map.toList uComps, wantC cn ] 257 | where 258 | wantC (CompNameSetup) = False 259 | wantC (CompNameTest _) = False 260 | wantC (CompNameBench _) = False 261 | wantC _ = True 262 | 263 | planJsonIdGraph':: PlanJson -> Map UnitId (Set UnitId) 264 | planJsonIdGraph' PlanJson{..} = Map.fromList [ (uId unit, planItemAllLibDeps unit) | unit <- Map.elems pjUnits ] 265 | 266 | 267 | 268 | invertMap :: Ord k => Map k (Set k) -> Map k (Set k) 269 | invertMap m0 = Map.fromListWith mappend [ (v, Set.singleton k) | (k,vs) <- Map.toList m0, v <- Set.toList vs ] 270 | 271 | transDeps :: Map UnitId (Set UnitId) -> UnitId -> Set UnitId 272 | transDeps g n0 = go mempty [n0] 273 | where 274 | go :: Set UnitId -> [UnitId] -> Set UnitId 275 | go acc [] = acc 276 | go acc (n:ns) 277 | | Set.member n acc = go acc ns 278 | | otherwise = go (Set.insert n acc) (ns ++ Set.toList (Map.findWithDefault undefined n g)) 279 | 280 | #else 281 | 282 | ---------------------------------------------------------------------------- 283 | import Cabal.Plan 284 | import System.Exit 285 | import System.IO 286 | 287 | generateLicenseReport :: Maybe FilePath -> PlanJson -> UnitId -> CompName -> IO () 288 | generateLicenseReport _ _ _ _ = do 289 | hPutStrLn stderr "ERROR: `cabal-plan license-report` sub-command not available! Please recompile/reinstall `cabal-plan` with the `license-report` Cabal flag activated." 290 | exitFailure 291 | 292 | #endif 293 | -------------------------------------------------------------------------------- /src-exe/ProcessLazyByteString.hs: -------------------------------------------------------------------------------- 1 | module ProcessLazyByteString (readProcessWithExitCode) where 2 | 3 | import Control.Concurrent.Async (wait, withAsync) 4 | import qualified Control.Exception as E 5 | import Control.Monad (unless) 6 | import qualified Data.ByteString as BS 7 | import qualified Data.ByteString.Lazy.Internal as LBS (ByteString (..), 8 | defaultChunkSize) 9 | import Foreign.C.Error (Errno (..), ePIPE) 10 | import qualified GHC.IO.Exception as GHC 11 | import System.Exit (ExitCode) 12 | import System.IO (Handle, hClose) 13 | import qualified System.Process as Proc 14 | 15 | readProcessWithExitCode 16 | :: String -- ^ Command 17 | -> [String] -- ^ Arguments 18 | -> BS.ByteString -- ^ Stdin 19 | -> IO (ExitCode, LBS.ByteString, LBS.ByteString) 20 | readProcessWithExitCode cmd args = readProcessImpl (Proc.proc cmd args) 21 | 22 | readProcessImpl 23 | :: Proc.CreateProcess 24 | -> BS.ByteString 25 | -> IO (ExitCode, LBS.ByteString, LBS.ByteString) 26 | readProcessImpl cp input = 27 | Proc.withCreateProcess cp' $ \mi mo me ph -> case (mi, mo, me) of 28 | (Just inh, Just outh, Just errh) -> 29 | -- spawn workers to read stdout and stderr 30 | withAsync (getLBSContents outh) $ \outA -> 31 | withAsync (getLBSContents errh) $ \errA -> do 32 | -- write the input 33 | unless (BS.null input) $ BS.hPutStr inh input 34 | ignoreSigPipe $ hClose inh 35 | 36 | -- wait for the output 37 | out <- wait outA 38 | err <- wait errA 39 | 40 | -- wait for the process 41 | ec <- Proc.waitForProcess ph 42 | 43 | return (ec, out, err) 44 | 45 | (Nothing,_,_) -> fail "readProcessWithExitCode: Failed to get a stdin handle." 46 | (_,Nothing,_) -> fail "readProcessWithExitCode: Failed to get a stdout handle." 47 | (_,_,Nothing) -> fail "readProcessWithExitCode: Failed to get a stderr handle." 48 | 49 | where 50 | cp' :: Proc.CreateProcess 51 | cp' = cp 52 | { Proc.std_in = Proc.CreatePipe 53 | , Proc.std_out = Proc.CreatePipe 54 | , Proc.std_err = Proc.CreatePipe 55 | } 56 | 57 | ignoreSigPipe :: IO () -> IO () 58 | ignoreSigPipe = E.handle $ \e -> case e of 59 | GHC.IOError { GHC.ioe_type = GHC.ResourceVanished, GHC.ioe_errno = Just ioe } 60 | | Errno ioe == ePIPE -> return () 61 | _ -> E.throwIO e 62 | 63 | getLBSContents :: Handle -> IO LBS.ByteString 64 | getLBSContents = hGetContentsN LBS.defaultChunkSize 65 | 66 | -- No unsafeInterleaveIO 67 | hGetContentsN :: Int -> Handle -> IO LBS.ByteString 68 | hGetContentsN k h = loop `E.finally` hClose h where 69 | loop = do 70 | c <- BS.hGetSome h k -- only blocks if there is no data available 71 | if BS.null c 72 | then return LBS.Empty 73 | else LBS.Chunk c <$> loop 74 | -------------------------------------------------------------------------------- /src/Cabal/Plan.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} 3 | {-# LANGUAGE OverloadedStrings #-} 4 | {-# LANGUAGE RecordWildCards #-} 5 | 6 | -- | SPDX-License-Identifier: GPL-2.0-or-later 7 | -- 8 | -- Utilities for reading @cabal@'s @plan.json@ file 9 | -- 10 | -- @plan.json@ are generated when using @cabal@ 11 | -- . 12 | module Cabal.Plan 13 | ( 14 | PlanJson(..) 15 | , Unit(..) 16 | , CompName(..) 17 | , dispCompName 18 | , dispCompNameTarget 19 | , CompInfo(..) 20 | , UnitType(..) 21 | 22 | -- * Basic types 23 | , Ver(..) 24 | , dispVer 25 | , PkgName(..) 26 | , PkgId(..) 27 | , dispPkgId 28 | , UnitId(..) 29 | , FlagName(..) 30 | 31 | -- ** SHA-256 32 | , Sha256 33 | , dispSha256 34 | , parseSha256 35 | , sha256ToByteString 36 | , sha256FromByteString 37 | 38 | -- ** PkgLoc 39 | , PkgLoc(..) 40 | , Repo(..) 41 | , SourceRepo(..) 42 | , URI(..) 43 | , RepoType(..) 44 | 45 | -- * Utilities 46 | , planJsonIdGraph 47 | , planJsonIdRoots 48 | 49 | -- * Convenience functions 50 | , SearchPlanJson(..) 51 | , findAndDecodePlanJson 52 | , findPlanJson 53 | , findProjectRoot 54 | , decodePlanJson 55 | ) where 56 | 57 | import Control.Applicative as App 58 | import Control.Monad 59 | import Data.Aeson 60 | #if MIN_VERSION_aeson(2,0,0) 61 | import qualified Data.Aeson.Key as AK 62 | #endif 63 | import Data.Aeson.Types 64 | import qualified Data.ByteString as B 65 | import qualified Data.ByteString.Base16 as B16 66 | import Data.List 67 | import Data.Map (Map) 68 | import qualified Data.Map as M 69 | import Data.Monoid 70 | import Data.Set (Set) 71 | import qualified Data.Set as S 72 | import Data.Text (Text) 73 | import qualified Data.Text as T 74 | import qualified Data.Text.Encoding as T 75 | import qualified Data.Version as DV 76 | import qualified System.Directory as Dir 77 | import System.FilePath 78 | ((), takeExtension, isDrive, takeDirectory) 79 | import Text.ParserCombinators.ReadP 80 | 81 | ---------------------------------------------------------------------------- 82 | 83 | -- | Equivalent to @Cabal@'s @Distribution.Package.Version@ 84 | newtype Ver = Ver [Int] 85 | deriving (Show,Eq,Ord) 86 | 87 | -- | Equivalent to @Cabal@'s @Distribution.Package.UnitId@ 88 | newtype UnitId = UnitId Text 89 | deriving (Show,Eq,Ord,FromJSON,ToJSON,FromJSONKey,ToJSONKey) 90 | 91 | -- | Equivalent to @Cabal@'s @Distribution.Package.PackageName@ 92 | newtype PkgName = PkgName Text 93 | deriving (Show,Eq,Ord,FromJSON,ToJSON,FromJSONKey,ToJSONKey) 94 | 95 | -- | Equivalent to @Cabal@'s @Distribution.Package.PackageIdentifier@ 96 | data PkgId = PkgId !PkgName !Ver 97 | deriving (Show,Eq,Ord) 98 | 99 | -- | Equivalent to @Cabal@'s @Distribution.PackageDescription.FlagName@ 100 | -- 101 | -- @since 0.3.0.0 102 | newtype FlagName = FlagName Text 103 | deriving (Show,Eq,Ord,FromJSON,ToJSON,FromJSONKey,ToJSONKey) 104 | 105 | -- | hash 106 | newtype Sha256 = Sha256 B.ByteString -- internal invariant: exactly 32 bytes long 107 | deriving (Eq,Ord) 108 | -- | Equivalent to @Cabal@\'s @Distribution.Client.Types.PackageLocation@ 109 | -- 110 | -- @since 0.5.0.0 111 | data PkgLoc 112 | = LocalUnpackedPackage !FilePath 113 | | LocalTarballPackage !FilePath 114 | | RemoteTarballPackage !URI 115 | | RepoTarballPackage !Repo 116 | | RemoteSourceRepoPackage !SourceRepo 117 | deriving (Show,Eq,Ord) 118 | 119 | -- | Equivalent to @Cabal@\'s @Distribution.Types.SourceRepo@ 120 | -- 121 | -- @since 0.5.0.0 122 | data Repo 123 | = RepoLocal !FilePath 124 | | RepoRemote !URI 125 | | RepoSecure !URI 126 | | RepoLocalNoIndex !FilePath 127 | deriving (Show,Eq,Ord) 128 | 129 | -- | Equivalent to @Cabal@\'s @Distribution.Client.Types.Repo@ 130 | -- 131 | -- @since 0.5.0.0 132 | data SourceRepo = SourceRepo 133 | { srType :: !(Maybe RepoType) 134 | , srLocation :: !(Maybe Text) 135 | , srModule :: !(Maybe Text) 136 | , srBranch :: !(Maybe Text) 137 | , srTag :: !(Maybe Text) 138 | , srSubdir :: !(Maybe FilePath) 139 | } deriving (Show,Eq,Ord) 140 | 141 | -- | Represents an URI (used e.g. by 'Repo') 142 | -- 143 | -- @since 0.5.0.0 144 | newtype URI = URI Text 145 | deriving (Show,Eq,Ord,FromJSON,ToJSON,FromJSONKey,ToJSONKey) 146 | 147 | -- | Equivalent to @Cabal@\'s @Distribution.Client.SourceRepo.RepoType@ 148 | -- 149 | -- @since 0.5.0.0 150 | data RepoType 151 | = Darcs 152 | | Git 153 | | SVN 154 | | CVS 155 | | Mercurial 156 | | GnuArch 157 | | Bazaar 158 | | Monotone 159 | | OtherRepoType Text 160 | deriving (Show,Eq,Ord) 161 | 162 | -- | Represents the information contained in cabal's @plan.json@ file. 163 | -- 164 | -- This comprises basic information describing the environment as well 165 | -- as the install/build plan computed by @cabal@. 166 | data PlanJson = PlanJson 167 | { pjCabalVersion :: !Ver -- ^ Version of @cabal@ frontend 168 | , pjCabalLibVersion :: !Ver -- ^ Version of Cabal library 169 | , pjCompilerId :: !PkgId -- ^ Name and version of Haskell compiler 170 | , pjArch :: !Text -- ^ Architecture name 171 | , pjOs :: !Text -- ^ Operating system name 172 | , pjUnits :: !(M.Map UnitId Unit) -- ^ install/build plan 173 | } deriving Show 174 | 175 | -- | Describes kind of build unit and its provenance 176 | data UnitType = UnitTypeBuiltin -- ^ Lives in global (non-nix-style) package db 177 | | UnitTypeGlobal -- ^ Lives in Nix-store cache 178 | | UnitTypeLocal -- ^ Local package 179 | | UnitTypeInplace -- ^ Local in-place package 180 | deriving (Show,Eq) 181 | 182 | -- | Represents a build-plan unit uniquely identified by its 'UnitId' 183 | data Unit = Unit 184 | { uId :: !UnitId -- ^ Unit ID uniquely identifying a 'Unit' in install plan 185 | , uPId :: !PkgId -- ^ Package name and version (not necessarily unique within plan) 186 | , uType :: !UnitType -- ^ Describes type of build item, see 'UnitType' 187 | , uSha256 :: !(Maybe Sha256) -- ^ SHA256 source tarball checksum (as used by e.g. @hackage-security@) 188 | , uCabalSha256 :: !(Maybe Sha256) -- ^ SHA256 package description metadata checksum 189 | -- 190 | -- In other words, the checksum of the @.cabal@ file that was used as input to the build planning 191 | -- 192 | -- __NOTE__: This meta-information is available only for 'pjCabalVersion' >= 2.4.1.0 193 | -- 194 | -- @since 0.5.0.0 195 | , uComps :: !(Map CompName CompInfo) -- ^ Components identified by 'UnitId' 196 | -- 197 | -- When @cabal@ needs to fall back to legacy-mode (currently for 198 | -- @custom@ build-types or obsolete @cabal-version@ values), 'uComps' 199 | -- may contain more than one element. 200 | , uFlags :: !(Map FlagName Bool) -- ^ cabal flag settings (not available for 'UnitTypeBuiltin') 201 | , uDistDir :: !(Maybe FilePath) -- ^ In-place dist-dir (if available) 202 | -- 203 | -- @since 0.3.0.0 204 | , uPkgSrc :: !(Maybe PkgLoc) 205 | -- ^ Source of the package 206 | -- 207 | -- __NOTE__: This meta-information is available only for 'pjCabalVersion' >= 2.4.0.0 208 | -- 209 | -- @since 0.5.0.0 210 | } deriving Show 211 | 212 | -- | Component name inside a build-plan unit 213 | -- 214 | -- A similiar type exists in @Cabal@ codebase, see 215 | -- @Distribution.Simple.LocalBuildInfo.ComponentName@ 216 | data CompName = 217 | CompNameLib 218 | | CompNameSubLib !Text 219 | | CompNameFLib !Text -- ^ @since 0.3.0.0 220 | | CompNameExe !Text 221 | | CompNameTest !Text 222 | | CompNameBench !Text 223 | | CompNameSetup 224 | deriving (Show, Eq, Ord) 225 | 226 | -- | Describes component-specific information inside a 'Unit' 227 | data CompInfo = CompInfo 228 | { ciLibDeps :: Set UnitId -- ^ library dependencies 229 | , ciExeDeps :: Set UnitId -- ^ executable dependencies 230 | , ciBinFile :: Maybe FilePath -- ^ path-name of artifact if available 231 | } deriving Show 232 | 233 | ---------------------------------------------------------------------------- 234 | ---------------------------------------------------------------------------- 235 | ---------------------------------------------------------------------------- 236 | 237 | -- JSON instances 238 | 239 | instance FromJSON CompName where 240 | parseJSON = withText "CompName" (maybe (fail "invalid CompName") pure . parseCompName) 241 | 242 | instance ToJSON CompName where 243 | toJSON = toJSON . dispCompName 244 | 245 | instance FromJSONKey CompName where 246 | fromJSONKey = FromJSONKeyTextParser (maybe (fail "CompName") pure . parseCompName) 247 | 248 | instance ToJSONKey CompName where 249 | toJSONKey = toJSONKeyText dispCompName 250 | 251 | ---- 252 | 253 | instance FromJSON CompInfo where 254 | parseJSON = withObject "CompInfo" $ \o -> 255 | CompInfo <$> o .:?! "depends" 256 | <*> o .:?! "exe-depends" 257 | <*> o .:? "bin-file" 258 | 259 | ---- 260 | 261 | instance FromJSON PkgId where 262 | parseJSON = withText "PkgId" (maybe (fail "invalid PkgId") pure . parsePkgId) 263 | 264 | instance ToJSON PkgId where 265 | toJSON = toJSON . dispPkgId 266 | 267 | instance FromJSONKey PkgId where 268 | fromJSONKey = FromJSONKeyTextParser (maybe (fail "PkgId") pure . parsePkgId) 269 | 270 | instance ToJSONKey PkgId where 271 | toJSONKey = toJSONKeyText dispPkgId 272 | 273 | ---- 274 | 275 | instance FromJSON PkgLoc where 276 | parseJSON = withObject "PkgSrc" $ \o -> do 277 | ty <- o .: "type" 278 | case ty :: Text of 279 | "local" -> LocalUnpackedPackage <$> o .: "path" 280 | "local-tar" -> LocalTarballPackage <$> o .: "path" 281 | "remote-tar" -> RemoteTarballPackage <$> o .: "uri" 282 | "repo-tar" -> RepoTarballPackage <$> o .: "repo" 283 | "source-repo" -> RemoteSourceRepoPackage <$> o .: "source-repo" 284 | _ -> fail "invalid PkgSrc \"type\"" 285 | 286 | instance FromJSON Repo where 287 | parseJSON = withObject "Repo" $ \o -> do 288 | ty <- o .: "type" 289 | case ty :: Text of 290 | "local-repo" -> RepoLocal <$> o .: "path" 291 | "remote-repo" -> RepoRemote <$> o .: "uri" 292 | "secure-repo" -> RepoSecure <$> o .: "uri" 293 | "local-repo-no-index" -> RepoLocalNoIndex <$> o .: "path" 294 | _ -> fail "invalid Repo \"type\"" 295 | 296 | instance FromJSON SourceRepo where 297 | parseJSON = withObject "SourceRepo" $ \o -> do 298 | SourceRepo <$> o .:? "type" 299 | <*> o .:? "location" 300 | <*> o .:? "module" 301 | <*> o .:? "branch" 302 | <*> o .:? "tag" 303 | <*> o .:? "subdir" 304 | 305 | instance FromJSON RepoType where 306 | parseJSON = withText "RepoType" $ \ty -> return $ 307 | case ty of 308 | "darcs" -> Darcs 309 | "git" -> Git 310 | "svn" -> SVN 311 | "cvs" -> CVS 312 | "mercurial" -> Mercurial 313 | "gnuarch" -> GnuArch 314 | "bazaar" -> Bazaar 315 | "monotone" -> Monotone 316 | _ -> OtherRepoType ty 317 | 318 | ---------------------------------------------------------------------------- 319 | -- parser helpers 320 | 321 | parseCompName :: Text -> Maybe CompName 322 | parseCompName t0 = case T.splitOn ":" t0 of 323 | ["lib"] -> Just CompNameLib 324 | ["lib",n] -> Just $! CompNameSubLib n 325 | ["flib",n] -> Just $! CompNameFLib n 326 | ["exe",n] -> Just $! CompNameExe n 327 | ["bench",n] -> Just $! CompNameBench n 328 | ["test",n] -> Just $! CompNameTest n 329 | ["setup"] -> Just CompNameSetup 330 | _ -> Nothing 331 | 332 | -- | Pretty print 'CompName' in cabal's target-selector syntax. 333 | -- 334 | -- @since 0.5.0.0 335 | dispCompNameTarget :: PkgName -> CompName -> Text 336 | dispCompNameTarget (PkgName pkg) cn = case cn of 337 | CompNameLib -> "lib:" <> pkg 338 | _ -> dispCompName cn 339 | 340 | -- | Pretty print 'CompName' in the same syntax that is used in 341 | -- @plan.json@. Note that this string can not be used as a target-selector on 342 | -- the cabal command-line. See 'dispCompNameTarget' for a target-selector 343 | -- compatible pretty printer. 344 | dispCompName :: CompName -> Text 345 | dispCompName cn = case cn of 346 | CompNameLib -> "lib" 347 | CompNameSubLib n -> "lib:" <> n 348 | CompNameFLib n -> "flib:" <> n 349 | CompNameExe n -> "exe:" <> n 350 | CompNameBench n -> "bench:" <> n 351 | CompNameTest n -> "test:" <> n 352 | CompNameSetup -> "setup" 353 | 354 | instance FromJSON PlanJson where 355 | parseJSON = withObject "PlanJson" $ \o -> do 356 | pjCabalVersion <- o .: "cabal-version" 357 | 358 | unless (pjCabalVersion >= Ver [2]) $ 359 | fail ("plan.json version " ++ T.unpack (dispVer pjCabalVersion) ++ " not supported") 360 | 361 | pjCabalLibVersion <- o .: "cabal-lib-version" 362 | pjCompilerId <- o .: "compiler-id" 363 | pjArch <- o .: "arch" 364 | pjOs <- o .: "os" 365 | pjUnits <- toMap =<< o .: "install-plan" 366 | 367 | App.pure PlanJson{..} 368 | where 369 | toMap pil = do 370 | let pim = M.fromList [ (uId pi',pi') | pi' <- pil ] 371 | unless (M.size pim == length pil) $ 372 | fail "install-plan[] has duplicate ids" 373 | pure pim 374 | 375 | (.:?!) :: (FromJSON a, Monoid a) => Object -> Text -> Parser a 376 | o .:?! fld = o .:? fT fld .!= Data.Monoid.mempty 377 | where 378 | #if MIN_VERSION_aeson(2,0,0) 379 | fT = AK.fromText 380 | #else 381 | fT = id 382 | #endif 383 | 384 | planItemAllDeps :: Unit -> Set UnitId 385 | planItemAllDeps Unit{..} = mconcat [ ciLibDeps <> ciExeDeps | CompInfo{..} <- M.elems uComps ] 386 | 387 | instance FromJSON Unit where 388 | parseJSON = withObject "Unit" $ \o -> do 389 | mcomponents <- o .:? "components" 390 | mcomponentname <- o .:? "component-name" 391 | ty <- o .: "type" 392 | mstyle <- o .:? "style" 393 | 394 | uId <- o .: "id" 395 | uPId <- PkgId <$> o .: "pkg-name" <*> o .: "pkg-version" 396 | uType <- case (ty :: Text, mstyle :: Maybe Text) of 397 | ("pre-existing",Nothing) -> pure UnitTypeBuiltin 398 | ("configured",Just "global") -> pure UnitTypeGlobal 399 | ("configured",Just "local") -> pure UnitTypeLocal 400 | ("configured",Just "inplace") -> pure UnitTypeInplace 401 | _ -> fail (show (ty,mstyle)) 402 | uFlags <- o .:?! "flags" 403 | uSha256 <- o .:? "pkg-src-sha256" 404 | uCabalSha256 <- o .:? "pkg-cabal-sha256" 405 | uComps <- case (mcomponents, mcomponentname) of 406 | (Just comps0, Nothing) -> 407 | pure comps0 408 | (Nothing, Just cname) -> 409 | M.singleton cname <$> parseJSON (Object o) 410 | (Nothing, Nothing) | uType == UnitTypeBuiltin -> 411 | M.singleton CompNameLib <$> parseJSON (Object o) 412 | _ -> fail (show o) 413 | 414 | uDistDir <- o .:? "dist-dir" 415 | 416 | uPkgSrc <- o .:? "pkg-src" 417 | 418 | pure Unit{..} 419 | 420 | ---------------------------------------------------------------------------- 421 | -- Convenience helper 422 | 423 | -- | Where/how to search for the plan.json file. 424 | data SearchPlanJson 425 | = ProjectRelativeToDir FilePath -- ^ Find the project root relative to 426 | -- specified directory and look for 427 | -- plan.json there. 428 | | InBuildDir FilePath -- ^ Look for plan.json in specified build 429 | -- directory. 430 | | ExactPath FilePath -- ^ Exact location of plan.json 431 | deriving (Eq, Show, Read) 432 | 433 | -- | Find and decode @plan.json@. 434 | -- 435 | -- See 'findPlanJson' and 'decodePlanJson'. 436 | -- 437 | findAndDecodePlanJson 438 | :: SearchPlanJson 439 | -> IO PlanJson 440 | findAndDecodePlanJson searchLoc = findPlanJson searchLoc >>= decodePlanJson 441 | 442 | -- | Find @plan.json@. 443 | -- 444 | -- When 'ProjectRelativeToDir' is passed locates the project root for cabal 445 | -- project relative to specified directory. 446 | -- 447 | -- @plan.json@ is located from either the optional build dir argument, or in 448 | -- the default directory (@dist-newstyle@) relative to the project root. 449 | -- 450 | -- This function determines the project root in a slightly more liberal manner 451 | -- than cabal-install. If no cabal.project is found, cabal-install assumes an 452 | -- implicit cabal.project if the current directory contains any *.cabal files. 453 | -- 454 | -- This function looks for any *.cabal files in directories above the current 455 | -- one and behaves as if there is an implicit cabal.project in that directory 456 | -- when looking for a plan.json. 457 | -- 458 | -- Throws 'IO' exceptions on errors. 459 | -- 460 | -- @since 0.6.2.0 461 | -- 462 | findPlanJson 463 | :: SearchPlanJson 464 | -> IO FilePath 465 | findPlanJson searchLoc = do 466 | planJsonFn <- case searchLoc of 467 | ExactPath fp -> pure fp 468 | InBuildDir builddir -> fromBuilddir builddir 469 | ProjectRelativeToDir fp -> do 470 | mRoot <- findProjectRoot fp 471 | case mRoot of 472 | Nothing -> fail ("missing project root relative to: " ++ fp) 473 | Just dir -> fromBuilddir $ dir "dist-newstyle" 474 | 475 | havePlanJson <- Dir.doesFileExist planJsonFn 476 | 477 | unless havePlanJson $ 478 | fail "missing 'plan.json' file; do you need to run 'cabal new-build'?" 479 | 480 | return planJsonFn 481 | where 482 | fromBuilddir distFolder = do 483 | haveDistFolder <- Dir.doesDirectoryExist distFolder 484 | 485 | unless haveDistFolder $ 486 | fail ("missing " ++ show distFolder ++ " folder; do you need to run 'cabal new-build'?") 487 | 488 | return $ distFolder "cache" "plan.json" 489 | 490 | -- | Decodes @plan.json@ file location provided as 'FilePath' 491 | -- 492 | -- This is a trivial convenience function so that the caller doesn't 493 | -- have to depend on @aeson@ directly 494 | -- 495 | -- Throws 'IO' exceptions on errors. 496 | -- 497 | decodePlanJson :: FilePath -> IO PlanJson 498 | decodePlanJson planJsonFn = do 499 | jsraw <- B.readFile planJsonFn 500 | either fail pure $ eitherDecodeStrict' jsraw 501 | 502 | -- | Find project root relative to a directory, this emulates cabal's current 503 | -- heuristic, but is slightly more liberal. If no cabal.project is found, 504 | -- cabal-install looks for *.cabal files in the specified directory only. This 505 | -- function also considers *.cabal files in directories higher up in the 506 | -- hierarchy. 507 | findProjectRoot :: FilePath -> IO (Maybe FilePath) 508 | findProjectRoot dir = do 509 | normalisedPath <- Dir.canonicalizePath dir 510 | let checkCabalProject d = do 511 | ex <- Dir.doesFileExist fn 512 | return $ if ex then Just d else Nothing 513 | where 514 | fn = d "cabal.project" 515 | 516 | checkCabal d = do 517 | files <- listDirectory d 518 | return $ if any (isExtensionOf ".cabal") files 519 | then Just d 520 | else Nothing 521 | 522 | result <- walkUpFolders checkCabalProject normalisedPath 523 | case result of 524 | Just rootDir -> pure $ Just rootDir 525 | Nothing -> walkUpFolders checkCabal normalisedPath 526 | where 527 | isExtensionOf :: String -> FilePath -> Bool 528 | isExtensionOf ext fp = ext == takeExtension fp 529 | 530 | listDirectory :: FilePath -> IO [FilePath] 531 | listDirectory fp = filter isSpecialDir <$> Dir.getDirectoryContents fp 532 | where 533 | isSpecialDir f = f /= "." && f /= ".." 534 | 535 | walkUpFolders 536 | :: (FilePath -> IO (Maybe a)) -> FilePath -> IO (Maybe a) 537 | walkUpFolders dtest d0 = do 538 | home <- Dir.getHomeDirectory 539 | 540 | let go d | d == home = pure Nothing 541 | | isDrive d = pure Nothing 542 | | otherwise = do 543 | t <- dtest d 544 | case t of 545 | Nothing -> go $ takeDirectory d 546 | x@Just{} -> pure x 547 | 548 | go d0 549 | 550 | parseVer :: Text -> Maybe Ver 551 | parseVer str = case reverse $ readP_to_S DV.parseVersion (T.unpack str) of 552 | (ver, "") : _ | not (null (DV.versionBranch ver)), all (>= 0) (DV.versionBranch ver) 553 | -> Just (Ver $ DV.versionBranch ver) 554 | _ -> Nothing 555 | 556 | -- | Pretty print 'Ver' 557 | dispVer :: Ver -> Text 558 | dispVer (Ver ns) = T.pack $ intercalate "." (map show ns) 559 | 560 | instance FromJSON Ver where 561 | parseJSON = withText "Ver" (maybe (fail "Ver") pure . parseVer) 562 | 563 | instance ToJSON Ver where 564 | toJSON = toJSON . dispVer 565 | 566 | parsePkgId :: Text -> Maybe PkgId 567 | parsePkgId t = do 568 | let (pns_, pvs) = T.breakOnEnd "-" t 569 | pv <- parseVer pvs 570 | 571 | pn <- T.stripSuffix "-" pns_ 572 | 573 | -- TODO: validate pn 574 | pure (PkgId (PkgName pn) pv) 575 | 576 | -- | Pretty print 'PkgId' 577 | dispPkgId :: PkgId -> Text 578 | dispPkgId (PkgId (PkgName pn) pv) = pn <> "-" <> dispVer pv 579 | 580 | 581 | -- | Pretty print 'Sha256' as base-16. 582 | dispSha256 :: Sha256 -> Text 583 | dispSha256 (Sha256 s) = T.decodeLatin1 (B16.encode s) 584 | 585 | -- | Parse base-16 encoded 'Sha256'. 586 | -- 587 | -- Returns 'Nothing' in case of parsing failure. 588 | -- 589 | -- @since 0.3.0.0 590 | parseSha256 :: Text -> Maybe Sha256 591 | parseSha256 t 592 | #if MIN_VERSION_base16_bytestring(1,0,0) 593 | = case B16.decode (T.encodeUtf8 t) of 594 | Right s | B.length s == 32 -> Just (Sha256 s) 595 | _ -> Nothing 596 | #else 597 | | B.length s == 32, B.null rest = Just (Sha256 s) 598 | | otherwise = Nothing 599 | where 600 | (s, rest) = B16.decode $ T.encodeUtf8 t 601 | #endif 602 | 603 | -- | Export the 'Sha256' digest to a 32-byte 'B.ByteString'. 604 | -- 605 | -- @since 0.3.0.0 606 | sha256ToByteString :: Sha256 -> B.ByteString 607 | sha256ToByteString (Sha256 bs) = bs 608 | 609 | -- | Import the 'Sha256' digest from a 32-byte 'B.ByteString'. 610 | -- 611 | -- Returns 'Nothing' if input 'B.ByteString' has incorrect length. 612 | -- 613 | -- @since 0.3.0.0 614 | sha256FromByteString :: B.ByteString -> Maybe Sha256 615 | sha256FromByteString bs 616 | | B.length bs == 32 = Just (Sha256 bs) 617 | | otherwise = Nothing 618 | 619 | instance FromJSON Sha256 where 620 | parseJSON = withText "Sha256" (maybe (fail "Sha256") pure . parseSha256) 621 | 622 | instance ToJSON Sha256 where 623 | toJSON = toJSON . dispSha256 624 | 625 | instance Show Sha256 where 626 | show = show . dispSha256 627 | 628 | ---------------------------------------------------------------------------- 629 | 630 | -- | Extract directed 'UnitId' dependency graph edges from 'pjUnits' 631 | -- 632 | -- This graph contains both, library and executable dependencies edges 633 | planJsonIdGraph :: PlanJson -> Map UnitId (Set UnitId) 634 | planJsonIdGraph PlanJson{..} = M.fromList [ (uId unit, planItemAllDeps unit) 635 | | unit <- M.elems pjUnits 636 | ] 637 | 638 | -- | Extract 'UnitId' root nodes from dependency graph computed by 'planJsonIdGraph' 639 | planJsonIdRoots :: PlanJson -> Set UnitId 640 | planJsonIdRoots PlanJson{..} = M.keysSet pjUnits `S.difference` nonRoots 641 | where 642 | nonRoots :: Set UnitId 643 | nonRoots = mconcat $ M.elems $ planJsonIdGraph PlanJson{..} 644 | --------------------------------------------------------------------------------