# [Haskell-beginners] Enum for natural numbers

kane96 at gmx.de kane96 at gmx.de
Mon Dec 21 15:02:06 EST 2009

```-------- Original-Nachricht --------
> Datum: Mon, 21 Dec 2009 19:40:23 +0100
> Von: jean verdier <verdier.jean at gmail.com>
> An: kane96 at gmx.de
> CC: beginners at haskell.org
> Betreff: Re: [Haskell-beginners] Enum for natural numbers

> your type is
> data Nat = S Nat | Z
> and not
> data Nat = 1 + Nat | 0

Do I have to use something like fromEnum (S Z)? Or or the iteration wrong?

>
> On Mon, 2009-12-21 at 18:27 +0100, kane96 at gmx.de wrote:
> > -------- Original-Nachricht --------
> > > Datum: Mon, 21 Dec 2009 15:06:38 +0100
> > > Von: Daniel Fischer <daniel.is.fischer at web.de>
> > > An: beginners at haskell.org
> > > CC: kane96 at gmx.de
> > > Betreff: Re: [Haskell-beginners] Enum for natural numbers
> >
> > > Am Montag 21 Dezember 2009 15:02:16 schrieb kane96 at gmx.de:
> > > > In another task I should create an infinite list: allNats :: [Nat]
> > > > I would have done it in a recursion but there issn't a parameter to
> call
> > > > allNats with
> > >
> > > Prelude> :t iterate
> > > iterate :: (a -> a) -> a -> [a]
> >
> > this works:
> > allNats = (iterate (1+) 1)
> > but it doesn't match my declaration:
> > allNats :: [Nat]
> >
> >

--
Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.!
http://portal.gmx.net/de/go/dsl02
```