[racket] From types to contracts

From: Benjamin Greenman (blg59 at cornell.edu)
Date: Mon Nov 17 23:26:36 EST 2014

I'd like to convert the following typed program into an untyped one that
uses a contract instead of a type signature to protect the member function.

#lang typed/racket
(struct: (A) Node ([val : A]

                   [left-tree  : (MyTree A)]

                   [right-tree : (MyTree A)]))
(define-type (MyTree A) (U 'Nil (Node A)))

(: member (All (A) (-> A (MyTree A) Boolean)))
(define (member x xs)
  #t)


More specifically, can someone help me fill in the blank marked "TODO"
below:

#lang racket
(struct Node (val left-tree right-tree))

(define/contract (member x xs)
  (parametric->/c [A] TODO)
  #t)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141117/10e09739/attachment.html>

Posted on the users mailing list.