[Haskell] An Alternative Data.List.Zipper

Jeff Wheeler jeff at nokrev.com
Sat Jan 17 16:32:13 EST 2009

On Sat, 2009-01-17 at 21:55 +0100, Jean-Philippe Bernardy wrote:

> I think it should admit empty, and the traversable instance should
> traverse the first list in reverse.

I fixed the latter issue so that the behavior is correct (I think).

I tested it like this:

> forM (next $ next $ fromList [1..5]) $ \i -> do { print i; return i }
[1,2] 3 [4,5]

which I believe is proper.

I'm undecided about allowing them to be empty. I don't know the theory
or math behind zippers (I'm sure there are some papers written about
it), but it doesn't make much sense to be empty. I got that impression
from #haskell, also.

Thanks for the comments. :)

Jeff Wheeler

More information about the Haskell mailing list