-
Notifications
You must be signed in to change notification settings - Fork 25
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
Generate Haskell code from the Agda spec #1315
base: main
Are you sure you want to change the base?
Conversation
Perhaps at this point, before I move forward with other STS's, there is a good opportunity to properly integrate this work into the current Cabal project. @amesgen: What's your opinion? Is this perhaps something you can do? (no pressure 🙂). |
I have tried
I am using agda-stdlib 2.0. What am I doing wrong? |
Will have a look 👍
I am not sure exactly, but maybe you need to setup agda-stdlib-classes and agda-stdlib-meta? ouroboros-consensus/nix/agda.nix Lines 19 to 49 in f196bfc
|
@amesgen thanks for your answer 🙏 So I have those setup, they are in my |
It seems I had outdated version of agda-stdlib-classes and agda-stdlib-meta. Refreshing to match the revisions given in nix file does yield to different errors. |
It should work with nix develop .#agda-spec We definitely want a good readme for |
It's funny that |
Just to explain this behavior: These two commands use the Nix registry which is completely independent of the local project you are working on. Therefore, In contrast, Line 81 in 68b9799
|
I still wish I could |
43c9f54
to
f3361a3
Compare
Signed-off-by: Javier Díaz <[email protected]>
f3361a3
to
a98ba32
Compare
Fixes #1343 Note that this PR targets the branch of #1315 and not `main`. This PR adds Nix derivations that: - generate Haskell code from the Agda spec using the `Makefile`-based build system in `./docs/agda-spec/` - wrap the generated code into Nix using `cabal2nix` In combination with the existing set-up in `flake.nix`, we can now build the generated code and run it's tests using the following flake output: ``` nix build .#hydraJobs.x86_64-linux.native.agda-spec.hsExe ``` which will also be done in CI, i.e. see the logs from testing this PR - the job [x86_64-linux.native.agda-spec.hsExe](https://ci.iog.io/build/6263029/log) builds and runs tests for the generated code some other jobs, e.g. the linting of the unit tests for the generated code, are failing, but we can fix those in #1315
…pec-to-haskell' into javierdiaz72/agda-spec-to-haskell
b307ad4
to
5987184
Compare
- dos2unix - hlint - make `cardano-consensus-executable-spec.cabal` pass `cabal.check` Make `cardano-consensus-executable-spec.cabal` pass `cabal.check` Copy licence files instead of linking fix cabal file
5987184
to
f2af22c
Compare
Hi @javierdiaz72, Happy New Year! Shall we merge this PR so that it does not bit-rot? |
Hi, @geo2a! Happy New Year to you too! There is still quite a bit of work to do regarding this PR (that's why it's still in draft mode), so we should not merge it yet. |
Hi, @geo2a! Do you have an idea why some of the CI checks are still failing? |
CI is complaining about the fact that some files don't have LF (unix style) line endings: https://ci.iog.io/build/6541916/nixlog/1 (also see #1253/#1252). |
Thanks for pointing that out, Alex! I've just fixed the issue with the file and now the CI is not complaining anymore. 🙂 |
Hey, folks! I'm not sure why the last CI check is failing. Could anybody help me out? |
@javierdiaz72 it seems like the failure was transient, I've re-triggered the job and the failure went away. |
Thanks @javierdiaz72 for this monumental work! Before we merge this, we need to work a little more on documentation and Git history:
Please let me know if you need any help with these! Another question:
Otherwise the PR looks great! I have verified that the Haskell code is generated, build and tested with:
the test results should be somewhere near the end of the output. |
@javierdiaz72 another request I got form the team is to provide instructions to build the spec and run the tests without Nix. How hard would that be? Would it be possible for you to outline in the README what additional steps one needs to follow besides the Agda installation instructions? |
base >=4.14 && <4.21, | ||
text, | ||
ieee | ||
-- This will be generated automatically when building with nix |
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.
When building the source derivation with Nix, e.g. nix build .#agda-spec.hsSrc
, this section is indeed filled in with a long list of module names. @javierdiaz72 do you know exactly what bit of code is responsible for this? Is this a blocker for providing a non-Nix build option?
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.
The code responsible for that is:
ouroboros-consensus/docs/agda-spec/src/Makefile
Lines 44 to 46 in 5ba7a4a
find $(HS_DIST)/MAlonzo -name "*.hs" -print\ | |
| sed "s#^$(HS_DIST)/# #;s#\.hs##;s#/#.#g"\ | |
>> $(HS_DIST)/$(CABAL_FILE) |
Therefore, it's not related to Nix.
This PR resolves #1312 and #1343.