How lazy is DData.Seq?

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon May 10 01:19:02 EDT 2004


Am Montag, 10. Mai 2004 00:14 schrieben Sie:
> --- Wolfgang Jeltsch <wolfgang at jeltsch.net> wrote:
> > Hi,
> >
> > meanwhile, I'm not sure if I need lazyness in my concrete example.  But
> > the general point is the following:
> >
> > I have functions for converting values of certain data types to strings.
> > I don't use [Char] but Seq Char as the result type of these functions to
> > allow for efficient concatenation.  For one concrete type I want to test
> > if the values of this type have a certain property.
> >
> > I use the to-string conversion function to check for this property because
> > a value has the property in question iff the first character of the string
> > representation is a letter.  So I want to do something like
> >     isAlpha $ head $ toString value.
> > toString value is constructed by multiple applications of append, so it
> > may in the end be something like
> >     append (append a (append b c)) (append (append d e) f).
> > In this example I'd want the terms
> >     append b c
> > and
> >     append (append d e) f)
> > to not be evaluated at all.
>
> Ok, I think was mistaken in this respect.

What do you mean with this?  Do you mean: "I think *I* was mistaken [...]"?

> The current version behaves ok for sequences mainly constructed with
> fromList, cons or snoc; a sequence made up of 'append' is strict.

Would it be possible to change this behavior?

> Cheers,
> JP.

Wolfgang



More information about the Libraries mailing list