This repository was archived by the owner on Oct 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 206
Implement the HIE Bios #1126
Merged
Merged
Implement the HIE Bios #1126
Changes from 78 commits
Commits
Show all changes
346 commits
Select commit
Hold shift + click to select a range
b054fe9
Remove SrcUtils import
mpickering 3ff19ba
Use System.Directory makeAbsolute rather than ghc-mod home spun version
mpickering f163539
Remove unused record field
mpickering fac0e95
Remove another LightGhc abstraction
mpickering 4231b0b
Add missing compat file woops
mpickering 8fe05bb
Implement ExceptionMonad in HIE rather than ghc-mod
mpickering 3e907c8
Replace GM.Options with CradleOpts
mpickering ab595a0
Remove ghc-mod dependencies
mpickering 94eaa52
Remove CPP from artifact map
mpickering 0f0c250
Merge remote-tracking branch 'origin/master' into hie-bios
mpickering 671d5ef
Merge remote-tracking branch 'bubba/window-progress' into hie-bios
mpickering 19a106d
Add status update for init cradle
mpickering e001a1b
Better progress reporting
mpickering 8cd96b1
Progress when initialising a cradle as well
mpickering 5180d25
Make haskell-lsp negotiate window/progress capability
mpickering 973d4a2
Rework MonadIde class
lukel97 ed9fefa
reworking withprogress
mpickering 4ec8a13
Add shebangs to hie-bios wrappers
expipiplus1 3b41a98
Fix the liquid haskell reporting
mpickering 9e7af09
Update haskell-lsp
mpickering 0f507e6
Merge remote-tracking branch 'origin/master' into hie-bios
mpickering e132d54
fix dhall config
mpickering 5373788
Remove inexplicable setting of -fdefer-type-errors
mpickering b9ebbec
Fix plugins
mpickering ca06bd6
Fix module leaks
mpickering 4f886df
Revert "Fix module leaks"
mpickering daf0be5
Fix build
mpickering 8e44c14
fix compilation with hie-plugin-api and remove hare submodules
wz1000 30fb1e7
remove ghc-mod deps
wz1000 5ab587c
Merge branch 'master' of https://github.com/haskell/haskell-ide-engin…
wz1000 40342a0
Get it to compile
wz1000 cd882b6
Re-enable HaRe
wz1000 ca53013
Fix HaRe, remove module hash
wz1000 6f905aa
Restore HaRe tests, get tests to compile
wz1000 a305239
use upstream for hie-bios
wz1000 580b188
fix HaRe submodule
wz1000 2c8b51b
Fix some tests and completions/session saving
wz1000 0438ac0
Merge branch 'simpler-completion' into hie-bios-wz1000
wz1000 9c7365f
make ghcSession an IORef again
wz1000 c5f7d28
fix some more tests and embarrassing implmentation of withMappedFile
wz1000 775eca2
"ghcmod" -> "bios"
wz1000 d25984c
fix more tests
wz1000 2bd16d8
fix more tests redux
wz1000 f5a0308
Fix HaRe unit tests
wz1000 94c3bcf
Set defer type errors and report the resulting warnings as errors
wz1000 092c7a2
Fix most code action tests
wz1000 805961d
Fix another code action test
wz1000 0d3af55
Merge pull request #4 from wz1000/hie-bios-wz1000
mpickering 2feab0a
Merge branch 'simpler-completion' into hie-bios-wz1000
wz1000 c619b66
Merge branch 'simpler-completion' into hie-bios-wz1000
wz1000 3d96c12
make it build
wz1000 a78b6a3
make it build
wz1000 1b1bf14
Merge branch 'master' of https://github.com/haskell/haskell-ide-engin…
wz1000 1cbae78
Merge branch 'master' of https://github.com/haskell/haskell-ide-engin…
wz1000 0bfd54f
Merge pull request #5 from wz1000/hie-bios-wz1000
mpickering fb61925
Fix cabal.project warning
mpickering 373a474
Update src/Haskell/Ide/Engine/Channel.hs
mpickering a112dbb
Merge remote-tracking branch 'mpickering/hie-bios'
fendor 6d8bd90
Merge remote-tracking branch 'upstream/master'
fendor 65d700b
Fix hieWrapper
fendor 7eb37df
Update hie-bios
fendor 2e36879
Update HIE to use current master of hie-bios
fendor c243b50
Avoid persisting Virtual Files after closing
fendor 98d8668
Undo changes to logging utility functions
fendor e83022e
Remove unused imports and language extensions
fendor 6d9df0f
Add vomit as a synonym for bios-verbose
fendor 0738eb4
Silence or fix all warnings
fendor 4031ac6
Generate hie.yaml to speed up unit-tests
fendor 03473c9
Fix stack.yaml files to include required dependencies
fendor 5a5648d
Remove submodule hie-bios
fendor 5e09ef9
Fix compat for ghc 8.4.4
fendor 9039bcf
Merge hie bios (#3)
fendor e631b58
Fix builds for stack
fendor c401bb2
Fix stack for ghc 8.2.2
fendor 4ff9a38
Unbreak build for ghc 8.2.2
fendor df764c3
Remove unused subfolders
fendor 50f4fe9
Fix tests by editing various cabal files
fendor 1cc08c4
Catch any ghc exception when initialising
fendor 6df6c64
Use cradle to detect used ghc version
fendor 46a986a
Remove hoogle generate from CI because it crashes for ghc 8.2.2
fendor 52601c9
Implement workaround for https://github.com/mpickering/haskell-ide-en…
fendor 80270ff
Add missing filepath deps
fendor f91070d
Show error on client if initialisation of project failed
fendor f41edf2
Remove test case that can not succeed in this project
fendor d7403d2
Fix package plugin spec test
fendor 54becfd
Add hie-bios submodule
fendor 07f1dcd
Keep token stream and unset warning for missing home modules
fendor 3fb0985
Dont generate .ghc.env files by default
fendor 4c96f82
Disable HaRe casesplit test and code action
fendor 3f84a89
Update gitmodules url for hie-bios
fendor 794aa9a
Disable test for finding def across components
fendor bc5ff6f
Merge pull request #8 from fendor/merge-hie-bios
fendor 57737df
Update README to contain information about hie-bios
fendor 4afb084
Fix liquid test (#12)
fendor 3752ac9
Better README
fendor a7ec5fc
Dont enable profiling in cabal.project (#17)
fendor 568cca1
Enable pedantic CI/CD
fendor 7fbacf7
Remove undefined with well defined result value
fendor db18602
Merge pull request #13 from fendor/document-hie-bios
mpickering dd9cbdd
Fix makeRefactorResult
fendor 15037a4
Try to fix makeRefactorResult again
fendor 48d29b1
Undo changes to shell.nix
fendor 10355fe
Merge haskell-lsp-0.16 update
lukel97 fdb4696
Merge pull request #28 from bubba/hie-bios-haskell-lsp-0.16
lukel97 3be0213
Fix build for stack ghc 8.2.2
fendor 40b6073
Changes from my local branch
mpickering 2505e45
Delete unused function
mpickering c1824ed
Remove duplication of initializeSession
mpickering f9756db
Refine module caching variables
mpickering 87eb220
Init before caching
mpickering 5642252
Catch GhcException
mpickering 9e3a4e0
Catch errors in cradle initialisation
mpickering 5b56c15
Remove unused Imports from GhcModuleCache
fendor 2f006c7
Fix minor diagnostics order in test-cases
fendor fa65724
Move Cradle initialisation into withProgress callback
fendor 4f61966
Add more documentation for hie-bios functions
fendor eb3d32e
Merge pull request #31 from fendor/fix-missing-documentation
mpickering 48958d8
Replace tracing with appropiate logging
fendor c52a982
Update hie-bios to current master
fendor 2ff3893
Merge pull request #33 from fendor/hie-bios-master
mpickering 8dae303
documentation about profiling
mpickering 172a557
Merge branch 'master' using haskell-lsp-0.17
jneira f561472
Integrate changes from hie-bios
jneira 582ff05
Add intermediate progress report notification
jneira 1cf6ab7
Correct progress title of second request
jneira 3dcedf8
Merge branch 'master' (incoming 0.13 release)
jneira 89f8d83
Merge pull request #41 from jneira/hie-bios-haskell-lsp-0.17
fendor 52940fb
Use cabal-helper 1.0
fendor 26d0ddd
Update .gitmodules to use DanielG's cabal-helper
fendor a1bac07
Re-implement cabal-helper cradle
fendor 294c401
Update hie-bios
fendor 52b60ba
Fix builds for stack
fendor ae844a0
Change HaRe submodule to use different remote
fendor 7def514
Update .gitmodules
fendor 799bfd6
Fix multi-component support for cabal-helper cradle
fendor 408b0b5
Add real error messages
fendor 2fdcb3a
Add none-cradle if file does not belong to any package
fendor c41eed0
Fix cabal-helper multi-packages support
fendor 2ffb17e
More Documentation
fendor b72e606
Refactor functions and add Documentation
fendor 91a56b0
Improve comments
fendor b28e944
Upgrade stack version in circleci to 2.1.3
fendor c84b33f
.gitmodules, use https instead of ssh
fendor ed6d66b
Fix stack for ghc 8.6.5
fendor 83c5090
Bump cabal-helper version to latest master a1c4a37
fendor cc40b6f
Implement perfect match for c-h-h cradle discovery
fendor 7e7bd1d
Remove unused Language Pragma
fendor 92add4e
Fix stripFilePath function
fendor c45714e
Remove comments from .gitmodules
fendor 0517eaa
Implement the ancestors function
fendor 97e6617
If not package can be found, return none-cradle
fendor b775f13
Prefer canonicalisePath over normalise
fendor b4f2326
Remove redundant check for stack installation
fendor 9ceec1e
Move function relativeTo to the bottom of the file
fendor 4309653
Move utility functions to the bottom of Cradle.hs
fendor 9ee8156
Add exhautive documentation for Cabal-Helper-Helper implementation
fendor 232e7d6
Update Documentation, e.g. fix typos and add explanations
fendor e1da603
Merge pull request #37 from mpickering/profiling-docs
mpickering 3ed7833
Fix typo in documentation of the project root discovery
fendor a19ff9c
Catch exceptions on initialisation and add explicit import list
fendor 4a80ec3
Rework comments that do not make sense
fendor d79e033
Merge pull request #26 from fendor/cabal-helper-helper
fendor 6a9b727
Add proper support for the 'none' cradle
mpickering 52691a6
Merge pull request #40 from mpickering/none-cradle
mpickering e3fa438
Deal properly with increased GHC verbosity.
mpickering 3bfd965
Add eventlog tracing for ghc-events-analyse
mpickering e0a30bf
typo fix
mpickering d109948
Remove mapFileFromVFS and some more refactoring in this area
mpickering e8b4bee
Fix version number back to 1.0
mpickering b0a01e7
Track changes to haskell-lsp
mpickering 9fc2dcc
Revert "Track changes to haskell-lsp"
mpickering 73fcf4b
Some documentation
mpickering 702a5f5
Fix profiling docs
mpickering 1ca4e0a
docs typo
mpickering d228c02
modifyModuleCache rather than setModuleCache
mpickering 523da4d
Revert "Revert "Track changes to haskell-lsp""
mpickering dc8dab1
Fix module cache
mpickering 714f42a
Use direct cradle for tests when stack is not available
expipiplus1 dcf81a1
Use the LSP provided root directory to find the cradle
lukel97 3795616
Remove unused imports
jneira 532aa60
Demote no access to virtual file to debug messages
fendor 61b6ba8
Filter out projects if the build tool is not installed
lukel97 d30d058
Display hie.yaml parse errors in LSP
lukel97 32a6739
Add a comment
lukel97 c2e4bfc
Merge pull request #56 from haskell/hie-yaml-parse-error
lukel97 c6e7f31
Detect files in main-is of components
lukel97 924de7c
Use fork for cabal-helper submodule with cabal v2 fixes
lukel97 d467264
Remove writeMTS
mpickering a0296ae
Merge remote-tracking branch 'upstream/master' into wip/friday-fixes
mpickering 58c4019
Merge remote-tracking branch 'mpickering/hie-bios' into wip/friday-fixes
mpickering 8c3c350
Fix HaRe submodule
mpickering 4c5308b
Remove eventlog, by default, should add a way to turn this on with a …
mpickering 7541d1e
Merge pull request #44 from mpickering/wip/friday-fixes
mpickering 7c206de
Fix name shadowing
reactormonk c983469
Move errorHandlers to GhcUtils
jneira 4bd1e75
Use errorHandlers in cradle intialization
jneira 90e1444
Correct typo
jneira 7681038
Remove unused export
jneira e212df1
Log SourceError in cradle init
jneira d3d8ac2
Update hie-plugin-api for use with HaRe (#61)
alanz 41b9cab
Fix import dirs of c-h-h (#55)
fendor 8701f8b
specific ghc-exactprint for all-hies HaRe
reactormonk 9f5ef1b
Update cabal-helper to include changes from dxld/master
lukel97 fea7271
Create empty hie.yaml to trigger a parse error
jneira 62267a5
Display type of cradle in "initializing cradle" message
lukel97 361f6ef
Merge pull request #71 from jneira/fix-hie-bios-test
lukel97 ec3d362
Fix stack build
fendor b0b0c95
Fix init cradle message changed with 62267a
jneira 16f2580
Restore typed holes substitution list from master
jneira 31209a6
Remove HaRe, move some utils from it into FromHaRe module
alanz 9ce648a
Removed HaRe submodule
alanz a173297
Working on tests
alanz 25bcde6
Some minor test tweaks
alanz 43cf0d1
Merge pull request https://github.com/mpickering/haskell-ide-engine/p…
fendor bc079e9
Display which cradle was used when testing for mismatching GHC versions
lukel97 bd40ac3
Add back much needed import
lukel97 03d9bf2
Add some comments for 'only' test
lukel97 0d44704
Update to haskell-lsp 0.19.0.0
mpickering 3ff767e
Update to use hie-bios 0.3.0 from hackage
fendor 0effcf4
Create a custom hie.yaml for testdata
fendor 305b2d5
Remove unused dependency rope-utf16-splay
fendor 67d0903
Fix the expected indefinite progress message
fendor 8e91d80
Comment out tests that depend on HaRe
fendor 9819903
Add CodeActionRename as a executable to test project
fendor ae8aa22
Fix wrapper tests when cabal is installed
lukel97 b7dfd2b
Merge remote-tracking branch 'upstream/master' into merge-upstream
fendor 1b9767d
Remove unused import of HIE.Bios.Types
fendor 8e0241c
Patch test case for whilst HaRe is gone
lukel97 49582c2
Disable type definition test across modules
fendor 3476f19
Add explicit hie.yaml to force the project type
fendor 1a05e42
Merge pull request #86 from fendor/add-hie-yaml-for-wrapper-tests
lukel97 501cb28
Merge pull request https://github.com/mpickering/haskell-ide-engine/p…
fendor cd0d1eb
Update hie-bios version to at least 0.3.2
fendor a79ec33
Clarify difference between lsp and hie-bios configuration
lukel97 c5b8a4b
Various updates to sync with hie-bios
jneira b1363df
Make 3.0.0.0 the required minimum version for windows
jneira c4c04ce
Update build docs to match hie-bios branch
jneira 89fe99d
Correct phrasing in README
jneira 20255f2
Add table for automatic cradle discovery
lukel97 84e645c
Remove unused code for logging setup
fendor c94b45e
Update multi-cradle instructions
fendor cd3cd02
Remove unused bios log level function
fendor c193254
Remove unused .hie-bios files
fendor df1ac8a
Remove unneeded floskell:newer in cabal.project
fendor 6cbadc7
Remove commented out code (https://github.com/mpickering/haskell-ide-…
fendor 5dfc446
Remove unused old code
fendor 6f1c220
Minor format changes
fendor 8e9bb3d
Rename GhcModPluginSpec to GenericPluginSpec
fendor 58ac672
Fix project selected for plain hs files
lukel97 bfedd03
Merge pull request #92 from haskell/project-config-readme
lukel97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
packages: | ||
./ | ||
./hie-plugin-api/ | ||
./hie-bios/ | ||
./haskell-lsp/ | ||
./lsp-test | ||
|
||
./submodules/HaRe | ||
./submodules/brittany | ||
./submodules/cabal-helper/ | ||
./submodules/floskell | ||
./submodules/ghc-mod/ | ||
./submodules/ghc-mod/core/ | ||
./submodules/floskell | ||
|
||
allow-newer: floskell:all | ||
fendor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule haskell-lsp
added at
854fd8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# NB: don't set `language: haskell` here | ||
fendor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for. | ||
env: | ||
- CABALVER=1.24 GHCVER=8.0.2 | ||
- CABALVER=2.0 GHCVER=8.2.2 | ||
- CABALVER=2.2 GHCVER=8.4.4 | ||
- CABALVER=2.4 GHCVER=8.6.3 | ||
- CABALVER=head GHCVER=head # see section about GHC HEAD snapshots | ||
|
||
matrix: | ||
allow_failures: | ||
- env: CABALVER=head GHCVER=head | ||
|
||
# Note: the distinction between `before_install` and `install` is not important. | ||
before_install: | ||
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc | ||
- travis_retry sudo apt-get update | ||
- travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER happy alex | ||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH | ||
|
||
install: | ||
- cabal --version | ||
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" | ||
- travis_retry cabal update | ||
- cabal install --only-dependencies --enable-tests --enable-benchmarks | ||
|
||
# Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail. | ||
script: | ||
- if [ -f configure.ac ]; then autoreconf -i; fi | ||
- cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging | ||
- cabal build # this builds all libraries and executables (including tests/benchmarks) | ||
- cabal test | ||
- cabal check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
2018-12-18 v0.0.0 | ||
* First release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Copyright (c) 2009, IIJ Innovation Institute Inc. | ||
fendor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
* Neither the name of the copyright holders nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# hie-bios | ||
|
||
`hie-bios` is the way which `hie` sets up a GHC API session. | ||
|
||
Its design is motivated by the guiding principle: | ||
|
||
> It is the responsibility of the build tool to describe the environment | ||
> which a package should be built in. | ||
|
||
This means that it is possible | ||
to easily support a wide range of tools including `cabal-install`, `stack`, | ||
`rules_haskell`, `hadrian` and `obelisk` without major contortions. | ||
`hie-bios` does not depend on the `Cabal` library nor does not | ||
read any complicated build products and so on. | ||
|
||
How does a tool specify a session? A session is fully specified by a set of | ||
standard GHC flags. Most tools already produce this information if they support | ||
a `repl` command. Launching a repl is achieved by calling `ghci` with the | ||
right flags to specify the package database. `hie-bios` needs a way to get | ||
these flags and then it can set up GHC API session correctly. | ||
|
||
Futher it means that any failure to set up the API session is the responsibility | ||
of the build tool. It is up to them to provide the correct information if they | ||
want HIE to work correctly. | ||
|
||
## Explicit Configuration | ||
|
||
The user can place a `hie.dhall` file in the root of the workspace which | ||
describes how to setup the environment. For example, to explicitly state | ||
that you want to use `stack` then the configuration file would look like: | ||
|
||
``` | ||
{ cradle = CradleConfig.Stack {=} } | ||
``` | ||
|
||
If you use `cabal` then you probably need to specify which component you want | ||
to use. | ||
|
||
``` | ||
{ cradle = CradleConfig.Cabal { component = Some "lib:haskell-ide-engine" } } | ||
``` | ||
|
||
Or you can explicitly state the program which should be used to collect | ||
the options by supplying the path to the program. It is interpreted | ||
relative to the current working directory if it is not an absolute path. | ||
|
||
``` | ||
{ cradle = CradleConfig.Bios { prog = ".hie-bios" } } | ||
``` | ||
|
||
The complete dhall configuration is described by the following type | ||
|
||
``` | ||
< cradle : | ||
< Cabal : { component : Optional Text } | ||
| Stack : {} | ||
| Bazel : {} | ||
| Obelisk : {} | ||
| Bios : { prog : Text} | ||
| Default : {} > > | ||
``` | ||
|
||
## Implicit Configuration | ||
|
||
There are several built in modes which captures most common Haskell development | ||
scenarios. If no `hie.dhall` configuration file is found then an implicit | ||
configuration is searched for. | ||
|
||
### Priority | ||
|
||
The targets are searched for in following order. | ||
|
||
1. A specific `hie-bios` file. | ||
2. An `obelisk` project | ||
3. A `rules_haskell` project | ||
4. A `stack` project | ||
4. A `cabal` project | ||
5. The default cradle which has no specific options. | ||
|
||
### `cabal-install` | ||
|
||
The workspace root is the first folder containing a `cabal.project` file. | ||
|
||
The arguments are collected by running `cabal v2-repl`. | ||
|
||
If `cabal v2-repl` fails, then the user needs to configure the correct | ||
target to use by writing a `hie.dhall` file. | ||
|
||
### `rules_haskell` | ||
|
||
The workspace root is the folder containing a `WORKSPACE` file. | ||
|
||
The options are collected by querying `bazel`. | ||
|
||
### `obelisk` | ||
|
||
The workspace root is the folder containing a `.obelisk` directory. | ||
|
||
The options are collected by running `ob ide-args`. | ||
|
||
### `bios` | ||
|
||
The most general form is the `bios` mode which allows a user to specify themselves | ||
which flags to provide. | ||
|
||
In this mode, an executable file called `.hie-bios` is placed in the root | ||
of the workspace directory. The script takes one argument, the filepath | ||
to the current file we want to load into the session. The script returns | ||
the correct arguments in order to load that file successfully. | ||
|
||
A good guiding specification for this file is that the following command | ||
should work for any file in your project. | ||
|
||
``` | ||
ghci $(./hie-bios /path/to/foo.hs) /path/to/foo.hs | ||
``` | ||
|
||
This is useful if you are designing a new build system or the other modes | ||
fail to setup the correct session for some reason. For example, this is | ||
how hadrian (GHC's build system) is integrated into HIE. | ||
|
||
|
||
## Relationship with `ghcid` | ||
|
||
The design of `hie-bios` is inspired by `ghcid`. Like `ghcid`, it does not depend | ||
on any of the tools it supports. The success of `ghcid` is that it works reliably | ||
in many situations. This is because of the fact that it delegates complicated | ||
decisions about a build to the build tool. | ||
|
||
`ghcid` could be implemented using `hie-bios` using the `ghci $(./hie-bios Main.hs) Main.hs` | ||
idiom described earlier. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages: . | ||
fendor marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let pkgs = import ./nix {}; in pkgs.packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{-# LANGUAGE DeriveDataTypeable #-} | ||
|
||
module Main where | ||
|
||
import Config (cProjectVersion) | ||
|
||
import Control.Exception (Exception, Handler(..), ErrorCall(..)) | ||
import qualified Control.Exception as E | ||
import Data.Typeable (Typeable) | ||
import Data.Version (showVersion) | ||
import System.Directory (getCurrentDirectory) | ||
import System.Environment (getArgs) | ||
import System.Exit (exitFailure) | ||
import System.IO (hPutStr, hPutStrLn, stdout, stderr, hSetEncoding, utf8) | ||
|
||
import HIE.Bios | ||
import HIE.Bios.Types | ||
import HIE.Bios.Check | ||
import HIE.Bios.Debug | ||
import Paths_hie_bios | ||
|
||
---------------------------------------------------------------- | ||
|
||
progVersion :: String | ||
progVersion = "biosc version " ++ showVersion version ++ " compiled by GHC " ++ cProjectVersion ++ "\n" | ||
|
||
ghcOptHelp :: String | ||
ghcOptHelp = " [-g GHC_opt1 -g GHC_opt2 ...] " | ||
|
||
usage :: String | ||
usage = progVersion | ||
++ "Usage:\n" | ||
++ "\t biosc check" ++ ghcOptHelp ++ "<HaskellFiles...>\n" | ||
++ "\t biosc version\n" | ||
++ "\t biosc help\n" | ||
|
||
---------------------------------------------------------------- | ||
|
||
data HhpcError = SafeList | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is a |
||
| TooManyArguments String | ||
| NoSuchCommand String | ||
| CmdArg [String] | ||
| FileNotExist String deriving (Show, Typeable) | ||
|
||
instance Exception HhpcError | ||
|
||
---------------------------------------------------------------- | ||
|
||
main :: IO () | ||
main = flip E.catches handlers $ do | ||
hSetEncoding stdout utf8 | ||
args <- getArgs | ||
cradle <- getCurrentDirectory >>= findCradle | ||
let cmdArg0 = args !. 0 | ||
remainingArgs = tail args | ||
opt = defaultOptions | ||
res <- case cmdArg0 of | ||
"check" -> checkSyntax opt cradle remainingArgs | ||
"expand" -> expandTemplate opt cradle remainingArgs | ||
"debug" -> debugInfo opt cradle | ||
"root" -> rootInfo opt cradle | ||
"version" -> return progVersion | ||
cmd -> E.throw (NoSuchCommand cmd) | ||
putStr res | ||
where | ||
handlers = [Handler (handleThenExit handler1), Handler (handleThenExit handler2)] | ||
handleThenExit handler e = handler e >> exitFailure | ||
handler1 :: ErrorCall -> IO () | ||
handler1 = print -- for debug | ||
handler2 :: HhpcError -> IO () | ||
handler2 SafeList = return () | ||
handler2 (TooManyArguments cmd) = do | ||
hPutStrLn stderr $ "\"" ++ cmd ++ "\": Too many arguments" | ||
handler2 (NoSuchCommand cmd) = do | ||
hPutStrLn stderr $ "\"" ++ cmd ++ "\" not supported" | ||
handler2 (CmdArg errs) = do | ||
mapM_ (hPutStr stderr) errs | ||
handler2 (FileNotExist file) = do | ||
hPutStrLn stderr $ "\"" ++ file ++ "\" not found" | ||
xs !. idx | ||
| length xs <= idx = E.throw SafeList | ||
| otherwise = xs !! idx |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in mpickering#14