Counting Constructors

2001-07-17 Thread Tobias Haeberlein
I want a show - instance for that type: data Bind a = Zero | Succ a resp. for the types (Bind ( ... (Bind a)...)) showing the following: show (Succ ( ... (Succ Zero)..)) = n (where n is the number of Succ's) and show (Succ ( ... (Succ x)..)) = show x

Re: Counting Constructors

2001-07-17 Thread Marcin 'Qrczak' Kowalczyk
Tue, 17 Jul 2001 12:08:51 +0200 (MEST), Tobias Haeberlein <[EMAIL PROTECTED]> pisze: > show (Succ ( ... (Succ Zero)..)) = n > (where n is the number of Succ's) > and > > show (Succ ( ... (Succ x)..)) = show x > (when x != Zero) This is not possible i

Re: Counting Constructors

2001-07-17 Thread Gertjan Kamsteeg
for it, independent of its first argument. Gertjan - Original Message - From: "Marcin 'Qrczak' Kowalczyk" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 17, 2001 9:13 PM Subject: Re: Counting Constructors > Tue, 17 Jul 2001 12:08:51

Re: Counting Constructors

2001-07-18 Thread Jay Cox
> From: Tobias Haeberlein <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Counting Constructors > > I want a show - instance for that type: > data Bind a = Zero | Succ a > resp. for the types (Bind ( ... (Bind a)...)) > > showing the f

Re: Counting Constructors

2001-07-19 Thread Tobias Haeberlein
Thanks all for helping me! For those, who are interested in it: I got another solution of the problem: Instead of defining data Nest a = Zero | Succ a I "lift" Nest to the class level: data Zero a = Zero a data Succ a = Succ a class Nest a where