Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Move finding the package for a filepath #1750

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented Apr 22, 2020

Closes #1640

Currently, hie-wrapper uses the cradle type to find the ghc version to
use on the project. Cabal-Helper does not only return the cradle type
but also initialises the packages of the project, which may take a long
time since it starts building dependencies. Moreover, it causes
hie-wrapper to take way longer than necessary to find the project type,
and thus, the ghc version to use on the project.
This violates the isolation of the cradle, some work happens before
loading the options for a filepath, some during it.
This commit unifies the behaviour with hie-bios:

  • All the work happens during loading the options for the given
    filepath.

It speeds up the initial start-up of hie if users use the implicit
cradle discovery mechanism.
It makes the implementation a bit less hacky.

While there are behavioural changes, nothing should change for everyday
users.

Currently, hie-wrapper uses the cradle type to find the ghc version to
use on the project. Cabal-Helper does not only return the cradle type
but also initialises the packages of the project, which may take a long
time since it starts building dependencies. Moreover, it causes
hie-wrapper to take way longer than necessary to find the project type,
and thus, the ghc version to use on the project.
This violates the isolation of the cradle, some work happens before
loading the options for a filepath, some during it.
This commit unifies the behaviour with hie-bios:

  * All the work happens during loading the options for the given
    filepath.

It speeds up the initial start-up of hie if users use the implicit
cradle discovery mechanism.
It makes the implementation a bit less hacky.

While there are behavioural changes, nothing should change for everyday
users.
@fendor fendor requested a review from jneira April 22, 2020 09:18
@fendor fendor changed the title Cabal helper move initialisation Move finding the package for a filepath Apr 22, 2020
@fendor
Copy link
Collaborator Author

fendor commented Apr 22, 2020

@jneira This change is also relevant for https://github.com/haskell/haskell-language-server/
I will port it, once tests run on HIE

@jneira
Copy link
Member

jneira commented Apr 22, 2020

Cabal unix jobs are failing due to disk space, so i think the pr is good

@fendor
Copy link
Collaborator Author

fendor commented Apr 23, 2020

Small revision of the explanation, it only configures the projects. However, it crashes in hie-wrapper, if configuration fails, e.g. dependencies have conflicting version constraints.
Now we can correctly catch these exceptions and display them to the user, similar to how we catch exceptions during building units.

@fendor fendor merged commit 6dc7d43 into haskell:master Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hie-wrapper should not build all dependencies
2 participants