-
Notifications
You must be signed in to change notification settings - Fork 0
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
Code Quotation for constraints #1
Comments
This is really cool! Sorry I started with a feature request, obviously this is a nice to have not a need to have. I can't wait to try this out when I get home if I can get the internet set up. I just moved lol. |
@voronoipotato This wouldn't work since it's a type provider - the input needs to be a literal, and F# doesn't allow a quotation as a literal value. |
@voronoipotato Sorry for the late reply from my part !! Also, the last commit I have done is bad/not compiling (I don't remember why I have done it, there must have been a reason I completely forgot), take the one previous to that one if you want to give that a try. I will close that issue then, if you want to discuss more on it don't hesitate to re-open it!! 😃 |
Couldn't we as a Fake step regex replace |
I guess we can't because they are writing the literal in their code. Can we keep this open and have it be the broader issue of "improving the user-friendliness of type-constraints". Just mark it as low priority, but it's something I could maybe help with, whereas I think everything else is above my paygrade. |
Yeah, we definitely can let this ticket open 😃 Also you can transform "let f x = x < 5 /nf" to "fun x -> x < 5" If I remember correctly, this should 😃 |
yeah that makes sense, but especially as a beginner I still rely on the code highlighting, code completion etcetera quite a bit. However I do think the lambda version you showed there is a lot cleaner. Perhaps making a Fake extension associated with this that does the regex replace I was talking about would make it simpler to get started. I looked into custom attributes but I didn't see a way to resolve them at compile time. |
Sounds like this issue is related to what you're working on. |
Yes exactly. Fake extension, won't work, because you need to have intellisense to show you the correct generated Types/Methods/Properties. And this is dependent of your static parameters. This means that you need at some point to have something that is given as a static parameter (that is a literal, not a quotation), that will be used to infer what will be generated. If you use quotation at design-time, then you won't have the TP generating the types at design-time, and thus you will lose all the purpose of using TPs sadly. P.S: By the way, thank you for your interest in this project 😄. |
If the constraint is a pure lambda though we won't need to refer to anything outside the quoted expression being passed into the type provider. I guess your dependent types would need to be in a separate project? No problem! |
Is it possible instead of using a string to use a Code Quotation?
present
proposed
This would allow for a better experience with your editor as you could use code highlighting and other important features.
The text was updated successfully, but these errors were encountered: