The size of things

Ch. A. Herrmann herrmann@infosun.fmi.uni-passau.de
Fri, 15 Feb 2002 17:07:14 +0100


>>>>> "Simon" == Simon Marlow <simonmar@microsoft.com> writes:

    >> Yes, I see.  Would it be possible to have a standard strict list,
    >> i.e. something equivalent of
    >> 
    >> data SList a = SNil | SCons !a SList
    >> 
    >> (which could be a member of the same class as the normal lists,
    >> and have the usual functions (length, ++, isPrefixOf...) 
    >> overloaded)?

    Simon> Yes, it would be possible, but we can't do it without making
    Simon> sweeping changes to standard libraries and deviating from
    Simon> Haskell 98 quite a bit.  It's something to bear in mind
    Simon> should the topic of Haskell 2 come up, though.

If there are significant changes to be made anyway, wouldn't it be 
the best thing to generalize lists to a type class of which lists 
are an instance of? The nice list comprehension syntax could then 
be used also for other data structures, and combinators like map, filter,
scanl applied to arrays, trees etc. 

Analogously to the Num class, one could have a function like *toList*, 
and one would expect from a program to establish:  

   toList . combinator_in_X_a = combinator_in_[a] . toList

Cheers
--
 Christoph