Created
February 15, 2019 16:06
-
-
Save philnguyen/2c98df684f74c0eb2e2a02922155bc27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(module typed typed/racket/base | |
(provide double) | |
(define-type Increasing (([n : Natural]) . → . (Refine [a : Natural] (> a n)))) | |
(: double : Increasing → Increasing) | |
;; Modular type-checking of this module cannot eliminate: | |
;; - `(Refine [a : Natural] (> a n))` in `f`'s range | |
;; - `Natural` in `n` | |
(define ((double f) n) (f (f n)))) | |
(module untyped racket/base | |
(require (submod ".." 'typed)) | |
(provide/contract [add2 (integer? . -> . integer?)]) | |
(define add2 (double add1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment