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 us

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 defin

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

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-21 Thread Dominic Steinitz
OTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, 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 >

Re: Polymorphic Recursion / Rank-2 Confusion

2003-09-21 Thread Dominic Steinitz
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 on square matrices. They rela

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

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

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

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

Re: polymorphic recursion (was: Re: Implict parameters and monomorphism)

2001-05-06 Thread Fergus Henderson
On 06-May-2001, Bernard James POPE <[EMAIL PROTECTED]> wrote: > > If you applied the Mercury algorithm to Haskell (ie used fixed point iteration > to search for a type, rather than requiring a type annotation), would > the new type inference algorithm accept/reject the same programs as the > exi

polymorphic recursion (was: Re: Implict parameters and monomorphism)

2001-05-05 Thread Bernard James POPE
> intended, and this can affect a program's meaning and result. As you have noted there are advantages and disadvantages of both schemes. I will say that the Haskell requirement of type annotations does sometimes catch accidental (and unintended) uses of polymorphic recursion, thus making com

Re[2]: Polymorphic recursion

1998-11-04 Thread Shin-Cheng Mu
On Wed, 4 Nov 1998 03:36:05 +1100 Fergus Henderson <[EMAIL PROTECTED]> wrote: > On 03-Nov-1998, Michael Hanus <[EMAIL PROTECTED]> wrote: > > This sounds interesting but how did you implement it? > > As far as I know, the problem of type inference with polymorphic >

Re: Polymorphic recursion

1998-11-04 Thread Fergus Henderson
On 03-Nov-1998, Mark P Jones <[EMAIL PROTECTED]> wrote: > ghc doesn't need to use an iteration limit because it subjects the input > source program to stricter limits to guarantee decidability. The release notes for ghc 4.00 mention a new `-fallow-undecidable-instances' option. I presume that it

Re: Polymorphic recursion

1998-11-04 Thread Fergus Henderson
On 03-Nov-1998, Michael Hanus <[EMAIL PROTECTED]> wrote: > Fergus Henderson wrote: > > >Is there any Haskell implementation that supports polymorphic recursion > > > without the need of annotating the types for defined function by the > > > progr

RE: Polymorphic recursion

1998-11-04 Thread Simon Peyton-Jones
> I don't know whether ghc uses an iteration limit mechanism -- > my guess is that it probably uses the same technique as Hugs. No, it's an iteration limit. (When you say -fallow-undecideable-instances). Simon

RE: Polymorphic recursion

1998-11-03 Thread Mark P Jones
| I think Hugs 1.3c and recent versions of ghc both support undecideable | features in their type systems -- but related to typeclasses and | instance declarations rather than to polymorphic recursion. | | From email with Mark Jones, I gather that Hugs does not use an | iteration limit mechanism

Re: Polymorphic recursion

1998-11-03 Thread Fergus Henderson
On 02-Nov-1998, Tomasz ?ukaszewicz <[EMAIL PROTECTED]> wrote: >Is there any Haskell implementation that supports polymorphic recursion > without the need of annotating the types for defined function by the > programmer? Not as far as I know. However, the current Mercury

Re: Polymorphic recursion

1998-11-03 Thread Michael Hanus
Fergus Henderson wrote: > >Is there any Haskell implementation that supports polymorphic recursion > > without the need of annotating the types for defined function by the > > programmer? > > Not as far as I know. > > However, the current Mercury implementati

Polymorphic recursion

1998-11-02 Thread Tomasz Ɓukaszewicz
Hello, Is there any Haskell implementation that supports polymorphic recursion without the need of annotating the types for defined function by the programmer? For example, when I write in Hugs 1.4: data Tree a = Leaf a | Node (Tree (a,a)) height (Leaf x) = 1 height (Node x) = 1

Re: Polymorphic recursion

1994-01-06 Thread Sebastian Hunt
s (f e)) This works by removing the mutual recursion at the expense of introducing an unwanted additional parameter. Maybe not UTTERLY horrible but still not very nice. OK - I'm convinced that allowing polymorphic recursion in the presence of type signatures is useful, so perhaps it would be worth complicating the type system a bit to allow it. After all, what's a bit of extra complexity when there's so much in there already :-). Sebastian

Re: Polymorphic recursion

1994-01-06 Thread Simon L Peyton Jones
| From: Sebastian Hunt <[EMAIL PROTECTED]> | Date: Thu, 9 Dec 1993 16:00:13 GMT | In the interests of keeping things (ie, the haskell type system) | as simple as possible, I would vote (if I had a vote) against this | proposal. Unless, of course, I was persuaded that the extension was | Really

Re: Polymorphic recursion

1993-12-16 Thread Lennart Augustsson
> One modest extension we could make to the Haskell type system is > > to permit polymorphic recursion if > a type signature is provided I'm absolutely for this suggestion (especially since hbc already has it :-). My reason for this is that it is already possi

Re: Polymorphic recursion

1993-12-10 Thread Kent Karlsson
> Dear people interested in Haskell 1.3, Disclaimer: I'm *not* a member of any "Haskell 1.3" committee, if any such committee has been formed. > One modest extension we could make to the Haskell type system is > > to permit polymorphic recursion if >

Re: Polymorphic recursion

1993-12-10 Thread henglein
On the Haskell mailing list Simon writes: >PS This idea [of admitting polymorphic recursion if it's declared explicitly] >is part of the folklore, but I don't know of a reference which >describes it. Does anyone else? (Specifically the simple type-signature >solution; I

Re: Polymorphic recursion

1993-12-10 Thread Nigel Perry
At 4:32 AM 10/12/93 +1300, Simon L Peyton Jones wrote: >Dear people interested in Haskell 1.3, Well... :-) >One modest extension we could make to the Haskell type system is > > to permit polymorphic recursion if >a type signature is provided > >etc.

Re: Polymorphic recursion

1993-12-09 Thread jones-mark
y constructor functions (the `explicit' context in the instance declaration is what makes this possible; if I showed the definition of dEqFoo, the recursion here would be more obvious). THAT SAID, the decision to support polymorphic recursion in the presence of explicit type signatures does hav

Re: Polymorphic recursion

1993-12-09 Thread Mikael Rittri
> to permit polymorphic recursion if > a type signature is provided > > Simon > > PS This idea is part of the folklore, but I don't know of a reference which > describes it. Does anyone else? (Specifically the simple type-signature > solution; ...)

Re: Polymorphic recursion

1993-12-09 Thread Satish Thatte
> From: Simon L Peyton Jones <[EMAIL PROTECTED]> > [...] > The standard Hindley-Milner restriction is that a recursive function > can only be called monomorphically in its own body. Here's an > example (from an earlier posting to the SML list, which can't typecheck > under this restriction.

Re: Polymorphic recursion

1993-12-09 Thread Sebastian Hunt
> One modest extension we could make to the Haskell type system is > > to permit polymorphic recursion if > a type signature is provided ... > This program looks a little odd, but I can personally testify to having > tripped over this problem in programs that

Polymorphic recursion

1993-12-09 Thread Simon L Peyton Jones
Dear people interested in Haskell 1.3, One modest extension we could make to the Haskell type system is to permit polymorphic recursion if a type signature is provided The standard Hindley-Milner restriction is that a recursive function can only be called monomorphically in

Implementing polymorphic recursion

1993-12-09 Thread jcp
Let me see if I have the implementation correct. To typecheck f :: signature f = ... f ... you would first set the type of f from the signature, typecheck the body of f, and then ensure that the inferred type agrees with the signature. This sounds quite reasonable to me. I suppose the hardes

Re: Polymorphic recursion

1993-12-09 Thread Joe Fasel
I support Simon's proposal to allow explicitly typed polymorphic recursion. It is consistent with the exception to the monomorphism restriction for explicit typings. Let's get a ruling from the type wizards that the principle is sound, however, and from the implementors that