From 06b9eb298705d2860b129508a9e9f3cd5c3203a4 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 15 Dec 2015 21:25:41 -0500 Subject: [PATCH 1/6] [no-colon] re-export bindings without the colon --- no-colon.rkt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 no-colon.rkt diff --git a/no-colon.rkt b/no-colon.rkt new file mode 100644 index 0000000..22018c2 --- /dev/null +++ b/no-colon.rkt @@ -0,0 +1,30 @@ +#lang typed/racket/base + +;; Provides the same bindings as `trivial/main`, +;; but without the trailing colon. + +(provide (all-from-out trivial)) + +(require + (rename-in trivial + ;; -- from `format.rkt` + [format: format] + [printf: printf] + + ;; -- from `regexp.rkt` + [regexp-match: regexp-match] + [regexp: regexp] + [pregexp: pregexp] + [byte-regexp: byte-regexp] + [byte-pregexp: byte-pregexp] + [define-regexp: define-regexp] + [define-pregexp: define-pregexp] + [define-byte-regexp: define-byte-regexp] + [define-byte-pregexp: define-byte-pregexp] + + ;; -- from `math.rkt` + [+: +] + [-: -] + [*: *] + [/: /] +)) From 657d637bde8d43d053846b5de16c5443dae5c8f9 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 16 Dec 2015 03:08:21 -0500 Subject: [PATCH 2/6] ** add docs button --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6d2a4d7..16deb5d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ trivial === [![Build Status](https://travis-ci.org/bennn/trivial.svg)](https://travis-ci.org/bennn/trivial) [![Coverage Status](https://coveralls.io/repos/bennn/trivial/badge.svg?branch=master&service=github)](https://coveralls.io/github/bennn/trivial?branch=master) +[![Scribble](https://img.shields.io/badge/Docs-Scribble-blue.svg)](http://pkg-build.racket-lang.org/doc/trivial/index.html) This library provides "smarter" versions of Typed Racket standard library functions. For example: From a13bd8e5d8e8bdff7c6354c321f8dce1eafa9596 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 16 Dec 2015 03:15:14 -0500 Subject: [PATCH 3/6] [no-colon] per-package --- format/no-colon.rkt | 7 +++++++ math/no-colon.rkt | 9 +++++++++ no-colon.rkt | 30 +++++++----------------------- regexp/no-colon.rkt | 14 ++++++++++++++ 4 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 format/no-colon.rkt create mode 100644 math/no-colon.rkt create mode 100644 regexp/no-colon.rkt diff --git a/format/no-colon.rkt b/format/no-colon.rkt new file mode 100644 index 0000000..bda290b --- /dev/null +++ b/format/no-colon.rkt @@ -0,0 +1,7 @@ +#lang typed/racket/base + +(provide (all-from-out trivial/format)) + +(require (rename-in trivial/format + [format: format] + [printf: printf])) diff --git a/math/no-colon.rkt b/math/no-colon.rkt new file mode 100644 index 0000000..fba3512 --- /dev/null +++ b/math/no-colon.rkt @@ -0,0 +1,9 @@ +#lang typed/racket/base + +(provide (all-from-out trivial/math)) + +(require (rename-in trivial/math + [+: +] + [-: -] + [*: *] + [/: /])) diff --git a/no-colon.rkt b/no-colon.rkt index 22018c2..d0392c9 100644 --- a/no-colon.rkt +++ b/no-colon.rkt @@ -3,28 +3,12 @@ ;; Provides the same bindings as `trivial/main`, ;; but without the trailing colon. -(provide (all-from-out trivial)) +(provide + (all-from-out trivial/format/no-colon) + (all-from-out trivial/math/no-colon) + (all-from-out trivial/regexp/no-colon)) (require - (rename-in trivial - ;; -- from `format.rkt` - [format: format] - [printf: printf] - - ;; -- from `regexp.rkt` - [regexp-match: regexp-match] - [regexp: regexp] - [pregexp: pregexp] - [byte-regexp: byte-regexp] - [byte-pregexp: byte-pregexp] - [define-regexp: define-regexp] - [define-pregexp: define-pregexp] - [define-byte-regexp: define-byte-regexp] - [define-byte-pregexp: define-byte-pregexp] - - ;; -- from `math.rkt` - [+: +] - [-: -] - [*: *] - [/: /] -)) + trivial/format/no-colon + trivial/math/no-colon + trivial/regexp/no-colon) diff --git a/regexp/no-colon.rkt b/regexp/no-colon.rkt new file mode 100644 index 0000000..b0bdfe5 --- /dev/null +++ b/regexp/no-colon.rkt @@ -0,0 +1,14 @@ +#lang typed/racket/base + +(provide (all-from-out trivial/regexp)) + +(require (rename-in trivial/regexp + [regexp-match: regexp-match] + [regexp: regexp] + [pregexp: pregexp] + [byte-regexp: byte-regexp] + [byte-pregexp: byte-pregexp] + [define-regexp: define-regexp] + [define-pregexp: define-pregexp] + [define-byte-regexp: define-byte-regexp] + [define-byte-pregexp: define-byte-pregexp])) From b57d3c1b68858b2bfeba6c80d5c318412731fb55 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 16 Dec 2015 03:26:25 -0500 Subject: [PATCH 4/6] [scribblings] note: no-colon --- scribblings/trivial.scrbl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scribblings/trivial.scrbl b/scribblings/trivial.scrbl index 10f7773..7fe9e18 100644 --- a/scribblings/trivial.scrbl +++ b/scribblings/trivial.scrbl @@ -10,7 +10,10 @@ @(define trivial-eval (make-base-eval #:lang 'typed/racket/base '(begin (require trivial)))) This library exports a collection of @hyperlink["http://www.greghendershott.com/fear-of-macros/"]{macros} that implement statically-checked interfaces to standard library functions. -All exported macros are named with a trailing colon (meant as a hint that some extra type-checking may happen at the call site). +All exported macros are named with a trailing colon (meant as a hint that some extra type-checking may happen at the call site).@note{ + Not a fan of the colon convention? @racket[trivial/no-colon] provides the same identifiers, colon-free. + Same goes for each sub-collection, for instance you can require @racket[trivial/math/no-colon]. +} @emph{Hidden Agenda:} From e91b79481e71c1f3f4a12a7aef5c688a48272a09 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 16 Dec 2015 03:26:47 -0500 Subject: [PATCH 5/6] [scribblings] de-bold the title, for Leif <3 --- scribblings/trivial.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scribblings/trivial.scrbl b/scribblings/trivial.scrbl index 7fe9e18..bf460e7 100644 --- a/scribblings/trivial.scrbl +++ b/scribblings/trivial.scrbl @@ -3,7 +3,7 @@ @require[scribble/eval] @require[scriblib/footnote] -@title[#:tag "top"]{@bold{Trivial: Solving the easiest type-checking problems}} +@title[#:tag "top"]{Trivial: Solving the easiest type-checking problems} @author[@hyperlink["https://github.com/bennn"]{Ben Greenman}] @defmodule[trivial] From 8a797f016dff8d634a6815f9b704bae29e55563b Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 16 Dec 2015 03:31:22 -0500 Subject: [PATCH 6/6] [scribblings] bad group example --- regexp.rkt | 2 +- scribblings/trivial.scrbl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/regexp.rkt b/regexp.rkt index 1d585b7..5eda021 100644 --- a/regexp.rkt +++ b/regexp.rkt @@ -106,7 +106,7 @@ (define-for-syntax (group-error str reason) (raise-argument-error errloc-key - (format "Valid regexp pattern (contains unmatched ~a)" reason) + (format "Valid regexp pattern (unmatched ~a)" reason) str)) ;; Dispatch for counting groups diff --git a/scribblings/trivial.scrbl b/scribblings/trivial.scrbl index bf460e7..333b5e4 100644 --- a/scribblings/trivial.scrbl +++ b/scribblings/trivial.scrbl @@ -70,6 +70,7 @@ In other words, the result is one string for the matched substring and an unknow (U #f (List String String))) (ann (regexp-match: #"(la(m*)bda)" #"lam") (U #f (List Bytes Bytes Bytes))) + (regexp-match: "(bad))group" "") ] @emph{Note:} the regular expression @racket{|} operator is not currently supported because it can nullify some groups.