From 5e5272e73a846dd79df67848baa823e0a09479dd Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 9 Jun 2022 11:59:03 +1000 Subject: cleaned up the tree and updated readme --- README.md | 166 ------------------------------------- README.md.original | 166 +++++++++++++++++++++++++++++++++++++ README.org | 16 +++- cabal.project.freeze | 228 --------------------------------------------------- install.hs | 171 -------------------------------------- stack-8.0.2.yaml | 7 -- stack-8.2.2.yaml | 7 -- stack-8.4.3.yaml | 7 -- stack-8.4.4.yaml | 7 -- stack-8.6.3.yaml | 7 -- stack-8.6.4.yaml | 7 -- stack-8.6.5.yaml | 7 -- stack-8.8.3.yaml | 12 --- stack.yaml | 6 +- 14 files changed, 181 insertions(+), 633 deletions(-) delete mode 100644 README.md create mode 100644 README.md.original delete mode 100644 cabal.project.freeze delete mode 100755 install.hs delete mode 100644 stack-8.0.2.yaml delete mode 100644 stack-8.2.2.yaml delete mode 100644 stack-8.4.3.yaml delete mode 100644 stack-8.4.4.yaml delete mode 100644 stack-8.6.3.yaml delete mode 100644 stack-8.6.4.yaml delete mode 100644 stack-8.6.5.yaml delete mode 100644 stack-8.8.3.yaml diff --git a/README.md b/README.md deleted file mode 100644 index 0a9beaa..0000000 --- a/README.md +++ /dev/null @@ -1,166 +0,0 @@ -# Haskell Code Explorer - -[![CircleCI](https://circleci.com/gh/alexwl/haskell-code-explorer/tree/master.svg?style=svg)](https://circleci.com/gh/alexwl/haskell-code-explorer/tree/master) - -Haskell Code Explorer is a web application for exploring and understanding Haskell codebases. It provides IDE-like code intelligence features such as types and documentation on hover, "go to definition", "find references" and semantic highlighting. - -Examples: - -- [https://haskell-code-explorer.mfix.io/package/stm-2.4.5.0/show/Control/Concurrent/STM/TQueue.hs#L87](https://haskell-code-explorer.mfix.io/package/stm-2.4.5.0/show/Control/Concurrent/STM/TQueue.hs#L87) -- [https://haskell-code-explorer.mfix.io/package/async-2.1.1.1/show/Control/Concurrent/Async.hs#L251](https://haskell-code-explorer.mfix.io/package/async-2.1.1.1/show/Control/Concurrent/Async.hs#L251) -- [https://haskell-code-explorer.mfix.io/package/haxl-0.5.1.0/show/Haxl/Core/Monad.hs#L569](https://haskell-code-explorer.mfix.io/package/haxl-0.5.1.0/show/Haxl/Core/Monad.hs#L569) - -![Haskell Code Explorer](https://haskell-code-explorer.mfix.io/screenshot.png) - -The public instance of Haskell Code Explorer is available at [https://haskell-code-explorer.mfix.io](https://haskell-code-explorer.mfix.io). It contains core libraries (ghc, base, etc.) and a subset of packages from a Stackage snapshot. - -Haskell Code Explorer consists of an indexer, an HTTP server, and a JavaScript application. The indexer uses GHC API to create a data structure that contains detailed information about the source code of a Cabal package. The HTTP server reads that data structure into memory and responds to HTTP requests from the JavaScript application. - -## Motivation - -Reading and understanding code is an essential part of the software development process. Understanding code in any statically typed language is much easier when code intelligence features (types on hover, go-to-definition, etc.) are available. Code intelligence for Haskell is especially useful because types are informative and precise (thanks to Haskell's purity and global type inference). - -## Features - -* Types (actual type, instantiated type, instance resolution tree) and documentation on hover. Types are interactive: left-click on a type constructor -> go to definition, right click on a type constructor -> show kind signature.
- ![Hover](https://haskell-code-explorer.mfix.io/hover.png) - -* Go to definition (cross-package) - -* Find references (cross-package) - ![References](https://haskell-code-explorer.mfix.io/references.png) - -* Search for Haskell functions, data and type constructors by name (in the current package / in all indexed packages) - ![Search](https://haskell-code-explorer.mfix.io/search.png) - -* Type of each expression
- ![Expression](https://haskell-code-explorer.mfix.io/expressions.png)
- Select a piece of text to get the type of each Haskell expression inside the selection. - -* Semantic highlighting - -## Installation - -```bash -git clone https://github.com/alexwl/haskell-code-explorer -cd haskell-code-explorer -``` - -To build Haskell Code Explorer Stack ([https://docs.haskellstack.org/en/stable/README/](https://docs.haskellstack.org/en/stable/README/)) is needed. - -At the moment Haskell Code Explorer supports GHC 8.6.5, 8.6.4, GHC 8.6.3, GHC 8.4.4, GHC 8.4.3, GHC 8.2.2, and 8.0.2. - -For GHC 8.6.5: - -```bash -stack install -``` - -For GHC 8.6.4: - -```bash -stack --stack-yaml=stack-8.6.4.yaml install -``` - -For GHC 8.6.3: - -```bash -stack --stack-yaml=stack-8.6.3.yaml install -``` - -For GHC 8.4.4: - -```bash -stack --stack-yaml=stack-8.4.4.yaml install -``` - -For GHC 8.4.3: - -```bash -stack --stack-yaml=stack-8.4.3.yaml install -``` - -For GHC 8.2.2: - -```bash -stack --stack-yaml=stack-8.2.2.yaml install -``` - -For GHC 8.0.2: - -```bash -stack --stack-yaml=stack-8.0.2.yaml install -``` - -## Indexing source code of a Cabal package - -`haskell-code-indexer` executable is responsible for indexing packages (by default, the index is saved to `.haskell-code-explorer` directory). - -A package should be built using either cabal-install or stack before indexing (`cabal new-build`,`cabal build`, or `stack build` command should be executed). - -The version of GHC used to build `haskell-code-indexer` must match the version of GHC used to build a package you are indexing (to find out the version of GHC try `ghc --version` or `stack exec ghc -- --version` command). - -`haskell-code-indexer` requires globally installed GHC and cabal-install (`cabal`). The reason for this is that `haskell-code-indexer` uses `cabal-helper` library [https://hackage.haskell.org/package/cabal-helper](https://hackage.haskell.org/package/cabal-helper) to get package build information. `cabal-helper` builds (at runtime) an executable linked against a version of Cabal library that was used to configure the package. You may need to run `cabal update` to get the latest list of available packages to be able to build the `cabal-helper` executable. By default, the `cabal-helper` executable (e.g.,`cabal-helper0.8.1.2-Cabal2.4.1.0`) is saved to `$HOME/.cache/cabal-helper`. - -If there is no globally installed GHC on the system, then it is possible to use `stack exec` command ([https://docs.haskellstack.org/en/stable/GUIDE/#exec](https://docs.haskellstack.org/en/stable/GUIDE/#exec)) that adds a path to GHC binaries installed by Stack to `PATH` environment variable. - -Run `cabal update` using stack exec: -```bash -stack --resolver=lts-13.20 exec --no-ghc-package-path cabal -- update -``` - -Index a package using stack exec: -```bash -stack --resolver=lts-13.20 exec --no-ghc-package-path haskell-code-indexer -- INDEXER_OPTIONS -``` - -`--no-ghc-package-path` option unsets `GHC_PACKAGE_PATH` environment variable. `cabal` fails with the error `Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal.` if the `GHC_PACKAGE_PATH` is set. - -### Examples - -Show all indexer options: -```bash -haskell-code-indexer -h -``` - -Index package: -```bash -haskell-code-indexer --package PATH -``` - -Index package with specific `dist` directory: -```bash -haskell-code-indexer --package PATH --dist dist-newstyle/build/x86_64-linux/ghc-8.2.2/hpath-0.9.2 -``` - -## Starting HTTP Server - -`haskell-code-server` executable reads the package index created by `haskell-code-indexer` and starts the HTTP server. The HTTP server responds to API requests and serves static assets (JavaScript files that are in `haskell-code-explorer/javascript/release` directory). - -### Examples - -Show all server options: - -```bash -haskell-code-server -h -``` - -Load the indexed package and start the server: - -```bash -haskell-code-server --package PATH --port 8080 -``` - -Load multiple indexed packages and start the server: - -```bash -haskell-code-server --package PATH1 --package PATH2 --package PATH3 --port 8080 -``` - -Load the indexed package and start the server, use Hoogle API (https://github.com/ndmitchell/hoogle/blob/3dbf68bfd701f942d3af2e6debb74a0a78cd392e/docs/API.md#json-api) to get documentation for functions and types defined in other packages (`haskell-code-server` makes requests to https://hoogle.haskell.org/): - -```bash -haskell-code-server --package PATH --port 8080 --use-hoogle-api -``` - -Open [http://localhost:8080](http://localhost:8080) in a browser to explore source code of the package. diff --git a/README.md.original b/README.md.original new file mode 100644 index 0000000..0a9beaa --- /dev/null +++ b/README.md.original @@ -0,0 +1,166 @@ +# Haskell Code Explorer + +[![CircleCI](https://circleci.com/gh/alexwl/haskell-code-explorer/tree/master.svg?style=svg)](https://circleci.com/gh/alexwl/haskell-code-explorer/tree/master) + +Haskell Code Explorer is a web application for exploring and understanding Haskell codebases. It provides IDE-like code intelligence features such as types and documentation on hover, "go to definition", "find references" and semantic highlighting. + +Examples: + +- [https://haskell-code-explorer.mfix.io/package/stm-2.4.5.0/show/Control/Concurrent/STM/TQueue.hs#L87](https://haskell-code-explorer.mfix.io/package/stm-2.4.5.0/show/Control/Concurrent/STM/TQueue.hs#L87) +- [https://haskell-code-explorer.mfix.io/package/async-2.1.1.1/show/Control/Concurrent/Async.hs#L251](https://haskell-code-explorer.mfix.io/package/async-2.1.1.1/show/Control/Concurrent/Async.hs#L251) +- [https://haskell-code-explorer.mfix.io/package/haxl-0.5.1.0/show/Haxl/Core/Monad.hs#L569](https://haskell-code-explorer.mfix.io/package/haxl-0.5.1.0/show/Haxl/Core/Monad.hs#L569) + +![Haskell Code Explorer](https://haskell-code-explorer.mfix.io/screenshot.png) + +The public instance of Haskell Code Explorer is available at [https://haskell-code-explorer.mfix.io](https://haskell-code-explorer.mfix.io). It contains core libraries (ghc, base, etc.) and a subset of packages from a Stackage snapshot. + +Haskell Code Explorer consists of an indexer, an HTTP server, and a JavaScript application. The indexer uses GHC API to create a data structure that contains detailed information about the source code of a Cabal package. The HTTP server reads that data structure into memory and responds to HTTP requests from the JavaScript application. + +## Motivation + +Reading and understanding code is an essential part of the software development process. Understanding code in any statically typed language is much easier when code intelligence features (types on hover, go-to-definition, etc.) are available. Code intelligence for Haskell is especially useful because types are informative and precise (thanks to Haskell's purity and global type inference). + +## Features + +* Types (actual type, instantiated type, instance resolution tree) and documentation on hover. Types are interactive: left-click on a type constructor -> go to definition, right click on a type constructor -> show kind signature.
+ ![Hover](https://haskell-code-explorer.mfix.io/hover.png) + +* Go to definition (cross-package) + +* Find references (cross-package) + ![References](https://haskell-code-explorer.mfix.io/references.png) + +* Search for Haskell functions, data and type constructors by name (in the current package / in all indexed packages) + ![Search](https://haskell-code-explorer.mfix.io/search.png) + +* Type of each expression
+ ![Expression](https://haskell-code-explorer.mfix.io/expressions.png)
+ Select a piece of text to get the type of each Haskell expression inside the selection. + +* Semantic highlighting + +## Installation + +```bash +git clone https://github.com/alexwl/haskell-code-explorer +cd haskell-code-explorer +``` + +To build Haskell Code Explorer Stack ([https://docs.haskellstack.org/en/stable/README/](https://docs.haskellstack.org/en/stable/README/)) is needed. + +At the moment Haskell Code Explorer supports GHC 8.6.5, 8.6.4, GHC 8.6.3, GHC 8.4.4, GHC 8.4.3, GHC 8.2.2, and 8.0.2. + +For GHC 8.6.5: + +```bash +stack install +``` + +For GHC 8.6.4: + +```bash +stack --stack-yaml=stack-8.6.4.yaml install +``` + +For GHC 8.6.3: + +```bash +stack --stack-yaml=stack-8.6.3.yaml install +``` + +For GHC 8.4.4: + +```bash +stack --stack-yaml=stack-8.4.4.yaml install +``` + +For GHC 8.4.3: + +```bash +stack --stack-yaml=stack-8.4.3.yaml install +``` + +For GHC 8.2.2: + +```bash +stack --stack-yaml=stack-8.2.2.yaml install +``` + +For GHC 8.0.2: + +```bash +stack --stack-yaml=stack-8.0.2.yaml install +``` + +## Indexing source code of a Cabal package + +`haskell-code-indexer` executable is responsible for indexing packages (by default, the index is saved to `.haskell-code-explorer` directory). + +A package should be built using either cabal-install or stack before indexing (`cabal new-build`,`cabal build`, or `stack build` command should be executed). + +The version of GHC used to build `haskell-code-indexer` must match the version of GHC used to build a package you are indexing (to find out the version of GHC try `ghc --version` or `stack exec ghc -- --version` command). + +`haskell-code-indexer` requires globally installed GHC and cabal-install (`cabal`). The reason for this is that `haskell-code-indexer` uses `cabal-helper` library [https://hackage.haskell.org/package/cabal-helper](https://hackage.haskell.org/package/cabal-helper) to get package build information. `cabal-helper` builds (at runtime) an executable linked against a version of Cabal library that was used to configure the package. You may need to run `cabal update` to get the latest list of available packages to be able to build the `cabal-helper` executable. By default, the `cabal-helper` executable (e.g.,`cabal-helper0.8.1.2-Cabal2.4.1.0`) is saved to `$HOME/.cache/cabal-helper`. + +If there is no globally installed GHC on the system, then it is possible to use `stack exec` command ([https://docs.haskellstack.org/en/stable/GUIDE/#exec](https://docs.haskellstack.org/en/stable/GUIDE/#exec)) that adds a path to GHC binaries installed by Stack to `PATH` environment variable. + +Run `cabal update` using stack exec: +```bash +stack --resolver=lts-13.20 exec --no-ghc-package-path cabal -- update +``` + +Index a package using stack exec: +```bash +stack --resolver=lts-13.20 exec --no-ghc-package-path haskell-code-indexer -- INDEXER_OPTIONS +``` + +`--no-ghc-package-path` option unsets `GHC_PACKAGE_PATH` environment variable. `cabal` fails with the error `Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal.` if the `GHC_PACKAGE_PATH` is set. + +### Examples + +Show all indexer options: +```bash +haskell-code-indexer -h +``` + +Index package: +```bash +haskell-code-indexer --package PATH +``` + +Index package with specific `dist` directory: +```bash +haskell-code-indexer --package PATH --dist dist-newstyle/build/x86_64-linux/ghc-8.2.2/hpath-0.9.2 +``` + +## Starting HTTP Server + +`haskell-code-server` executable reads the package index created by `haskell-code-indexer` and starts the HTTP server. The HTTP server responds to API requests and serves static assets (JavaScript files that are in `haskell-code-explorer/javascript/release` directory). + +### Examples + +Show all server options: + +```bash +haskell-code-server -h +``` + +Load the indexed package and start the server: + +```bash +haskell-code-server --package PATH --port 8080 +``` + +Load multiple indexed packages and start the server: + +```bash +haskell-code-server --package PATH1 --package PATH2 --package PATH3 --port 8080 +``` + +Load the indexed package and start the server, use Hoogle API (https://github.com/ndmitchell/hoogle/blob/3dbf68bfd701f942d3af2e6debb74a0a78cd392e/docs/API.md#json-api) to get documentation for functions and types defined in other packages (`haskell-code-server` makes requests to https://hoogle.haskell.org/): + +```bash +haskell-code-server --package PATH --port 8080 --use-hoogle-api +``` + +Open [http://localhost:8080](http://localhost:8080) in a browser to explore source code of the package. diff --git a/README.org b/README.org index c78046b..f45ec2f 100644 --- a/README.org +++ b/README.org @@ -20,20 +20,28 @@ example: cabal unpack sqlite-simple cd sqlite-simple-x.y.z.w cabal configure --enable-testsuites --enable-benchmarks -cabal build +cabal build all haskell-code-indexer -p . #+end_src After this you can do #+begin_src sh -haskell-code-server -p /path/to/package1 -p /path/to/packag2 ... +haskell-code-server -p /path/to/package1 -p /path/to/package2 ... #+end_src and the app will be available at localhost:3000. -For the readme of the original version, see README.md, also available -at https://g.ypei.me/haskell-code-explorer.git/tree/README.md. +For the readme of the original version, see README.md.original in the +project tree, also available at +https://g.ypei.me/haskell-code-explorer.git/tree/README.md.original. + +* Difference from the original version + +The indexer of this version looks for all build targets, including +testsuites and benchmarks, in the .cabal file, therefore you'll need +to build them all before indexing, otherwise the indexer will complain +about missing files. * Contact and Copyright diff --git a/cabal.project.freeze b/cabal.project.freeze deleted file mode 100644 index 1a0ad4b..0000000 --- a/cabal.project.freeze +++ /dev/null @@ -1,228 +0,0 @@ -constraints: any.Cabal ==2.2.0.1 || ==2.4.0.1, - Cabal -bundled-binary-generic, - any.HTTP ==4000.3.12, - HTTP -conduit10 -mtl1 +network-uri -warn-as-error +warp-tests, - any.HUnit ==1.6.0.0, - any.IntervalMap ==0.6.0.0, - any.QuickCheck ==2.12.6.1, - QuickCheck +templatehaskell, - any.StateVar ==1.1.1.1, - any.aeson ==1.4.1.0, - aeson -bytestring-builder -cffi -developer -fast, - any.ansi-terminal ==0.8.2, - ansi-terminal -example, - any.ansi-wl-pprint ==0.6.8.2, - ansi-wl-pprint -example, - any.appar ==0.1.4, - any.array ==0.5.2.0, - any.async ==2.2.1, - async -bench, - any.attoparsec ==0.13.2.2, - attoparsec -developer, - any.attoparsec-iso8601 ==1.0.1.0, - attoparsec-iso8601 -developer -fast, - any.auto-update ==0.1.4, - any.base ==4.11.1.0, - any.base-compat ==0.10.5, - any.base-orphans ==0.8, - any.base16-bytestring ==0.1.1.6, - any.base64-bytestring ==1.0.0.1, - any.basement ==0.0.8, - any.bifunctors ==5.5.3, - bifunctors +semigroups +tagged, - any.binary ==0.8.5.1, - any.blaze-builder ==0.4.1.0, - any.blaze-html ==0.9.1.1, - any.blaze-markup ==0.8.2.2, - any.bsb-http-chunked ==0.0.0.4, - any.byteorder ==1.0.4, - any.bytestring ==0.10.8.2, - any.cabal-doctest ==1.0.6, - cabal-helper -dev, - any.cabal-install ==2.4.0.0, - cabal-install -debug-conflict-sets -debug-expensive-assertions -debug-tracetree +native-dns, - any.cabal-plan ==0.4.0.0, - cabal-plan -_ +exe -license-report, - any.call-stack ==0.1.0, - any.case-insensitive ==1.2.0.11, - any.cereal ==0.5.7.0, - cereal -bytestring-builder, - any.clock ==0.7.2, - clock -llvm, - any.colour ==2.3.4, - any.comonad ==5.0.4, - comonad +containers +contravariant +distributive +test-doctests, - any.conduit ==1.3.1, - any.conduit-extra ==1.3.0, - any.containers ==0.5.11.0, - any.contravariant ==1.5, - contravariant -safe +semigroups +statevar +tagged, - any.cookie ==0.4.4, - any.cryptohash-sha256 ==0.11.101.0, - cryptohash-sha256 -exe, - any.cryptonite ==0.25, - cryptonite -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq -support_pclmuldq +support_rdrand -support_sse, - any.data-default ==0.7.1.1, - any.data-default-class ==0.1.2.0, - any.data-default-instances-containers ==0.0.1, - any.data-default-instances-dlist ==0.0.1, - any.data-default-instances-old-locale ==0.0.1, - any.deepseq ==1.4.3.0, - any.digest ==0.0.1.2, - digest -bytestring-in-base, - any.directory ==1.3.1.5, - any.directory-tree ==0.12.1, - any.distributive ==0.6, - distributive +semigroups +tagged, - any.dlist ==0.8.0.5, - any.easy-file ==0.2.2, - any.echo ==0.1.3, - echo -example, - any.ed25519 ==0.0.5.0, - ed25519 +no-donna +test-doctests +test-hlint +test-properties, - any.edit-distance ==0.2.2.1, - any.erf ==2.0.0.0, - any.exceptions ==0.10.0, - any.expiring-cache-map ==0.0.6.1, - any.extra ==1.6.13, - any.fast-logger ==2.4.11, - any.file-embed ==0.0.11, - any.filemanip ==0.3.6.3, - any.filepath ==1.4.2, - any.ghc ==8.4.4, - any.ghc-boot ==8.4.4, - any.ghc-boot-th ==8.4.4, - any.ghc-compact ==0.1.0.0, - any.ghc-paths ==0.1.0.9, - any.ghc-prim ==0.5.2.0, - any.ghci ==8.4.4, - any.hackage-security ==0.5.3.0, - hackage-security +base48 -old-directory +use-network-uri, - any.haddock-library ==1.7.0, - any.happy ==1.19.9, - happy +small_base, - any.hashable ==1.2.7.0, - hashable -examples +integer-gmp +sse2 -sse41, - any.haskell-lexer ==1.0.2, - any.hpc ==0.6.0.3, - any.hsc2hs ==0.68.3, - hsc2hs -in-ghc-tree, - any.hspec ==2.6.0, - any.hspec-core ==2.6.0, - any.hspec-discover ==2.6.0, - any.hspec-expectations ==0.8.2, - any.http-api-data ==0.4, - http-api-data -use-text-show, - any.http-date ==0.0.8, - any.http-media ==0.7.1.3, - any.http-types ==0.12.2, - any.http2 ==1.6.4, - http2 -devel, - any.integer-gmp ==1.0.2.0, - any.integer-logarithms ==1.0.2.2, - integer-logarithms -check-bounds +integer-gmp, - any.iproute ==1.7.6, - any.lifted-base ==0.2.3.12, - any.memory ==0.14.18, - memory +support_basement +support_bytestring +support_deepseq +support_foundation, - any.mime-types ==0.1.0.8, - any.mmorph ==1.1.2, - any.monad-control ==1.0.2.3, - any.monad-logger ==0.3.30, - monad-logger +template_haskell, - any.monad-loops ==0.4.3, - monad-loops +base4, - any.mono-traversable ==1.0.9.0, - any.mtl ==2.2.2, - any.network ==2.8.0.0, - any.network-byte-order ==0.0.0.0, - any.network-uri ==2.6.1.0, - any.old-locale ==1.0.0.7, - any.old-time ==1.1.0.3, - any.optparse-applicative ==0.14.3.0, - any.pagination ==0.2.1, - pagination -dev, - any.parsec ==3.1.13.0, - any.pretty ==1.1.3.6, - any.pretty-show ==1.8.2, - any.primitive ==0.6.4.0, - any.process ==1.6.3.0, - any.psqueues ==0.2.7.0, - any.quickcheck-io ==0.2.0, - any.random ==1.1, - any.resolv ==0.1.1.2, - any.resourcet ==1.2.2, - any.rts ==1.0, - any.scientific ==0.3.6.2, - scientific -bytestring-builder -integer-simple, - any.semigroupoids ==5.2.2, - semigroupoids +comonad +containers +contravariant +distributive +doctests +tagged +unordered-containers, - any.semigroups ==0.18.5, - semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +text +transformers +unordered-containers, - any.servant ==0.15, - any.servant-server ==0.15, - any.setenv ==0.1.1.3, - any.simple-sendfile ==0.2.27, - simple-sendfile +allow-bsd, - any.singleton-bool ==0.1.4, - any.split ==0.2.3.3, - any.stm ==2.4.5.1, - any.stm-chans ==3.0.0.4, - any.streaming-commons ==0.2.1.0, - streaming-commons -use-bytestring-builder, - any.string-conversions ==0.4.0.1, - any.syb ==0.7, - any.tagged ==0.8.6, - tagged +deepseq +transformers, - any.tar ==0.5.1.0, - tar -old-bytestring -old-time, - any.template-haskell ==2.13.0.0, - any.temporary ==1.2.1.1, - any.terminfo ==0.4.1.1, - any.text ==1.2.3.1, - any.tf-random ==0.5, - any.th-abstraction ==0.2.8.0, - any.time ==1.8.0.2, - any.time-locale-compat ==0.1.1.5, - time-locale-compat -old-locale, - any.transformers ==0.5.5.0, - any.transformers-base ==0.4.5.2, - transformers-base +orphaninstances, - any.transformers-compat ==0.6.2, - transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, - any.typed-process ==0.2.3.0, - any.uniplate ==1.6.12, - uniplate +separate_syb +typeable_fingerprint, - any.unix ==2.7.2.2, - any.unix-compat ==0.5.1, - unix-compat -old-time, - any.unix-time ==0.3.8, - any.unliftio-core ==0.1.2.0, - any.unordered-containers ==0.2.9.0, - unordered-containers -debug, - any.uri-encode ==1.5.0.5, - uri-encode +network-uri -tools, - any.utf8-string ==1.0.1.1, - any.uuid-types ==1.0.3, - any.vault ==0.3.1.2, - vault +useghc, - any.vector ==0.12.0.1, - vector +boundschecks -internalchecks -unsafechecks -wall, - any.vector-algorithms ==0.8.0.1, - vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, - any.void ==0.7.2, - void -safe, - any.wai ==3.2.1.2, - any.wai-app-static ==3.1.6.2, - wai-app-static -print, - any.wai-extra ==3.0.24.3, - wai-extra -build-example, - any.wai-logger ==2.3.2, - any.wai-middleware-static ==0.8.2, - any.warp ==3.2.25, - warp +allow-sendfilefd -network-bytestring -warp-debug, - any.word8 ==0.1.3, - any.zip-archive ==0.3.3, - zip-archive -executable, - any.zlib ==0.6.2, - zlib -non-blocking-ffi -pkg-config diff --git a/install.hs b/install.hs deleted file mode 100755 index 6db36fa..0000000 --- a/install.hs +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env stack -{- stack script - --resolver lts-13.12 - --ghc-options -Wall - --package bytestring,text,filepath,directory,optparse-applicative,typed-process --} - -{-# LANGUAGE CPP #-} --- = About --- --- Install multiple versions of haskell-code-indexer, each with the version of --- GHC it was built with appended to the executable name. --- --- = Original --- --- Modified from the BSD3 licensed script at: --- https://github.com/haskell/haskell-ide-engine/blob/ec5e34ca52d389b713df918f02ff63920aede4be/install.hs --- --- Thanks haskell-ide-engine folks! --- --- = Changes from the original --- --- + Switched from Shake to IO script --- + Added optparse-applicative --- + Switched to Stack only (PRs welcome to support other tools) -module Main (main) where - -import Control.Monad -import Data.ByteString (ByteString) -import qualified Data.ByteString.Lazy as LBS -import Data.Char (isSpace) -import Data.Foldable -import Data.List (dropWhileEnd) -import qualified Data.Text as T -import Data.Text.Encoding -import System.FilePath ((<.>), ()) -import Options.Applicative -import System.Directory (copyFile, removeFile) -import System.Process.Typed - --- | Keep this in sync with the stack.yamls at the top level of the project. -supportedGhcVersions :: [Version] -supportedGhcVersions = - map Version ["8.0.2", "8.2.2", "8.4.3", "8.4.4", "8.6.3", "8.6.4","8.6.5"] - -newtype Version = Version { unVersion :: String } deriving Eq - --- * CLI args - -data Args = Args - { argBuildVersions :: [Version] - , argBuildServer :: Bool - } - -cliArgs :: IO Args -cliArgs = - customExecParser (prefs showHelpOnError) argsParser - -argsParser :: ParserInfo Args -argsParser = - fmap defaultToAll $ - info (helper <*> parser) (fullDesc <> progDesc desc) - where - parser :: Parser Args - parser = - Args - <$> (some indexVersion <|> pure mempty) - <*> switch - ( long "server" - <> help "Build haskell-code-server" - ) - - indexVersion :: Parser Version - indexVersion = - argument (eitherReader checkVersion) - ( metavar "INDEX_VERSION" - <> help "haskell-code-indexer-X-Y-Z version to build" - ) - - checkVersion :: String -> Either String Version - checkVersion s = - case find ((==) (Version s)) supportedGhcVersions of - Nothing -> - Left . unwords $ - "Not a supported GHC version. Currently supported versions are:" - : map unVersion supportedGhcVersions - - Just v -> - Right v - - defaultToAll :: Args -> Args - defaultToAll args = - if argBuildVersions args == mempty && argBuildServer args == False - then Args (reverse supportedGhcVersions) True -- reverse to build latest first - else args - - desc :: String - desc = - "Install haskell-code-indexer executables with the GHC version they were" - <> " compiled with appended to their name. Builds everything if you don't" - <> " specify options. Note that if you already have an indexer executable" - <> " without the GHC version appended in your Stack's local bin" - <> " it will be deleted." - --- * Build - -main :: IO () -main = - run =<< cliArgs - -run :: Args -> IO () -run args = do - putStrLn (startupNotice args) - when (argBuildServer args) buildServer - for_ (argBuildVersions args) buildVersion - -startupNotice :: Args -> String -startupNotice args = - unlines - $ "Building:" - : (if argBuildServer args - then [" + haskell-code-explorer"] - else mempty) - <> map versionEntry (argBuildVersions args) - where - versionEntry :: Version -> String - versionEntry v = - " + haskell-code-indexer-" <> unVersion v - -buildServer :: IO () -buildServer = - void $ execStack ["build", "--copy-bins", "haskell-code-explorer:haskell-code-server"] - -buildVersion :: Version -> IO () -buildVersion v = do - execStackWithVersion_ v ["build", "--copy-bins", "haskell-code-explorer:haskell-code-indexer"] - localBinDir <- getLocalBin - - let - -- exe is "exe" on Windows and "" otherwise - fromFile = localBinDir "haskell-code-indexer" <.> exe - toFile = localBinDir "haskell-code-indexer-" ++ unVersion v <.> exe - - copyFile fromFile toFile - removeFile fromFile - -exe :: String -#if defined(mingw32_HOST_OS) -exe = "exe" -#else -exe = "" -#endif - --- | E.g. @"/home/user/bin"@. -getLocalBin :: IO FilePath -getLocalBin = do - stackLocalDir' <- decodeUtf8 <$> execStack ["path", "--stack-yaml=stack.yaml", "--local-bin"] - pure $ trimEnd (T.unpack stackLocalDir') - --- | Uses the stack.yaml for the given @Version@. -execStackWithVersion_ :: Version -> [String] -> IO () -execStackWithVersion_ v args = do - let stackFile = "stack-" ++ unVersion v ++ ".yaml" - void $ execStack (("--stack-yaml=" ++ stackFile) : args) - -execStack :: [String] -> IO ByteString -execStack = - fmap LBS.toStrict . readProcessStdout_ . proc "stack" - -trimEnd :: String -> String -trimEnd = dropWhileEnd isSpace diff --git a/stack-8.0.2.yaml b/stack-8.0.2.yaml deleted file mode 100644 index 591dbd7..0000000 --- a/stack-8.0.2.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-9.14 -packages: -- '.' -extra-deps: - - servant-0.12.1 - - servant-server-0.12 - - cabal-helper-0.8.0.2 diff --git a/stack-8.2.2.yaml b/stack-8.2.2.yaml deleted file mode 100644 index 3815030..0000000 --- a/stack-8.2.2.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-11.3 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -extra-deps: - - cabal-plan-0.4.0.0 - - pretty-show-1.8.2 diff --git a/stack-8.4.3.yaml b/stack-8.4.3.yaml deleted file mode 100644 index d766956..0000000 --- a/stack-8.4.3.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-12.12 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.4.4.yaml b/stack-8.4.4.yaml deleted file mode 100644 index c7fc9cc..0000000 --- a/stack-8.4.4.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-12.16 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.6.3.yaml b/stack-8.6.3.yaml deleted file mode 100644 index 498a9da..0000000 --- a/stack-8.6.3.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-13.0 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.6.4.yaml b/stack-8.6.4.yaml deleted file mode 100644 index 28009ab..0000000 --- a/stack-8.6.4.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-13.12 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml deleted file mode 100644 index f59b52d..0000000 --- a/stack-8.6.5.yaml +++ /dev/null @@ -1,7 +0,0 @@ -resolver: lts-14.1 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - cabal-plan-0.4.0.0 diff --git a/stack-8.8.3.yaml b/stack-8.8.3.yaml deleted file mode 100644 index 4ea255c..0000000 --- a/stack-8.8.3.yaml +++ /dev/null @@ -1,12 +0,0 @@ -resolver: lts-15.4 -packages: -- '.' -- 'vendor/cabal-helper-0.8.1.2' -allow-newer: true -extra-deps: - - haddock-library-1.7.0@sha256:8f230ebb680b559256d9c18ce4942ba5bf220b167804b4ebd5cc9e47cc4973cd - - cabal-install-3.0.0.0@sha256:5e3c4376e53c06521cca2c037074423dbb967e228af6174bf842ff38aa82b035 - - git: https://github.com/haskell/hackage-security - commit: 2057cdf2abba852881cd9d055c96f03cd8c829e7 - subdirs: - - hackage-security diff --git a/stack.yaml b/stack.yaml index f59b52d..3c6d5ae 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,7 @@ -resolver: lts-14.1 +resolver: nightly-2022-06-06 packages: - '.' -- 'vendor/cabal-helper-0.8.1.2' +- 'vendor/cabal-helper' allow-newer: true extra-deps: - - cabal-plan-0.4.0.0 + - cabal-plan-0.7.2.1 -- cgit v1.2.3