[Haskell-cafe] beginner's problem about lists
Matthias Fischmann
fis at wiwi.hu-berlin.de
Wed Oct 11 09:26:17 EDT 2006
On Wed, Oct 11, 2006 at 11:40:59AM +0100, Malcolm Wallace wrote:
> To: haskell-cafe at haskell.org
> From: Malcolm Wallace <Malcolm.Wallace at cs.york.ac.uk>
> Date: Wed, 11 Oct 2006 11:40:59 +0100
> Subject: Re: [Haskell-cafe] beginner's problem about lists
>
> ihope <ihope127 at gmail.com> wrote:
>
> > It's possible to make both "infinite list" and "finite list"
> > datatypes:
> >
> > data Inf a = InfCons a (Inf a)
> > data Fin a = FinCons a !(Fin a) | FinNil
> >
> > At least, I think the Fin type there has to be finite...
>
> No, your Fin type can also hold infinite values. The strictness
> annotation on the (Fin a) component merely ensures that the tail exists
> to one constructor's depth (Head Normal Form). It does not force
> strictness all the way down (full Normal Form).
let q = FinCons 3 q in case q of FinCons i _ -> i ==> _|_
does that contradict, or did i just not understand what you are saying?
matthias
More information about the Haskell-Cafe
mailing list