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

call and type arguments #67

Open
weaversa opened this issue Apr 19, 2020 · 2 comments
Open

call and type arguments #67

weaversa opened this issue Apr 19, 2020 · 2 comments

Comments

@weaversa
Copy link

Say I have the following function:

f : {n} (fin n) => Bit
f = `n > 0

How do I use the call interface to do the following:

Main> f `{100}
True
Main> f `{0}
False

Does the expression string accept something like f`{10}?

@david-christiansen
Copy link
Contributor

The expression may be any JSON representation of a Cryptol expression, including strings with concrete syntax in them, and that concrete syntax may be an arbitrary expression. Example:

2020-04-20 09:31:51	sent	{"jsonrpc":"2.0","id":2,"method":"evaluate expression","params":{"state":[["load file",{"file":"/home/dtc/Projects/proto/proto/Foo.cry"}]],"expression":"all `{n=0}"}}
2020-04-20 09:31:51	reply	{"error":{"data":{"type string":"{a} (a -> Bit) -> [0]a -> Bit","type":{"propositions":[],"forall":[{"kind":"Type","name":"a"}],"type":{"domain":{"domain":{"kind":"Type","name":"a","type":"variable"},"range":{"type":"Bit"},"type":"function"},"range":{"domain":{"length":{"value":0,"type":"number"},"contents":{"kind":"Type","name":"a","type":"variable"},"type":"sequence"},"range":{"type":"Bit"},"type":"function"},"type":"function"}}},"code":20200,"message":"Can't evaluate at polymorphic type"},"jsonrpc":"2.0","id":2}

We probably should add a higher-level syntax for specifying type arguments, however. String interpolation is not great, especially if you want to instantiate them with other types that have been received in a structured format.

@weaversa
Copy link
Author

I asked how to use the call method to specify type arguments. Your example uses the expression method. Is it not possible using call?

@david-christiansen david-christiansen added this to the June Bugs 2020 milestone May 7, 2020
@atomb atomb removed this from the June Bugs 2020 milestone Jan 4, 2021
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