Skip to content

Instantly share code, notes, and snippets.

@gatlin
Created September 12, 2014 17:36
Show Gist options
  • Save gatlin/44c5d00695a69316deda to your computer and use it in GitHub Desktop.
Save gatlin/44c5d00695a69316deda to your computer and use it in GitHub Desktop.
Simple macro for Typed Racket which makes definitions look nicer to me
#lang typed/racket
(define-syntax (= stx)
(syntax-case stx ()
[(= sym expr)
#'(define sym expr)]
[(= sym (arg ...) expr)
#'(define (sym arg ...) expr)]))
;; example usage
(: lang String)
(= lang "Typed Racket")
(: square (-> Number Number))
(= square (x) (* x x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment