Skip to content

Instantly share code, notes, and snippets.

@pnwamk
Created January 26, 2015 01:49
Show Gist options
  • Save pnwamk/38e49bf5f61016b736f5 to your computer and use it in GitHub Desktop.
Save pnwamk/38e49bf5f61016b736f5 to your computer and use it in GitHub Desktop.
dependencies in occurrence typing
#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