Skip to content

Commit

Permalink
chore: Bump to Hugr v0.2 (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-koch authored Apr 9, 2024
1 parent 73e29f2 commit b757550
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion guppylang/compiler/expr_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ def python_value_to_hugr(v: Any, exp_ty: Type) -> val.Value | None:
case list(elts):
assert is_list_type(exp_ty)
return list_value(
[python_value_to_hugr(elt, get_element_type(exp_ty)) for elt in elts]
[python_value_to_hugr(elt, get_element_type(exp_ty)) for elt in elts],
get_element_type(exp_ty).to_hugr(),
)
case _:
# Pytket conversion is an optional feature
Expand Down
6 changes: 3 additions & 3 deletions guppylang/prelude/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ListValue(BaseModel):
"""Hugr representation of floats in the arithmetic extension."""

c: Literal["ListValue"] = "ListValue"
value: list[Any]
value: tuple[list[Any], tys.Type]


def bool_value(b: bool) -> val.Value:
Expand All @@ -76,9 +76,9 @@ def float_value(f: float) -> val.Value:
return val.ExtensionVal(c=(ConstF64(value=f),))


def list_value(v: list[val.Value]) -> val.Value:
def list_value(v: list[val.Value], ty: tys.Type) -> val.Value:
"""Returns the Hugr representation of a list value."""
return val.ExtensionVal(c=(ListValue(value=v),))
return val.ExtensionVal(c=(ListValue(value=(v, ty)),))


def logic_op(op_name: str, args: list[tys.TypeArg] | None = None) -> ops.OpType:
Expand Down
12 changes: 6 additions & 6 deletions validator/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.19.0"
quantinuum-hugr = "0.1.0"
quantinuum-hugr = "0.2.0"
lazy_static = "1.4.0"
serde_json = "1.0.111"

0 comments on commit b757550

Please sign in to comment.