[racket] typed racked questions

From: Bikal Gurung (gbikal at gmail.com)
Date: Mon Apr 30 18:07:38 EDT 2012

hmmm ... I am getting some error. My repl session below. I am using 'db'
module.

> bind-prepared-statement
. Type Checker: untyped top-level identifier lifted.474 in:
bind-prepared-statement
>

Not sure what to make of it. My impression was the typed/untyped code mix
well. Am i missing something ??

Bikal

On Mon, Apr 30, 2012 at 10:54 PM, Vincent St-Amour <stamourv at ccs.neu.edu>wrote:

> The REPL prints types automatically:
>
> Welcome to Racket v5.3.0.4.
> -> vector-ref
> - : (All (a) ((Vectorof a) Integer -> a))
> #<procedure:vector-ref>
> -> (define: x : String "Hello")
> -> x
> - : String
> "Hello"
> ->
>
>
> Is this what you had in mind?
>
> Vincent
>
>
>
> At Mon, 30 Apr 2012 22:23:01 +0100,
> Bikal Gurung wrote:
> >
> > [1  <multipart/alternative (7bit)>]
> > [1.1  <text/plain; ISO-8859-1 (7bit)>]
> > Sam,
> >
> > Is there a function in racket which will - given a name - display the
> > function/variable signature in the REPL?
> >
> > I am thinking about haskell prelude(REPL) that gives me the type
> signature
> > when I enter :t <func name> in the repl?
> >
> > With Thanks
> > Bikal
> >
> > On Mon, Apr 30, 2012 at 1:48 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu
> >wrote:
> >
> > > On Mon, Apr 30, 2012 at 12:51 AM, Bikal Gurung <gbikal at gmail.com>
> wrote:
> > > > Hi All,
> > > >
> > > > I am investigating typed racket. I was wondering if someone could
> help
> > > with
> > > > answering the questions below.
> > > >
> > > > 1) Can we mix/import modules written in untyped racket to a module
> that
> > > is
> > > > used typed racket. I have experimented with a few modules using and
> they
> > > > seem to work in general but not really sure about the mechanism that
> > > makes
> > > > it work. How does racket make the untyped code and typed code work
> > > together
> > > > if they do? Is this in a case by case basis, ie. module/library by
> > > library
> > > > basis?
> > >
> > > Yes, you can mix typed modules and untyped modules in the same
> > > program.  This is one of the most fundamental features of Typed
> > > Racket.  To use a typed module from an untyped module, just require it
> > > -- contracts are inserted automatically to check the operation.  To
> > > use an untyped module from a typed module, use `require/typed' to
> > > specify the type.
> > >
> > > > 2) What is the canonical racket paradigm? use typed racket or untyped
> > > > racket? Or is this more an issue of a preference/style?
> > >
> > > This is very much an issue of style.  I think there are a number of
> > > advantages of type systems for maintenance, optimization,
> > > documentation, and organization, so I encourage you to use Typed
> > > Racket.  However, if you use plain Racket, Typed Racket is designed to
> > > make it easy to switch, a module at a time, when you decide you want
> > > types.
> > >
> > > > 3) Are typed racket programs faster than untyped ones? The
> documentation
> > > > says so but I was wondering if there has been any benchmark or study
> > > being
> > > > done on this topic.
> > >
> > > Yes, Typed Racket has an optimizing compiler (by Vincent St-Amour)
> > > which uses the type information to make your program go faster.  You
> > > can see some benchmark results in our papers
> > > http://www.ccs.neu.edu/racket/pubs/padl12-stff.pdf and
> > > http://www.ccs.neu.edu/racket/pubs/pldi11-thacff.pdf .
> > >
> > > > 4) Can typed racket module be used in the context of untyped racket
> > > module?
> > >
> > > Yes, you can just `require` the typed module, and it should work.
> > >
> > > > 5) Is there a Hindlye/Milner style type inferencing algorithm for
> typed
> > > > racket being worked on?
> > >
> > > The Typed Racket type system contains a number of features that go
> > > beyond what's supported in Hindley/Milner style type systems, and so
> > > we can't use that inference system.  Currently, Typed Racket uses
> > > local type inference to infer many of the types in your program, but
> > > we'd like to infer more of them -- this is an ongoing area of
> > > research.  However, inferring all the types in the program, the way
> > > that ML and Haskell do, is not a goal of Typed Racket -- having type
> > > annotations there makes the program self-documenting and easier to
> > > understand, improves type error messages, and supports advanced type
> > > system features.
> > >
> > > Thanks for your interest in Typed Racket, and if you have any more
> > > questions, please ask.
> > > --
> > > sam th
> > > samth at ccs.neu.edu
> > >
> > [1.2  <text/html; ISO-8859-1 (quoted-printable)>]
> >
> > [2  <text/plain; us-ascii (7bit)>]
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120430/8512c1e5/attachment-0001.html>

Posted on the users mailing list.