Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Typed Racket vs. Haskell

Received: by 10.224.42.68 with SMTP id r4mr1693526qae.4.1348155337573;
        Thu, 20 Sep 2012 08:35:37 -0700 (PDT)
X-BeenThere: racket-users@googlegroups.com
Received: by 10.224.101.68 with SMTP id b4ls5198988qao.0.gmail; Thu, 20 Sep
 2012 08:35:37 -0700 (PDT)
Received: by 10.224.213.1 with SMTP id gu1mr1685979qab.7.1348155337468;
        Thu, 20 Sep 2012 08:35:37 -0700 (PDT)
Received: by 10.224.213.1 with SMTP id gu1mr1685977qab.7.1348155337452;
        Thu, 20 Sep 2012 08:35:37 -0700 (PDT)
Return-Path: <users-boun...@racket-lang.org>
Received: from champlain.ccs.neu.edu (champlain.ccs.neu.edu. [129.10.115.116])
        by gmr-mx.google.com with ESMTPS id x33si681940qci.3.2012.09.20.08.35.37
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 20 Sep 2012 08:35:37 -0700 (PDT)
Received-SPF: neutral (google.com: 129.10.115.116 is neither permitted nor denied by domain of users-boun...@racket-lang.org) client-ip=129.10.115.116;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 129.10.115.116 is neither permitted nor denied by domain of users-boun...@racket-lang.org) smtp.mail=users-boun...@racket-lang.org
Received: from champlain.ccs.neu.edu (localhost.localdomain [127.0.0.1])
	by champlain.ccs.neu.edu (8.14.4/8.14.4) with ESMTP id q8KFXnex032702;
	Thu, 20 Sep 2012 11:33:52 -0400
Received: from mail-ob0-f174.google.com (mail-ob0-f174.google.com
	[209.85.214.174])
	by champlain.ccs.neu.edu (8.14.4/8.14.4) with ESMTP id q8KFXhrl032695
	for <us...@lists.racket-lang.org>; Thu, 20 Sep 2012 11:33:43 -0400
Received: by obbuo13 with SMTP id uo13so1806010obb.33
	for <us...@lists.racket-lang.org>; Thu, 20 Sep 2012 08:33:43 -0700 (PDT)
	d=google.com; s=20120113;
	h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf
	:x-virus-scanned:date:message-id:from:to:cc:subject:in-reply-to
	:references:user-agent:mime-version:content-type:x-gm-message-state;
	bh=swBlNOO2fbazq31kXnQZSfWpgfm057rDcQ7pJqMhbMI=;
	b=ORsh7An0vnt6B6UA53A1lT0QP41OQVT79XynmEljIYs6dhty3IYWik27DOXfsUnqEn
	Ep5hxfvepGrAVqVfMsK6eDo3+Knq8W/6QGAirql9PLe96YLLUsPcX76UT6vXMwQMeIF6
	v4ydhqGhmWS7Dv4zcyXr1usM+rdE0p6C76H5vinIFZrsJr0YaqGcN+g9pvkJnJ03Mfoq
	o1cNSsn4FSEaQCZWpgXBWFkxRIPkVqRHJlrJh3tHGSkdigZBLYw6KZ/ZUTw0O0R2WCKY
	kyg7sbjlf/WqxO3vhJ9KhLfSsSjn0gjffSom7iRCWdshO2dv6B2UuAyCWKiU6MVy13Q5
	rCSA==
Received: by 10.60.26.133 with SMTP id l5mr1631446oeg.60.1348155223013;
	Thu, 20 Sep 2012 08:33:43 -0700 (PDT)
X-Forwarded-To: us...@lists.racket-lang.org
X-Forwarded-For: us...@plt-scheme.org us...@lists.racket-lang.org
Delivered-To: us...@racket-lang.org
Received: by 10.76.13.162 with SMTP id i2csp73608oac;
	Thu, 20 Sep 2012 08:33:42 -0700 (PDT)
Received: by 10.101.138.6 with SMTP id q6mr620165ann.87.1348155221501;
	Thu, 20 Sep 2012 08:33:41 -0700 (PDT)
Received: from amber.ccs.neu.edu (amber.ccs.neu.edu. [129.10.116.51])
	by mx.google.com with ESMTPS id h6si324778anp.40.2012.09.20.08.33.41
	(version=TLSv1/SSLv3 cipher=OTHER);
	Thu, 20 Sep 2012 08:33:41 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of
	stamo...@ccs.neu.edu designates 129.10.116.51 as permitted
	sender) client-ip=129.10.116.51;
Received: from zimbra.ccs.neu.edu ([129.10.116.59])
	by amber.ccs.neu.edu with esmtp (Exim 4.69)
	(envelope-from <stamo...@ccs.neu.edu>)
	id 1TEil2-0007BW-Oz; Thu, 20 Sep 2012 11:33:40 -0400
Received: from localhost (localhost [127.0.0.1])
	by zimbra.ccs.neu.edu (Postfix) with ESMTP id B3A7BF74010;
	Thu, 20 Sep 2012 11:33:40 -0400 (EDT)
X-Virus-Scanned: amavisd-new at zimbra.ccs.neu.edu
Received: from zimbra.ccs.neu.edu ([127.0.0.1])
	by localhost (zimbra.ccs.neu.edu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 9gZvH9KJBtr2; Thu, 20 Sep 2012 11:33:32 -0400 (EDT)
Received: from ahuntsic.ccs.neu.edu. (ahuntsic.ccs.neu.edu [129.10.115.112])
	by zimbra.ccs.neu.edu (Postfix) with ESMTP id D7CDCF5C004;
	Thu, 20 Sep 2012 11:33:32 -0400 (EDT)
Date: Thu, 20 Sep 2012 11:33:32 -0400
Message-ID: <87ipb8675f.wl%stamo...@ccs.neu.edu>
From: Vincent St-Amour <stamo...@ccs.neu.edu>
To: thorso...@lavabit.com
In-Reply-To: <25518.77.105.186.199.1348123262.squir...@lavabit.com>
References: <58500.77.105.186.199.1347982242.squir...@lavabit.com>
	<C2D9BD24-3FE9-400B-8EA0-AF0F15C82...@brinckerhoff.org>
	<87sjaf6wyv.wl%stamo...@ccs.neu.edu>
	<25375.77.105.186.199.1347998909.squir...@lavabit.com>
	<41621.77.105.186.199.1347999232.squir...@lavabit.com>
	<D0C05DBD-67E5-4061-A9A9-FE335F117...@ccs.neu.edu>
	<20570.35393.46956.617...@winooski.ccs.neu.edu>
	<25518.77.105.186.199.1348123262.squir...@lavabit.com>
User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka)
	FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/23.1
	(i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)
MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
X-Gm-Message-State: ALoCoQlyI8mUrhQdMnLT6s2jizxCAJ3RU2Ezfx89pkvsCn4YaLXP6B3E6b+1r+LzgAEQ2iuE56N6
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW
	autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	champlain.ccs.neu.edu
Cc: us...@racket-lang.org
Subject: Re: [racket] Typed Racket vs. Haskell
X-BeenThere: us...@racket-lang.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Racket Users <users.racket-lang.org>
List-Unsubscribe: <http://lists.racket-lang.org/users/options>,
	<mailto:users-requ...@racket-lang.org?subject=unsubscribe>
List-Archive: <http://lists.racket-lang.org/users/archive/>
List-Post: <mailto:us...@racket-lang.org>
List-Help: <mailto:users-requ...@racket-lang.org?subject=help>
List-Subscribe: <http://lists.racket-lang.org/users/listinfo>,
	<mailto:users-requ...@racket-lang.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: users-boun...@racket-lang.org
Errors-To: users-boun...@racket-lang.org

At Thu, 20 Sep 2012 02:41:02 -0400 (EDT),
thorso...@lavabit.com wrote:
> > The required "translation" step will be mostly
> > removing the type declarations.  Doing the same with Haskell etc would
> > most likely be much harder.
> 
> Is it possible not to remove types?

Yes. A Typed Racket is a Racket program, so Racket can run it just fine.

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.

> Vincent told me that one can "mix typed and untyped code" in Racket.

Here's a simple example:

    ;; in file typed.rkt
    #lang typed/racket
    (provide louder)
    (: louder : String -> String)
    (define (louder s) (string-append s "!"))

    ;; in file untyped.rkt
    #lang racket
    (require "typed.rkt")
    (displayln (louder "I can call typed code"))

The first module is written in Typed Racket, and the second in untyped
Racket. If you run "untyped.rkt", it prints "I can call typed code!", as
expected.

You can also require untyped code from typed code using `require/typed'.

> How it's done in Racket (the implementation details)? How these modules
> interact? Could you give me some pointers?

Typed Racket modules compile to Racket modules, which interact with
other Racket modules via the module system. To make sure that typed
functions don't get invalid inputs from untyped code, the Racket
contract system checks everything that goes from untyped to typed code.

For example, if the untyped module above tried to do

    (louder 3)

this would raise an error, since `louder' only accepts strings.

For more details about how contracts are used for typed-untyped
interaction, you can read
    http://www.ccs.neu.edu/racket/pubs/dls06-tf.pdf

> 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: the module system, the contract system, and Racket's
language extension facilities (including, but not limited to the macro
system), among others.

For more information about how the Typed Racket implementation uses
these mechanisms, you can read
    http://www.ccs.neu.edu/racket/pubs/pldi11-thacff.pdf

Other systems that provide similar infrastructure could build their own
Typed Racket-like systems, too. Typed Clojure and Typed Ironscheme are
two such projects. IIUC, Guile has most of the necessary puzzle pieces,
too. But even with the necessary infrastructure, building such a system
remains a large engineering undertaking.

Vincent
____________________
  Racket Users list:
  http://lists.racket-lang.org/users