Created
January 26, 2015 01:49
-
-
Save pnwamk/38e49bf5f61016b736f5 to your computer and use it in GitHub Desktop.
dependencies in occurrence typing
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 typed/racket | |
(: foo (Any Any -> Number)) | |
(define (foo x y) | |
(cond | |
[(or (and (string? x) (string? y)) | |
(and (number? x) (number? y))) | |
(if (number? x) | |
y ;; <- doesn't typecheck | |
(string-length y))] ;; <- this does -- both should work | |
[else 42])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment