chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Add 'a shorthand for forall types


From: megane
Subject: Re: [Chicken-hackers] [PATCH] Add 'a shorthand for forall types
Date: Sun, 11 Nov 2018 21:49:09 +0200
User-agent: mu4e 1.0; emacs 25.1.1

Peter Bex <address@hidden> writes:

> On Tue, May 29, 2018 at 01:18:02PM +0300, megane wrote:
>> Hello,
>> 
>> This adds support for declaring forall types in more compact manner.
>> 
>> It supports syntax like ('a -> 'a) to declare the type
>> (forall (a) (a -> a)).
>
> I was about to apply this, but the second example added to the manual
> does not make sense to me:
>
>> diff --git a/manual/Types b/manual/Types
>> index 6d5de10..cab029d 100644
>> --- a/manual/Types
>> +++ b/manual/Types
>> @@ -158,6 +158,12 @@ or {{:}} should follow the syntax given below:
>>  
>>  (*) Note: no type-variables are bound inside {{(not TYPE)}}.
>>  
>> +You can use a shorthand {{'SYMBOL}} for introducing free variables in
>> +{{forall}} types, examples:
>> +
>> +  ('a -> 'a) is translated to (forall (a) (a -> a))
>> +  (forall (a) ('a -> a)) is translated to (forall (a) (a -> a))

The second example is correct but maybe not too well stated. Maybe if it
said:
"(forall (a) ('a -> a)) is _also_ translated to (forall (a) (a -> a))"

So if there's an explicit forall with a typevar "a" adding the apostrophe has
no effect.

>> +
>>  Note that type-variables in {{forall}} types may be given "constraint" 
>> types, i.e.
>>  
>>    (: sort (forall (e (s (or (vector-of e) (list-of e))))
>
> It looks like the example is wrong, but I don't know what it's trying
> to say here.  Or maybe I just misunderstand it?
>
> Cheers,
> Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]