[Haskell-beginners] Enum for natural numbers
jean verdier
verdier.jean at gmail.com
Mon Dec 21 13:40:23 EST 2009
your type is
data Nat = S Nat | Z
and not
data Nat = 1 + Nat | 0
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]
>
>
More information about the Beginners
mailing list