8000 F* backend: variants are extracted to constructors whose payloads are tuples · Issue #325 · hacspec/hacspec · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.
This repository was archived by the owner on Mar 7, 2024. It is now read-only.
F* backend: variants are extracted to constructors whose payloads are tuples  #325
Open
@W95Psp

Description

@W95Psp

A Rust variant of arity n is extracted as an F* constructor of arity one whose payload is a tuple of size n.
For instance, the Rust code bellow:

enum Foo {
    CaseX(u16),
    CaseY(u8, u8),
}
struct Bar(u8, u8);

is translated as the following F*:

noeq type foo_t =
| CaseX_foo_t : pub_uint16-> foo_t
| CaseY_foo_t : (pub_uint8 & pub_uint8) -> foo_t

noeq type bar_t =
| Bar_bar_t : (pub_uint8 & pub_uint8) -> bar_t

This is not very idiomatic in F*, and disallows using F* projectors (e.g. (Bar_bar_t 4 8)._1).
In the context of PR #323, having F* projectors would simplify a lot extraction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0