IIUC, this is what Alex Knauth did in
https://github.com/mbutterick/txexpr/pull/8.

On Mon, Dec 30, 2019 at 7:07 PM Jack Firth <jackhfi...@gmail.com> wrote:

> If I'm making my own data types, one common thing I want to do is make
> smart constructors that double as match expanders. I could use
> `define-match-expander` with two transformers, but then I can't add a
> contract to the smart constructor with `contract-out`. If I try to write
> this:
>
> (provide
>  (contract-out
>   [foo (->* (widget?) (#:name symbol?) foo?)]))
>
> (define (make-foo widget #:name [name #f])
>   ...)
>
> (define-match-expander foo
>   (syntax-parser [(_ widget) #'(? foo? (app foo-widget widget))])
>   (syntax-parser [(_ arg ...) #'(make-foo arg ...)]))
>
> ...then the use of `contract-out` hides the fact that `foo` is a match
> expander. What should I do?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/2dac85e9-8058-437c-b5bc-a92f659c02f6%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/2dac85e9-8058-437c-b5bc-a92f659c02f6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegvhNMz85CQOtXMHQjyQTym7xS9huNVikJVoXXVYhsS0AQ%40mail.gmail.com.

Reply via email to