[Haskell-cafe] Data.Ring -- Pre-announce

John Van Enk vanenkj at gmail.com
Thu Dec 31 14:56:25 EST 2009

Hi Luke,

Thanks for the feedback. I had some follow up comments.

On Thu, Dec 31, 2009 at 5:50 AM, Luke Palmer <lrpalmer at gmail.com> wrote:

> Code looks okay.  It suffers from the same persistence/amortization
> problem as the classical functional queue; if you happen to shift from
> one of the edge cases (eg. prev when the left is empty), you will get
> degenerate time complexity, reversing that right list over and over.
> See discussion at "Simple and efficient purely functional queues and
> deques, by Chris Okasaki"; probably can adapt that solution to yours.
> More of an academic interest, I doubt anyone will care about those
> cases.

Yes. I agree and did see it. I'm reading the paper and may implement some of
the stuff he talks about.

> Ring is a comonad, so you can make it an instance of one if you want
> to have some fun :-P

I plan on adding as many instances as I know and make sense to me. :)

> It seems weird that you would put the focus in the middle in fromList.
>  Overly strict.  Why not just put it at the first element?  (Also
> easier to reason about)

It actually uses the first element as the focus, not the middle.

> I would consider considering a ring where *both* left and right were
> infinite to be valid, but not when only one of them is infinite (when
> they both are infinite, you will never get to reverse).

This would be neat, perhaps someday. I don't think this works well with my
current API. :(

Thanks again. :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091231/29eaccf9/attachment.html

More information about the Haskell-Cafe mailing list