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

Wrap known prime numbers #214

Open
hacatu opened this issue Jan 7, 2021 · 1 comment
Open

Wrap known prime numbers #214

hacatu opened this issue Jan 7, 2021 · 1 comment

Comments

@hacatu
Copy link

hacatu commented Jan 7, 2021

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.

@Bodigrim
Copy link
Owner

Bodigrim commented Jan 7, 2021

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.

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

2 participants