Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-22 Thread Frank Atanassow
On maandag, sep 22, 2003, at 00:07 Europe/Amsterdam, Brandon Michael Moore wrote: Can anyone tell me what's wrong with the following derivation? Without going through your derivation completely, the problem is almost certainly polymorphic recursion. Vector is a nested datatype---its definition

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-22 Thread oleg
Dominic Steinitz wrote: My motivation in using this type was to see if, for example, I could restrict addition of a vector to another vector to vectors of the same length. This would be helpful in the crypto library where I end up having to either define new length Words all the time or using

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-21 Thread Dominic Steinitz
, September 20, 2003 5:19 PM Subject: Re: Polymorphic Recursion / Rank-2 Confusion On Sat, Sep 20, 2003 at 12:01:32PM +0100, Dominic Steinitz wrote: Can anyone tell me why the following doesn't work (and what I have to do to fix it)? I thought by specifying the type of coalw as rank-2 would allow

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-21 Thread Brandon Michael Moore
On Sun, 21 Sep 2003, Dominic Steinitz wrote: Brandon, I get the error below without the type signature. My confusion was thinking I needed rank-2 types. In fact I only need polymorphic recursion. Ross Paterson's suggestion fixes the problem. I stole Even and Odd from Chris Okasaki's paper

Polymorphic Recursion / Rank-2 Confusion

2003-09-20 Thread Dominic Steinitz
Can anyone tell me why the following doesn't work (and what I have to do to fix it)? I thought by specifying the type of coalw as rank-2 would allow it to be used both at a and (a,b). Dominic. Reading file Test.hs:tten Type checking ERROR Test.hs:18 - Inferred type is not general enough ***

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-20 Thread Frank Atanassow
On zaterdag, sep 20, 2003, at 13:01 Europe/Amsterdam, Dominic Steinitz wrote: Can anyone tell me why the following doesn't work (and what I have to do to fix it)? I thought by specifying the type of coalw as rank-2 would allow it to be used both at a and (a,b). This will never work. A function

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-20 Thread Ross Paterson
On Sat, Sep 20, 2003 at 12:01:32PM +0100, Dominic Steinitz wrote: Can anyone tell me why the following doesn't work (and what I have to do to fix it)? I thought by specifying the type of coalw as rank-2 would allow it to be used both at a and (a,b). Change the signature to coal_ :: (v

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-20 Thread Brandon Michael Moore
On Sat, 20 Sep 2003, Ross Paterson wrote: On Sat, Sep 20, 2003 at 12:01:32PM +0100, Dominic Steinitz wrote: Can anyone tell me why the following doesn't work (and what I have to do to fix it)? I thought by specifying the type of coalw as rank-2 would allow it to be used both at a and

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-20 Thread Brandon Michael Moore
Sorry about the empty message. Send /= Cancel Can anyone tell me why the following doesn't work (and what I have to do to fix it)? I thought by specifying the type of coalw as rank-2 would allow it to be used both at a and (a,b). Frank explained why the type you gave wouldn't work. I would