-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add stan
and weeder
to our dev. workflow
#3710
Comments
I wondered if this was correctly classified as a newcomers issue, until I read the detailed description. Sounds good. 😄 |
To add to this ticket, a potential future work: investigate EDIT: Why is it useful? We can get a deeper understanding of our dependency graph, which is particularly interesting for learning about what all of our 'chunk transformers'+/printers rely on. In other words, we can learn about how we actually go about transforming the SRS-focused knowledge into code, very easily. Aside: Right now, we do this in Haskell, but this is perhaps something we can do internally later on too. |
Added `stan` dependencies to stack.yaml #3710
|
For further progress on Certainly we shouldn't be relying on lazyness in a fundamental way, so if glassbr causes an infinite loop, we're doing something very strange! But that might be very hard to find and fix. Re: |
EDIT: As of #3801, you won't need to hack the Makefile, you can just use Regarding enabling
default-extensions:
- StrictData
The only issue involves the following definition: Drasil/code/drasil-data/lib/Data/Drasil/Concepts/Physics.hs Lines 65 to 66 in 3d07aae
Ignoring the actual semantic contents of the chunk definition, the issue here is the self-referencing! So, let's break the definition for now: chgInVelocity = dccWDS "chgInVelocity" (cn "change in velocity")
(S "FIXME")
*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace:
Language.Drasil.Chunk.Concept.Core.uid,
called from Language.Drasil.Chunk.NamedIdea.nw,
called from Language.Drasil.Chunk.Concept.cw,
called from Language.Drasil.Chunk.Unital.uc,
called from Drasil.GlassBR.Unitals.standOffDist,
called from Drasil.GlassBR.Unitals.CAF:standOffDist_q1
--> evaluated by: Language.Drasil.Chunk.NamedIdea.nw,
called from Language.Drasil.Chunk.Concept.cw,
called from Language.Drasil.Chunk.DefinedQuantity.dqdWr,
called from Language.Drasil.Chunk.Constrained.constrained',
called from Drasil.GlassBR.Unitals.standOffDist,
called from Drasil.GlassBR.Unitals.CAF:standOffDist_q
--> evaluated by: Language.Drasil.Chunk.NamedIdea.nw,
called from Language.Drasil.Chunk.Concept.cw,
called from Language.Drasil.Chunk.DefinedQuantity.dqdWr,
called from Language.Drasil.Chunk.UncertainQuantity.uq,
called from Drasil.GlassBR.Unitals.standOffDist,
called from Drasil.GlassBR.Unitals.CAF:standOffDist1
--> evaluated by: Drasil.GlassBR.Unitals.standOffDist,
called from Drasil.GlassBR.Unitals.CAF:standOffDist
*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace:
Language.Drasil.Chunk.Concept.Core.uid,
called from Language.Drasil.Chunk.NamedIdea.nw,
called from Language.Drasil.Chunk.Concept.cw,
called from Language.Drasil.Chunk.Unital.uc,
called from Drasil.GlassBR.Unitals.standOffDist,
called from Drasil.GlassBR.Unitals.CAF:standOffDist_q1
glassbr: <<loop>>
make: *** [Makefile:296: glassbr_gen] Error 1 This is interesting. See how the first part and the last part are identical? It means that the issue lies in one of those lines. With Drasil/code/drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs Lines 103 to 105 in 3d07aae
Thankfully, there is nothing too crazy there, let's look at the only non-trivial thing there ( Drasil/code/drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs Lines 371 to 373 in 3d07aae
Aha! Going into the definition of From here, the process to fixing all the issues is as follows:
|
Also, there is enough output messages through the terminal that your console's rendering engine will be the throttle on being able to run the programs, so I would advise against using VS Code's built-in terminal emulator. It is considerably slower compared to a standard terminal and also locks up while stuff is printing to its console. I suppose it's the overhead in the rendering engine and immediate-flushing of data that is causing VS Code to be comparatively slower. |
Currently, both |
I am currently checking out all of the unused code found by |
What is the state of this issue in general? Are |
It is still manual. Weeder (weeder reports what code is not used) will need a further look as just because we don't use a piece of code doesn't mean it should be removed. The only thing for stan is that it wants us to make everything strict data which may take a while to do. |
Motivation: #3700
Objective: Adding more static analysis tools (here,
stan
andweeder
) to our development workflow to help us automatically catch common mistakes.stan
andweeder
require HIE files post-compilation of a project before they can be used.Approximate steps:
stan
andweeder
need. - Write hie info #3708stan
locally.stan
.stan
to our CI andpr_ready
target of the Makefile.stan
-related information everywhere in our New Workspace guide and the wiki, as needed.weeder
.Notes:
One more time, with extra information:
stan
andweeder
need. - Write hie info #3708stan
locally. Careful!stan
must be compiled with the same GHC version we intend to use for compiling Drasil. As of Update stackage release: 20.20 (GHC 9.2.7) -> 20.26 (GHC 9.2.8) #3707, we're going to use GHC 9.2.8, but I could not getstan
installed locally using GHC 9.2.X, so I had to update our project further to the GHC 9.4.X series by switching our targeted stack release to lts-21.25 (you can use the script found in Update stackage release: 20.20 (GHC 9.2.7) -> 20.26 (GHC 9.2.8) #3707 to quickly update this too). Afterwards, you will need to add some dependencies to our mainstack.yaml
file in thecode
folder and runstack install stan
. That's what worked for me, but YMMV.stan
. After installingstan
, you should run it on all of ourdrasil-*
projects and the example projects. To get you started, you can runfind . -type d -name 'drasil-*' -exec sh -c 'cd {} && stan > stan.log' \;
to runstan
on alldrasil-
libraries, and then runcat drasil-X/stan.log
to read the console output for each respective library. It would be helpful to first go through each category of error and fix the reports by category rather than report. Two of our notable reports as of Apr. 2nd, 2024:stan
suggests adding theStrictData
language extension to make all of our data types strict, but I found that Drasil runs into an infinite loop! This will require some debugging.a+b*c
?). We will need to go through each area that related infix operators are used and come up with a binding order (fixity).stan
to our CI andpr_ready
target of the Makefile. Oncestan
reports no issues, we can integratestan
in our CI. You will need to addstan
execution on each of the drasil-related Haskell projects in the repo as a step in our Build CI (it won't be possible in our Lint CI because it requires build-related information). This should be done by creating a new Makefile target that does all thestan
-related execution, and running the new target in an extra CI step. This step should also be added as a dependency of ourpr_ready
Makefile target.stan
-related information everywhere in our New Workspace guide and the wiki, as needed.weeder
.The text was updated successfully, but these errors were encountered: