Permalink
Switch branches/tags
Nothing to show
Find file Copy path
f51ae6e Dec 13, 2016
@bennn @btlachance
62 lines (46 sloc) 1.63 KB

trivial

Build Status Coverage Status Scribble

The trivial library implements type tailoring for a variety of standard library operations.

The tailored operations catch more errors statically and raise fewer unnecessary type errors.

#lang typed/racket
(require trivial)

(format "binary(~a) = ~b" 3.14 3.14)
;; static type error :)

(let ([match-list (regexp-match #rx"(a*)(b*)" "aaab")])
  (if match-list
    (string-length (second match-list))
    0))
;; not a type error :)

(vector-ref (make-vector 3 #true) 4)
;; static bounds error :)

See the documentation for more details. http://docs.racket-lang.org/trivial/index.html

Install

From the package server:

  $ raco pkg install trivial

From GitHub:

  $ git clone https://github.com/bennn/trivial
  $ raco pkg install ./trivial

Project Structure

  • trivial/main.rkt defines the API (e.g. the result of (require trivial))
  • trivial/define.rkt trivial/format.rkt trivial/function.rkt trivial/integer.rkt trivial/list.rkt trivial/regexp.rkt trivial/vector.rkt implement tailored versions of Racket forms
  • trivial/tailoring.rkt is an API for building new tailorings
  • trivial/private/ main implementation
  • test/ unit tests