--- Malcolm Wallace wrote:
As an example, instead of the following list-only code,

    f :: List a -> ...
    f []    = ...
    f (h:t) = ...

you could write this more general version, which assumes only some
class Sequence with operations null, head, tail, etc.

    f :: Sequence s => s a -> ...
    f list | null list                       = ...
           | h <- head list, t <- tail list  = ...
--- end of quote ---

I guess that's about half way there.  I (and, I think, the original poster) was 
thinking more along the lines of generalizing the existing interface and considering 
lazy lists to be one implementation.  It seems like the "list" syntax is general 
enough to apply to any ordered collection.  Further, that would only require minimal 
changes in large amounts of existing code that relies on, for example, Strings being 
[Char]s were Strings changed to a more efficient representation.  /gXm
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to