Closed wlcx closed 2 years ago
Hey, glad you're enjoying the project!
At the moment serialize
only works with serde-compatible values, and dhall types don't fit in there. I should be able to make it work with SimpleTypes though; I'll try when I come back home in two weeks
Hey, turns out I had misread your issue. I made serialize
work on SimpleType
but that's not actually your issue. You want a record that contains types, which doesn't fit into SimpleValue
/SimpleType
. I've voluntarily not exposed more advanced dhall constructs than that because I don't know how to make a sane API that won't break all the time.
I'm afraid the easiest for you would indeed be to construct the strings by hand :(
Ah, ok. Thanks for looking and sorry for the misleading issue title!
First up, thanks for the project! I'm deserialising dhall into a config struct for my application and it works great. At the moment I'm "including" some of my rust enums in the dhall via
.with_builtin_type
.I'd like to generate an application-specific "prelude" with these enums in so that I can use standalone dhall tooling/language server etc, but I'm struggling to find a nice way to generate a record with these enum types as values, something akin to https://prelude.dhall-lang.org/package.dhall.
I got to here (where
Action
andMapping
are two rust enums)but then realised this generates a type (
{ Action : <foo>, Mapping : <bar>}
rather than{ Action = <foo>, Mapping = <bar> }
).So, I try serializing:
but get
the trait `Serialize` is not implemented for `SimpleType`
.Does what I'm trying to do make any sense, or is my best bet going to be constructing the dhall string myself?