arithmoi
arithmoi copied to clipboard
Wrap known prime numbers
Currently, as far as I can tell there is no way to use externally sourced prime numbers. If I use primesieve
or some other method to make a bunch of prime numbers, but then I want to call sqrtsModPrime
or one of its related functions, I cannot do this unless I wrap the number in fromJust $ isPrime p
or something like that.
Why?
Just exposing the type constructor would allow users to circumvent the guarantees arithmoi itself has, but this is necessary for neat integration with other libraries. Plus, wrapping primes could be exposed as a function with a name like unsafeWrapPrime
so people totally wouldn't use it unless they needed it.
Yes, makes sense.
Because of GHC 9.0 changes, primes in arithmoi
require a huge overhaul anyways. I'm painfully slowly fleshing out Math.NumberTheory.Primes
as a separate library.