Tom Pledger <[EMAIL PROTECTED]> wrote: > Craig Dickson writes: > > [...] > > I don't want a pattern like "(x:xs)" to match the empty list, which > > it presumably would if "head []" and "tail []" did not fail (x and > > xs would both be bound to []). > > I don't think it would. Patterns involve data constructors like [] > and (:), but not functions like head and tail, which may happen to > obey all sorts of rules, but aren't part of the data type definition. True, but I think the standard functions, especially those in the prelude, ought to make sense in terms of the data type's definition, for the sake of presenting a consistent view of that data type to the programmer. If "(x:xs)" does not match [], then the reason for this should be that [] has no head to bind to x, nor tail to bind to xs; and if this is so, then "head []", "tail []", and "take 1 []" should also fail. Conversely, if "head []" and "tail []" succeed, then "(x:xs)" should match the empty list. If this consistency is not maintained, then the language and its core functions are presenting a confusing and somewhat contradictory view of what a list is and how you interact with it. Craig
- Re: drop & take [was: fixing typos in H... D. Tweed
- Re: drop & take [was: fixing typos in H... Matt Harden
- RE: drop & take [was: fixing typos in Haskel... Roberto E. Lublinerman
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in H... Hamilton Richards
- Re: drop & take [was: fixing typos ... Ch. A. Herrmann
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- RE: drop & take [was: fixing typos in Haskel... Brian Boutel
- Re: drop & take [was: fixing typos in H... Craig Dickson
- Re: drop & take [was: fixing typos ... Craig Dickson
- Re: drop & take [was: fixing typos ... Fergus Henderson
- Re: drop & take [was: fixing typos in Haskel... Tom Pledger
- RE: drop & take [was: fixing typos in Haskel... Brian Boutel
- Re: drop & take [was: fixing typos in H... Fergus Henderson
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in Haskel... Marcin 'Qrczak' Kowalczyk
- Re: drop & take [was: fixing typos in H... Pablo E. Martinez Lopez
- Specialisation by constraint [was: drop &am... Tom Pledger
- RE: drop & take [was: fixing typos in H... Frank A. Christoph