-
Notifications
You must be signed in to change notification settings - Fork 236
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
#1087 Allow interleaving of F# and F* sources in a project #2067
#1087 Allow interleaving of F# and F* sources in a project #2067
Conversation
Preserve the order of files for extraction and F# compilation
<!-- <Compile Include="FStar.HyperStack.fst" /> --> | ||
<Compile Include="fs\FStar_HyperStack_All.fs" Link="FStar_HyperStack_All.fs" /> | ||
<Compile Include="fs\FStar_HyperStack_ST.fs" Link="FStar_HyperStack_ST.fs" /> | ||
<Compile Include="fs\FStar_HyperStack_IO.fs" Link="FStar_HyperStack_IO.fs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note how HyperStack related files come after some F* modules. For F# compilation they come after the extracted modules defined above them. It's actually needed as they depend on FStar.Monotonic.HyperHeap.fst and FStar.Monotonic.HyperStack.fst defined above them (though not enabled yet partially enabled now but there are still issues with extracting of unused parameters).
|
||
A simple workaround would be to change the declaration of map_val in the FStar.Map.fsti so that | ||
'#key:eqtype' parameter is moved before any non-implicit parameters (i.e. before 'f'). | ||
*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(* FStar.Map.fsti *)
val map_val: #val1:Type -> #val2:Type -> f:(val1 -> val2) -> #key:eqtype -> t key val1 -> Tot (t key val2)
@nikswamy Were you already looking at this particular problem? If not, I suppose it's a good candidate for me to look into next. It seems that all other modules are blocked by the issues around removing of unused parameters across modules which you're looking into (is there anything I can help with there?).
…tar.exe are passed to msbuild
Thanks @mateuszbujalski! This looks really great ... very cool that you an add a Compile target with .fst files in an .fsproj. I'm merging this into my working branch on this topic. Not sure I fully understand the issue on FStar.Map issue ... will look into it and reply. |
Regarding the extraction of non-prefix quantified type variables, as in FStar.Map.map_val: Yes, you're right. When F* extracts code to OCaml or F#, only prenex quantified type variables are extracted as type variables. The rest (since F# and OCaml do not directly support first-class polymorphism) are erased to For instance, we extract FStar.Map.map_val to
and a test client
is extracted to
Note the addition of the unsafe coerce and the erasure to the type argument to map_val to In OCaml, we get something quite similar
At least in OCaml, the use of Obj.magic is safe and justified by the typability of the program in F*, and will not trigger a runtime typechecking failure. I'm less sure about the semantics of A fix to this particular case for F# could indeed be to move the |
Preserve the order of files for extraction and F# compilation