Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquid-Dev-Mode prototype #1706

Merged
merged 4 commits into from
Jul 21, 2020
Merged

Liquid-Dev-Mode prototype #1706

merged 4 commits into from
Jul 21, 2020

Conversation

adinapoli
Copy link
Collaborator

This PR has to be intended as a prototype and can be easily improved. To name something suboptimal, the current Setup.hs is the same for each package and is duplicated everywhere. Also, the actual value of the LIQUID_DEV_MODE env var is not taken into account, but maybe it's nice if users could toggle dev mode by passing LIQUID_DEV_MODE=true and LIQUID_DEV_MODE=false.

This PR is a first attempt in speeding up the LiquidHaskell development experience when using the new GHC plugin. The main idea takes inspiration from the stages of a compiler (think GHC) where usually we build a "stage0" compiler to be used to compile the stage1. Similarly we introduce, for each of the liquid-* packages, a custom Setup.hs module that disables building the target modules if the LIQUID_DEV_MODE env var is set.

Usage and recommended workflow

This is how one would use this:

  • To begin with, perform a full build of all the libraries, by doing either cabal v2-build or stack build, without specifying any extra environment variables from the command line. This is morally equivalent to our "stage 0".

  • At this point, the content of the liquid-* packages is considered "trusted" and "frozen", until we don't force another full, non dev build;

  • In order to quickly test changes to the liquidhaskell library without recompiling the liquid-* packages, we user need to build by passing the LIQUID_DEV_MODE env var as part of the build command. Examples:

Stack

LIQUID_DEV_MODE=true stack build

Cabal

LIQUID_DEV_MODE=true cabal v2-build

It's also possible (but not recommended) to add LIQUID_DEV_MODE to .bashrc or similar,but this would permanently disable building the liquid-* packages, and this might silently mask breaking changes to the liquidhaskell library that would manifest only when compiling these other packages.

  • If the user wishes to force building all the libraries again, it's sufficient to issue the same builds commands without the LIQUID_DEV_MODE.

@kosmikus
Copy link
Collaborator

Tried this with cabal today, and it seems to work.

@ranjitjhala
Copy link
Member

Super minor point @adinapoli -- can you also add the above text to the document for how to generate liquid-* modules so we have all the notes on how to work with these in one place? thanks!!!

@adinapoli
Copy link
Collaborator Author

can you also add the above text to the document for how to generate liquid-* modules so we have all the notes on how to work with these in one place? thanks!!!

Good point, although I am wondering whether or not that document would be the right place for it. What about another LIQUID_DEV_MODE.md markdown document, that we can in the future reference from the main docs entry point?

@kosmikus
Copy link
Collaborator

I think the most important aspect here is that the documentation on how to use the dev mode does not remain hidden in the description of this PR. The second most important aspect is discoverability. So creating a new file is fine from my perspective. But ideally, already place a link to it from somewhere (or even several places), so that it can be found.

@ranjitjhala
Copy link
Member

ranjitjhala commented Jul 16, 2020 via email

This commit factors out the content of the custom 'Setup.hs', which was
the same for each and every module into a liquidhaskell module we can
then reuse by using the 'setup-depends' directive.
@adinapoli
Copy link
Collaborator Author

adinapoli commented Jul 20, 2020

@ranjitjhala @kosmikus Ok, I have added a documentation section in the "new" documentation that Ranjit is working on, as part of the "Developers' guide" inside docs/mkDocs/docs/develop.md, I hope that's OK.

As I was at it, I have factored the content of each and every Setup.hs into a separate module as part of the liquidhaskell library, and I would argue that's much cleaner now.

@ranjitjhala ranjitjhala merged commit a4fa7a2 into develop Jul 21, 2020
@adinapoli adinapoli deleted the adinapoli/liquid-dev-mode branch July 21, 2020 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants