[Haskell-cafe] beginner's problem about lists

ihope ihope127 at gmail.com
Tue Oct 10 17:15:16 EDT 2006


On 10/10/06, Nicolas Frisby <nicolas.frisby at gmail.com> wrote:
> > data Fin
> > data Inf
>
> > data List l a = Cons a (List l a) | Nil

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...


More information about the Haskell-Cafe mailing list