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

topic: JSON ADT and codecs #43

Open
monmcguigan opened this issue Mar 24, 2024 · 5 comments
Open

topic: JSON ADT and codecs #43

monmcguigan opened this issue Mar 24, 2024 · 5 comments
Assignees
Labels
assigned Topic has been assigned in-content Is the issue in lesson content?
Milestone

Comments

@monmcguigan
Copy link

I'm imagining writing an ADT for JSON structure and then showing how you can write encoders/decoders for this representation.

It would cover modelling data with algebraic data types, pattern matching, encoding/decoding etc.

I like this topic because I feel like there's lots of different details and levels you can dive into.

@gvwilson
Copy link
Collaborator

Cool - there was some discussion of this in #14 as well. I think there may be a JSON encoding/decoding package for Roc, but building a scale model from the ground up to show people how it works (in the way that chapters in the JavaScript and Python books built simplified versions of regular expression matchers to show how they work) would be awesome. Cc @FabHof (who's doing a binary encoder/decoder) for thoughts and to synchronize.

@gvwilson gvwilson added discuss An issue or PR currently being discussed in-content Is the issue in lesson content? propose-addition A suggestion for an addition to content or infrastructure labels Mar 25, 2024
@gvwilson gvwilson added this to the topic-outline milestone Mar 25, 2024
@gvwilson gvwilson changed the title topic proposal: Json ADT and codecs topic proposal: JSON ADT and codecs Mar 25, 2024
@monmcguigan
Copy link
Author

Ah I wasn't aware there already was a JSON codec lib in Roc, I will sync with @FabHof on this.

@FabHof
Copy link
Contributor

FabHof commented Mar 26, 2024

For reference: https://github.com/lukewilliamboswell/roc-json

To be honest, I'm not sure about the scope of my part. If you want to talk about Encoding/Decoding I can focus more on the binary representation and bit shifting stuff.

Also this discussion on zulip might be relevant: https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Encoding.20that.20can.20fail

@gvwilson
Copy link
Collaborator

Hi again @monmcguigan - just to be clear, the fact that there's a JSON codec in Roc is an argument for including your chapter, not against it: building a scale model that includes the core features of the full module will help people understand how and why it does what it does, and they're more likely to believe this is a "real" problem if there's something for it in the standard library. I'm going to assign this one to you - if you and @FabHof can chat here, on Zulip, or by email about where yours will stop and theirs will start, that would be awesome.

@gvwilson gvwilson added assigned Topic has been assigned and removed discuss An issue or PR currently being discussed propose-addition A suggestion for an addition to content or infrastructure labels Mar 26, 2024
@rtfeldman
Copy link
Contributor

@monmcguigan A thought on this: there are also different approaches to decoding JSON, which beginners might benefit from. This article talks about starting from a simple JsonValue type and then shows where that runs into limitations which motivates building out a decoder system.

So the "scale model" approach Greg mentioned could work, and another way would be to show an alternative (simpler) design to the one found in the roc-json package, and then talk about the tradeoffs of that simpler design which motivate the decoding library.

@gvwilson gvwilson changed the title topic proposal: JSON ADT and codecs topic: JSON ADT and codecs Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned Topic has been assigned in-content Is the issue in lesson content?
Projects
None yet
Development

No branches or pull requests

4 participants