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

Add constants #41

Open
effectfully opened this issue Oct 18, 2019 · 2 comments
Open

Add constants #41

effectfully opened this issue Oct 18, 2019 · 2 comments
Labels
AST enhancement New feature or request Field

Comments

@effectfully
Copy link
Owner

We have some important field constants (see Jubjub), but no way to reference them from within an Expr. They can be embedded directly into an Expr, but it's better to use names for named things.

But maybe it's more important for expression to stay self-contained. Not sure yet.

@effectfully effectfully added enhancement New feature or request AST Field labels Oct 18, 2019
@kwxm
Copy link
Collaborator

kwxm commented Oct 18, 2019

About the remark about comparing the characteristic of the field with the number r in Jubjub,hs.
I'm sure you know this, but you can do something like

type P = 52435875175126190479447740508185965837690552500527637822603658699938581184513
type F = GF.Prime P
...
r == GHC.TypeLits.natVal (Proxy:: Proxy P)

I'd been wondering about this anyway because it would be good to check that the big number really is prime.

[Later] It's probably better to use char from Data.Galois.Field.

r == (toInteger $ char (zer::TinyLang.Field.Jubjub.F))

char just uses natVal anyway. It's a bit annoying that we have to compare a Natural with an Integer though.

@jakzale
Copy link
Collaborator

jakzale commented Mar 17, 2020

So more like a built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AST enhancement New feature or request Field
Projects
None yet
Development

No branches or pull requests

3 participants