Hoodlums Message Board › Homework: JSON Zipper

Homework: JSON Zipper

Peter M.
peter_marks
Group Organizer
London, GB
Post #: 35
At our meetup on Thursday we built a Zipper for JSON structures. Somewhat shamefully, we didn't actually try compiling anything. Our code is here. The first homework task this month is to get the Zipper to compile and to test it out.

The second task is to port the code to using the Uniplate Zipper. This task has little to do with Zippers, but is all about digging into a third party library and figuring out how to use it. As a hint, the simplest way to use Uniplate is usually through Data.Generics.Uniplate.Data. However, JSValue is not an instance of data and although instances are derivable, you can't use deriving instance because not all the constructors you need are visible. I used Data.Generics.Uniplate.Typeable as that was the least work, but that is also slightly tricky for the same reason.
Peter M.
peter_marks
Group Organizer
London, GB
Post #: 36
When I looked at our code the next day, I realized that applyM can be written as:

applyM f i = foldr (>=>) return (replicate i f)
Powered by mvnForum

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy