[clean-list] Re: Class restriction to 32

Diederik van Arkel dvanarkel@mac.com
Fri, 13 Jun 2003 23:00:51 +0200


On Friday, June 13, 2003, at 06:07 PM, shivkumar chandrasekaran wrote:

[snip]
> PS: Let me try to build a mock example here of what I mean:
>
> class ci t		}
> instance ci Real	} where i goes from 1 to 100 say
> instance ci Complex	}
>
> Then I define some utility functions
>
> fun_i _ _ _ | ci_1, ci_2, ... ci_10
>
> And suppose there are 50 such utility functions, all of which depend on
> 10 classes individually.
>
> Now suppose I build my big function
>
> g _ _ _ | fun_1, fun_2, fun_3, fun_4, fun_5
>
> Now g indirectly depends on more than 32 class members. In 1.3 I
> remember this being a problem. Will this work in 2.0? If not, is there 
> a
> way around it?

I'd guess that you will still run into the same problems. Have you 
tried defining
a class combining the individual classes you require e.g.

class Combined a | ci_1,ci_2,ci_3,...,ci_10 a

and then having your function typed as

fun :: ... | Combined a

I believe this should allow you to reduce the number of function 
arguments below
32 again. Note that you are really running into two restrictions here. 
One that classes
are restricted to 32 members and the other that functions are 
restricted to 32 arguments
including class restrictions.

HTH

Diederik van Arkel