-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds helpers for defining fallible types, so we ensure we always use the same definition. This change does _not_ modify the serialisation format, it's only helpers on top of `Sum`. On the rust side: - Adds prelude definitions for `option` and `result` types (special cases of `Sum`s), including constant values for `some`/`none`, `ok`/`err`. On the python side: - Adds an `Option` and `None_` subtype of `tys.Sum`, and `Some`/`None`/`Ok`/`Err` value definitions (also subtypes of `val.Sum`). These implement nicer `__repr__`, but the classes get lost on a serialisation roundtrip. I'm not sure if we want to auto-detect the special cases during deserialisation? The names used are rusticisms. Feel free to bikeshed them. Closes #1473 --------- Co-authored-by: Seyon Sivarajah <seyon.sivarajah@quantinuum.com>
- Loading branch information
Showing
3 changed files
with
320 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.