[racket] Typed Racket vs. Haskell
Yesterday, thorsopia at lavabit.com wrote:
> > Developing statically typed code in TR and making it work later on
> > other Scheme implementations should be easy, since the TR type
> > system is intended to allow the same style of code that is used in
> > Racket, which is also similar to the style in other scheme
> > implementations.
>
> Actually, this is what I was asking about. (Guile people told me to
> use C or bins, but I don't want to go that deep.)
[That's what I thought, and I posted yet another reply because it
sounded like you were headed that way...]
Yesterday, Vincent St-Amour wrote:
>
> What Eli was saying is that if you want to port it to, say, Guile,
> part of the work will be removing the types, and part of it will be
> porting the resulting Racket program to Guile.
Exactly -- and if you stick to code that is "mostly basic scheme" then
the latter might not be too bad. (And in any case it is probably much
easier than writing haskell code and using a compiled binary from
guile.)
> > Why it's not possible in other Lisp-like languages (e.g. Guile)?
>
> Typed Racket relies on several important pieces of infrastructure
> that Racket provides [...]
(You should view Matthias's reply that it's possible *given* what
Vincent says above -- it's possible, but will require a ton of work.
AFAICT, Guile is getting to be the implementation where the needed
delta is smaller, but getting to a working TR-like would still be a
huge project.)
Yesterday, Patrick Mahoney wrote:
> One feature of typed racket that makes translation between untyped
> and typed code somewhat less simple than adding or removing type
> signatures
In case some people miss the obvious here: "removing type signatures"
is easy in any scheme -- you just need to define `:' as a macro that
ignores its contents.
> is that certain forms require rewriting/alteration of the untyped
> form itself. Others allow stand-alone declaration of the types prior
> to the form.
Right, but for thorsopia's case many of them (like the `for*:' forms)
are not important since they're Racket-specific anyway. The `struct:'
form is probably still relevant though -- since doing any serious work
without the ability to define new structs is an insane step back to
the dark SICP days.
> I'd really dig the addition of an alternate way to declare types on
> structs in particular:
>
> #lang typed/racket
> (: arrow (ForAll (A B) (StructOf A B)))
> (struct arrow (a b))
>
> This allows me to reuse my mental untyped code parser for struct
> forms, while the struct: form requires an additional rule. It also
> makes declaration of types more uniform. Not sure whether this is
> possible.
+1 for the sentiment, but the above makes `StructOf' a weird meta
thing which can be confusing in itself. Also, there are still other
`foo:'s and there's the identifier syntax that I think is mostly
obscure...
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!