[Haskell] An Alternative Data.List.Zipper

Jeff Wheeler jeff at nokrev.com
Sat Jan 17 13:33:04 EST 2009


(I also sent this to libraries@, but without response; I'm posting here
for a wider audience.)

I'm somewhat of a beginner in Haskell, so take what I say with a grain
of salt, please.

The ListZipper implementation seems very odd to me, and #haskell seemed
to agree with me. The current package implements a Zipper with

> data Zipper = Zipper ![a] ![a]

which allows for empty zippers, among other things. Very strange to me.
It also seems unnecessarily strict. There are also no expected
typeclasses implemented, like Foldable or Traversable.

I thought it would be interesting to try fixing these problems with a
much cleaner design, and I'd like to share what I came up with:


I'd very much appreciate some criticism of the code so that I can
improve it.

I'm not sure how best to provide this alternative on Hackage; should we
make this merely a newer version of the old library, provide it in a
conflicting package, or find a new namespace for it and provide it


Jeff Wheeler

More information about the Haskell mailing list