TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Learn you a Haskell: Zippers

49 pointsby voxcogitatioover 14 years ago

5 comments

jberrymanover 14 years ago
LYAH is great. For those who are interested, there is a library, 'syz' (Scrap Your Zippers), which provides a generic zipper for any data type, even mutually-recursive types:<p><a href="http://hackage.haskell.org/packages/archive/syz/0.2.0.0/doc/html/Data-Generics-Zipper.html" rel="nofollow">http://hackage.haskell.org/packages/archive/syz/0.2.0.0/doc/...</a><p>Its internals are pretty interesting if you've ever thought about implementing a generic zipper structure. For example it uses Typeable to reify the focus type.<p>I'm finishing up my own generic zipper library which I hope will be simpler and more useful than syz.
eruover 14 years ago
Here's a challenge: Design a zipper that works for cyclic graphs. There will be 10 GBP for the winner's charity of choice. (jacquesm may give another 10 Euro in addition.)<p>(Hint: "Purely Functional Datastructures" solves this problem for graphs shaped like a sigle ring. Perhaps this solution can be generalized?)
评论 #1867241 未加载
jwrover 14 years ago
Clojure also has a pretty neat zipper library in contrib. I've used it in projects and I wish I had introductory material as great as this tutorial back then.
jewbaccaover 14 years ago
I've had an investigation on the backburner for a while on whether there's a zipper-like structure for representing 2D grids (eg, a game board). I feel like this may be a blind alley, because a grid would have cycles and no inherent ordering. Can anybody shed some light on this?
评论 #1866885 未加载
评论 #1867319 未加载
grogersover 14 years ago
Another good introduction to zippers that helped me understand them in plain terms is: <a href="http://blog.ezyang.com/2010/04/you-could-have-invented-zippers" rel="nofollow">http://blog.ezyang.com/2010/04/you-could-have-invented-zippe...</a>
评论 #1866437 未加载