How lazy is DData.Seq?
jyp_7 at yahoo.com
Sun May 9 16:14:20 EDT 2004
--- Wolfgang Jeltsch <wolfgang at jeltsch.net> wrote:
> 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
> append (append d e) f)
> to not be evaluated at all.
Ok, I think was mistaken in this respect.
The current version behaves ok for sequences mainly
constructed with fromList, cons or snoc; a sequence
made up of 'append' is strict.
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
More information about the Libraries