[plt-scheme] Re: Re: Typed Scheme: Is there any easy way around this?

From: Anton van Straaten (anton at appsolutions.com)
Date: Fri Jun 1 10:38:44 EDT 2007

Matthias Felleisen wrote:
> On Jun 1, 2007, at 1:37 AM, Matthew Swank wrote:
>> Well, I don't use contracts.  My basis for a claim of verbosity is my
>> (somewhat limited) experience of Haskell and straight lisp.
>> Compared to those, Typed Scheme is verbose.
> That's something we can't fix so don't report it "-) 

There might be room for improvement, though.  Maybe Typed Scheme can 
already do the following, I've only read some docs so far.

The approach in which types can be annotated inline, like [n : number], 
is used in the MLs too.  My experience is that such annotations make ML 
code more difficult to read and follow.  Ironically, that's partly 
because it starts requiring a lot of parentheses, which break the flow 
of argument lists.  If I find myself needing lots of annotations for 
some reason, I prefer to use a module signature to separate the 
annotations from the code.  Alternatively, the Haskell approach of 
prepending the type signature to the function is a good one.

Having the option to do something like this could help mitigate the 
verbosity.  (Of course, I'm speculating having only read Typed Scheme 
code so far, not written it.)

So e.g. instead of:

   (define: (find [v : number] [l : (Listof number)]) : (Maybe number)

...you might use something more like:

(define/type ((number * (Listof number)) -> (Maybe number))    ;[*]
   (find v l)

If it's already possible to do something like this, I await the 
cluestick eagerly.


[*] using fantasy dot-free infix type notation

Posted on the users mailing list.