Removal candidates in patterns
Andrew Pimlott
andrew at pimlott.net
Fri Jan 27 17:44:46 EST 2006
On Thu, Jan 26, 2006 at 11:03:01PM +0000, Ian Lynagh wrote:
> On Thu, Jan 26, 2006 at 07:35:42PM +0000, Olaf Chitil wrote:
> > If Haskell had a type for natural numbers I'd be in favour of n+k and k
> > patterns (working only for this type, not any other numerical type).
>
> Haskell (FSVO "Haskell") has several types for natural numbers: Word8,
> Word16, Word32, Word64. I'd also like to see a Natural type (analogous
> to Integer) (you might also argue for Word, analogous to Int), and I'd
> like to use k patterns with all of them.
I think Olaf meant an inductively defined type for natural numbers.
What's nice about that idea is that many canonical and teaching
examples, such as "ack" given in this thread, still work--and now
provide an honest introduction to structural recursion.
Andrew
More information about the Haskell-prime
mailing list