I am working with the newsynth package and am running into a bug that I am starting to suspect has to do with the update random-1.2.0 over the summer (newsynth was last updated in late 2019, and random-1.2.0 came out in June. I have run cabal update since then, which is why both seem to be installed.) Here is the code that I ran in GHCi:
λ> import System.Random
λ> import Quantum.Synthesis.Ring
λ> import Quantum.Synthesis.Diophantine
λ> g <- getStdGen
λ> diophantine g (RootTwo 5 0)
<interactive>:5:1: error:
• No instance for (random-1.1:System.Random.RandomGen StdGen)
arising from a use of ‘diophantine’
There are instances for similar types:
instance random-1.1:System.Random.RandomGen
random-1.1:System.Random.StdGen
-- Defined in ‘random-1.1:System.Random’
• In the expression: diophantine g (RootTwo 5 0)
In an equation for ‘it’: it = diophantine g (RootTwo 5 0)
As was suggested to me in another SO post, I tried hiding the other copy of random from GHCi. I ran
$ ghc-pkg --global --package-db ~/.cabal/store/ghc-8.8.3/package.db list random
~/.ghcup/ghc/8.8.3/lib/ghc-8.8.3/package.conf.d
(no packages)
~/.cabal/store/ghc-8.8.3/package.db
random-1.1
random-1.2.0
so I tried $ ghc-pkg --global --package-db ~/.cabal/store/ghc-8.8.3/package.db hide random-1.2.0.
However, when the bug persisted, I also tried $ ghc-pkg --global --package-db ~/.cabal/store/ghc-8.8.3/package.db hide random-1.1 (just to make sure hide did what I thought it would), yet inexplicably found that in GHCi (even after restarting Terminal) I was able to run λ> import System.Random despite all known instances of random being hidden. Am I hiding packages in the wrong way?
Thank you in advance.
(I asked a somewhat related question the other day but since I think this issue is kinda different I thought it made sense be separate. If this is not the case I can update the other post.)