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

Natural is not exported from clash-prelude-1.9.0's Clash.Prelude GHC 9.0.2 (and lower?) #2707

Open
lmbollen opened this issue Apr 10, 2024 · 3 comments

Comments

@lmbollen
Copy link
Contributor

Found on the clash-vexriscv repo:
https://github.com/clash-lang/clash-vexriscv/actions/runs/8615733120/job/23611920320
9.2.8 and 9.4.8 do pass.
9.0.2:

 [4 of 8] Compiling VexRiscv.Random  ( src/VexRiscv/Random.hs, /__w/clash-vexriscv/clash-vexriscv/dist-newstyle/build/x86_64-linux/ghc-9.0.2/clash-vexriscv-0.1/build/VexRiscv/Random.o, /__w/clash-vexriscv/clash-vexriscv/dist-newstyle/build/x86_64-linux/ghc-9.0.2/clash-vexriscv-0.1/build/VexRiscv/Random.dyn_o )

src/VexRiscv/Random.hs:42:16: error:
    Not in scope: type constructor or class ‘Natural’
   |
42 | genNatural :: (Natural, Natural) -> IO Natural
   |                ^^^^^^^

src/VexRiscv/Random.hs:42:25: error:
    Not in scope: type constructor or class ‘Natural’
   |
42 | genNatural :: (Natural, Natural) -> IO Natural
   |                         ^^^^^^^

src/VexRiscv/Random.hs:42:40: error:
    Not in scope: type constructor or class ‘Natural’
   |
42 | genNatural :: (Natural, Natural) -> IO Natural
   |                                        ^^^^^^^
Error: cabal: Failed to build clash-vexriscv-0.1.

Error: Process completed with exit code 1.
@DigitalBrains1
Copy link
Member

Ah, we get that as a stray export from GHC.TypeLits. I'm not sure it's even supposed to be exported from our Prelude, but we do

so we get that. The risks of exporting modules you don't control!

@leonschoorl
Copy link
Member

We're reexporting a lot of things from GHC.TypeLits that we probably shouldn't.
For example since GHC-9.6 this includes: natSing :: KnownNat n => GHC.TypeNats.SNat n
Which uses a SNat that's different from clash-prelude's own Clash.Promoted.Nat.SNat.

@DigitalBrains1
Copy link
Member

Fixing any of this is an API change, though :-(

leonschoorl added a commit that referenced this issue May 7, 2024
This makes the exported API (more) consistent across different GHC versions.

In response to #2707
leonschoorl added a commit that referenced this issue May 7, 2024
This makes the exported API (more) consistent across different GHC versions.

In response to #2707
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

No branches or pull requests

3 participants