Skip to content
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

How to decode a map with optional fields elegantly? #243

Open
arianvp opened this issue Jun 27, 2020 · 1 comment
Open

How to decode a map with optional fields elegantly? #243

arianvp opened this issue Jun 27, 2020 · 1 comment

Comments

@arianvp
Copy link
Contributor

arianvp commented Jun 27, 2020

Currently CBORG allows peeking token types but I was wondering how hard it would be to peek values as well?

My usecase is I need to deserialise a canonical CBOR Map (so keys are sorted; that's nice) but some keys are optional; so I'd like to elegantly write a decoder that can decode a map with optional fields. any idea how to do so?

I want to decode a CBOR map into a Haskell record; each key can have a different type for the value; so i can't decode to a HashMap first or something.

@ghost
Copy link

ghost commented Aug 4, 2020

I think if #219 gets implemented you'll be able to do what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant