Skip to content

Instantly share code, notes, and snippets.

(define/augment (create-frame/universe frm play-back-custodian)
(define p (new horizontal-pane% [parent frm][alignment '(center center)]))
(: pb (-> Void))
(define (pb)
(parameterize ([current-custodian play-back-custodian])
(thread (lambda () (play-back)))
(stop)))
(: switch (-> Void))
(define (switch)
(send stop-button enable #f)
#lang racket
(module a typed/racket
(: ch (Evtof Integer))
(define ch ((inst make-channel Integer)))
(provide ch))
(module b racket
(require (submod ".." a))
#lang typed/racket
(define f (lambda (x) (lambda (y) (lambda (z) (number? y)))))
(: b (U Number String))
(define b 5)
(if (((f "foo") b) "baz") (add1 b) 0)
Exception
The application raised an exception with the message:
build-path: path element is an empty string
argument position: 2nd
other arguments...:
#<path:/home/plt-etc/local/new-plt/pkgs/plt-services/meta/pkg-index/official/root/pkgs>
Stack trace:
@takikawa
takikawa / gist:7145628
Last active December 26, 2015 11:39
Type error message sample

Current

-> (: x Integer)
-> (define x "foo")
; readline-input:2:10: Type Checker: Expected Integer, but got String
;   in: "foo"
; [,bt for context]
@takikawa
takikawa / Makefile
Last active December 27, 2015 03:09
all:
raco make -v $(PAPER)
scribble ++style texstyle.tex --pdf $(PAPER)
@takikawa
takikawa / gist:7591186
Last active December 29, 2015 01:09
Type for negate
[negate (-polydots (a b c d)
(cl->* (-> (-> c Univ : (-FS (-filter a 0 null) (-not-filter b 0 null)))
(-> c -Boolean : (-FS (-not-filter b 0 null) (-filter a 0 null))))
(-> (-> c Univ : (-FS (-filter a 0 null) (-filter b 0 null)))
(-> c -Boolean : (-FS (-filter b 0 null) (-filter a 0 null))))
(-> (-> c Univ : (-FS (-not-filter a 0 null) (-filter b 0 null)))
(-> c -Boolean : (-FS (-filter b 0 null) (-not-filter a 0 null))))
(-> (-> c Univ : (-FS (-not-filter a 0 null) (-not-filter b 0 null)))
(-> c -Boolean : (-FS (-not-filter b 0 null) (-not-filter a 0 null))))
(-> ((list) [d d] . ->... . Univ)
#lang racket
(define/contract c%
(class/c [n (-> (object/c [m (->m integer? integer?)]) integer?)])
(class object%
(super-new)
(define/public (m x)
(add1 x))
(define/public (n)
(send (new this%) m "foo")
@takikawa
takikawa / After
Last active January 3, 2016 04:19
REPL output with pretty printed types
> map
- : (All (c a b ...)
(case->
((a -> c) (Pairof a (Listof a)) -> (Pairof c (Listof c)))
((a b ... b -> c) (Listof a) (Listof b) ... b -> (Listof c))))
#<procedure:map>
> ormap
- : (All (a c b ...)
((a b ... b -> c) (Listof a) (Listof b) ... b -> (U False c)))
#<procedure:ormap>
INFO: generating latex2pdf-fd7e644fe2ef0c8d3705e4b5c0571de0.pdf
INFO: /usr/bin/latex -interaction=batchmode -file-line-error -halt-on-error latex2pdf-fd7e644fe2ef0c8d3705e4b5c0571de0.tex
INFO: loading latex2pdf-fd7e644fe2ef0c8d3705e4b5c0571de0.pdf
pdf-page: contract violation
expected: pdf?
given: #f
in: the 1st argument of
(->
pdf?
exact-nonnegative-integer?