typed-racket/typed-racket-test/succeed/unsafe-provide.rkt
Asumu Takikawa eb90cd4e8c Add a typed/racket/unsafe library.
Comes with `unsafe-require/typed` and `unsafe-provide`.
These operations do not generate contracts but are not
exported by default by Typed Racket.
2015-09-29 18:48:08 -04:00

32 lines
650 B
Racket

#lang racket/base
;; Test unsafe provide form
(require racket/contract/combinator
racket/function)
(module a typed/racket
(require typed/racket/unsafe)
(: f (-> String String))
(define (f x)
(string-append x "foo"))
(unsafe-provide f)
(unsafe-provide (rename-out [f g]))
(struct foo ([x : String]))
(unsafe-provide (struct-out foo)))
(require 'a)
;; UNSAFE
;; primitive error, no blame should be raised
(with-handlers ([(negate exn:fail:contract:blame?) void])
(f 3))
(with-handlers ([(negate exn:fail:contract:blame?) void])
(g 3))
(with-handlers ([(negate exn:fail:contract:blame?) void])
(foo-x (foo 3)))