-
Hi, I've stripped down my use case to the following minimal example with following definition in one file
I now want to add the
This doesn't work for
because
can be unified with
I've found a solution I'm not quite happy with because I need to repeat all unset fields in all cases
What's the best way to define a "function" to obtain the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @loisch
Please can you demonstrate what you did here? Because I can't fully reproduce what you describe. Here's what I did:
i.e. I can't unify the values you suggested because I get an error. |
Beta Was this translation helpful? Give feedback.
-
Thanks for looking into this @myitcv! I'll first give some context. About 15 years ago we quite unconventionally chose org-mode as a configuration format for our hospital information system written in Haskell and TypeScript. We have many different data-structures / DSLs in different kinds of org-mode files for different subsystems and servers and we're currently generating parts of this complex configuration. As org-mode doesn't have schemas / validation we only do validation when parsing. I'm comparing CUE and Pkl and others as a replacement. I'd like to define our configuration data structure (in this example This doesn't work
and fails with this error
I understand the reason and I know that I can fix it by instead writing
but if upstream extends the definition for
I have to add one case to my pattern-match AND extend each existing case to not allow unification with the new case. Is there a better way to write the translation matching on the cases defined in the "upstream" configuration? Here's a more complete example - our real system is much more complex and has even more cases:
|
Beta Was this translation helpful? Give feedback.
@loisch thanks for the detailed context. Very interesting!
Reducing down the original declaration of
#rk
:Using
cue eval
we can see this results in:This is, I suspect, not what you were expectin…