How lazy is DData.Seq?

Dylan Thurston dpt at exoskeleton.math.harvard.edu
Sat May 8 15:58:41 EDT 2004


On Sat, May 08, 2004 at 08:28:37PM +0200, Wolfgang Jeltsch wrote:
> Am Samstag, 8. Mai 2004 18:37 schrieben Sie:
> > --- Wolfgang Jeltsch <wolfgang at jeltsch.net> wrote:
> > > Hello,
> > >
> > > I would suspect that in DData.Seq the result of
> > >     head (singleton 'a' `append` undefined)
> > > is 'a' but instead it is _|_.  Why is this the case?
> >
> > I have the invariant that sublists are not empty.
> > There is, for example:
> >
> > append as None = as
> 
> Is this necessary/desirable?  I have an application where I think that it can 
> be important for efficiency that the above expression evaluates to 'a'.  So I 
> would like it to not result in _|_.

Yes, it's necessary, if you want to maintain any sort of balanced tree
(which is crucial for efficiency).  In 'append as bs', you need to know
how large 'as' and 'bs' are in order to construct the balanced
structure.

What is your application, and why can't you use built-in lists?

Peace,
	Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/libraries/attachments/20040508/6c7d8e3a/attachment.bin


More information about the Libraries mailing list