[Haskell-cafe] lazily traversing a foreign data structure

Graham Fawcett graham.fawcett at gmail.com
Fri Oct 26 14:47:08 EDT 2007


On 10/26/07, Brent Yorgey <byorgey at gmail.com> wrote:
>In the end it looks to me like you're probably better off
> just implementing traverse directly as you have done, although perhaps
> someone will find a better way.

Beginner's luck. ;-) I see the unfold similarity, but yes, it doesn't
seem a good fit here.

> I will note, however, that the last few lines of traverse can be written
> more simply as:
> Just v -> liftM (v:) . valve . traverse $ (\db -> nextKey db v)
> or even
> Just v -> liftM (v:) . valve . traverse . flip nextKey $ v
>
> Perhaps that's going too far for your taste...

Not at all -- it's terse but the data flow is clear.

Thanks very much,
Graham


More information about the Haskell-Cafe mailing list