-
Notifications
You must be signed in to change notification settings - Fork 27
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
Recursive types #242
Comments
Hi, a |
Sure, I'd be keen to learn how the API works and make changes to maintain it. I guess I don't quite know where to start though... What's Nir and Hir for example? I'm also trying to understand how the |
I can add a On the Dhall side, there should be no change to the code other than |
Yes! That is indeed compatible with SimpleType! The following works for the initialization of a let ty: serde_dhall::SimpleType = serde_dhall::from_str(
r#"let NodeType =
λ(a : Type) →
< Leaf : { kind : Text, key : Text }
| Decorator
| Sequence : { children : List a }
| Fallback : { children : List a }
>
let Node = λ(a : Type) → { type : NodeType a, name : Text }
let Topo = λ(f : Type → Type) → List (f Natural)
let Tree = Topo Node
in Tree"#,
)
.parse()
.unwrap(); However, trying to serialize the root node leads to dhall-rust/serde_dhall/src/serialize.rs Line 202 in d8c2e65
|
Nice :) Yes, we don't support struct variants apparently, this shouldn't be too hard |
Hi there,
I'm trying to use
dada
to represent a recursive type. Specifically, I have the two following types in Rust:This allows me to represent behavior trees.
@sellout, the author of
dada
, was kind enough to write a recursion Dhall type to represent this.Where the
Mu/Type
is defined as:Here is how I tried to build up this type in Rust:
which leads to the following error:
From the documentation (https://docs.rs/serde_dhall/latest/serde_dhall/enum.SimpleType.html#type-correspondence), I understand that
SimpleType
does not support theT -> U
operation. Does that also apply to lambdas ? (I'm a novice in Dhall, so my apologies if I'm not using the correct terms.) Is there a way I could build this simple type "by hand" using the HashMap and provided enums method?If this is not yet supported, do you have an idea of what changes that would be required and whether I could work on that? I'm a Dhall novice but quite competent in Rust.
Thanks
The text was updated successfully, but these errors were encountered: