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