# \#typed-racket

**URL:** https://racket.discourse.group/tag/typed-racket/16.md

[Latest](https://racket.discourse.group/latest.md) · [Categories](https://racket.discourse.group/categories.md) · [Tags](https://racket.discourse.group/tags.md)

---

## [Any chance at more abstraction with \`Values\` type?](https://racket.discourse.group/t/any-chance-at-more-abstraction-with-values-type/4057)

<div class="topic-metadata">

**Author:** [@wilbowma](https://racket.discourse.group/u/wilbowma)\
**Replies:** 9\
**Last updated:** [January 5, 2026, 4:55pm UTC](https://racket.discourse.group/t/any-chance-at-more-abstraction-with-values-type/4057 "2026-01-05T16:55:54Z")

</div>

I was writing a little library that uses multiple return values, and decided to port it to Typed Racket as some of the invariants were getting fiddly. However, due to limitations in the Values, I can't type the pattern I…

---

## [How to achieve zero-overhead type dispatch in macros (similar to C++ templates)?](https://racket.discourse.group/t/how-to-achieve-zero-overhead-type-dispatch-in-macros-similar-to-c-templates/4070)

<div class="topic-metadata">

**Author:** [@litjohn](https://racket.discourse.group/u/litjohn)\
**Replies:** 8\
**Last updated:** [January 1, 2026, 7:27pm UTC](https://racket.discourse.group/t/how-to-achieve-zero-overhead-type-dispatch-in-macros-similar-to-c-templates/4070 "2026-01-01T19:27:44Z")

</div>

Hi everyone! This is my first post here. I've been exploring Racket macros and have a question regarding performance and types. Is there a way in Racket to achieve zero-overhead type dispatch similar to C++ templates? …

---

## [What's the idiomatic way of using untyped collections/data structures in typed code?](https://racket.discourse.group/t/whats-the-idiomatic-way-of-using-untyped-collections-data-structures-in-typed-code/3958)

<div class="topic-metadata">

**Author:** [@ohqo](https://racket.discourse.group/u/ohqo)\
**Replies:** 7\
**Last updated:** [September 27, 2025, 5:53pm UTC](https://racket.discourse.group/t/whats-the-idiomatic-way-of-using-untyped-collections-data-structures-in-typed-code/3958 "2025-09-27T17:53:56Z")

</div>

The data-lib library has many useful data structures that are missing from the typed racket standard library. Following the documentation on interacting with untyped code, I was able to use the #:opaque type to import th…

---

## [Is rackunit not supposed to work with typed Racket?](https://racket.discourse.group/t/is-rackunit-not-supposed-to-work-with-typed-racket/3836)

<div class="topic-metadata">

**Author:** [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Replies:** 2\
**Last updated:** [July 5, 2025, 1:48am UTC](https://racket.discourse.group/t/is-rackunit-not-supposed-to-work-with-typed-racket/3836 "2025-07-05T01:48:38Z")

</div>

I tried using rackunit with typed/racket: #lang typed/racket (require rackunit) (module+ test (check-true #t) ) I was granted the following obscure error message: ../../usr/local/racket/share/pkgs/rackunit-lib…

---

## [Default non-keyword paraeters in type Racket](https://racket.discourse.group/t/default-non-keyword-paraeters-in-type-racket/3833)

<div class="topic-metadata">

**Author:** [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Replies:** 1\
**Last updated:** [July 4, 2025, 9:14am UTC](https://racket.discourse.group/t/default-non-keyword-paraeters-in-type-racket/3833 "2025-07-04T09:14:21Z")

</div>

How do you do an optional function parameter in Typed Racket? I want the paraneter NOT to be keyword parameter. I'm used to writing things like (define (foo a \[b d\]) ( ... and when i ask for the value of b, and I'v…

---

## [Getting started with typed Racket and path-related types](https://racket.discourse.group/t/getting-started-with-typed-racket-and-path-related-types/3804)

<div class="topic-metadata">

**Author:** [@ddrake](https://racket.discourse.group/u/ddrake)\
**Replies:** 11\
**Last updated:** [June 24, 2025, 9:33pm UTC](https://racket.discourse.group/t/getting-started-with-typed-racket-and-path-related-types/3804 "2025-06-24T21:33:59Z")

</div>

I'm having trouble with typed Racket. I have code that works perfectly as "#lang racket", but when I swap that to typed/racket, I get a couple errors, and I haven't been able to convince the typechecker that things will …

---

## [What're Differences Between \`typed/racket/unsafe\` and \`typed/racket/optional\`?](https://racket.discourse.group/t/whatre-differences-between-typed-racket-unsafe-and-typed-racket-optional/3746)

<div class="topic-metadata">

**Author:** [@NoahStoryM](https://racket.discourse.group/u/NoahStoryM)\
**Replies:** 1\
**Last updated:** [May 16, 2025, 12:50pm UTC](https://racket.discourse.group/t/whatre-differences-between-typed-racket-unsafe-and-typed-racket-optional/3746 "2025-05-16T12:50:39Z")

</div>

I'm writing a module that adds types to identifiers imported from untyped code, and I want to avoid contract generation. I see two approaches: Using typed/racket/unsafe: (require typed/racket/unsafe) Using typed/rack…

---

## [Can Typed Racket Treat Types as Runtime Values?](https://racket.discourse.group/t/can-typed-racket-treat-types-as-runtime-values/3696)

<div class="topic-metadata">

**Author:** [@NoahStoryM](https://racket.discourse.group/u/NoahStoryM)\
**Replies:** 0\
**Last updated:** [April 20, 2025, 4:34am UTC](https://racket.discourse.group/t/can-typed-racket-treat-types-as-runtime-values/3696 "2025-04-20T04:34:05Z")

</div>

I want to refine types without relying on predicates, so I attempted to implement ⊔, ann\* and type-case. Here are usage examples of these operators: (: flexible-length (→ (⊔ String (Listof Any)) Index)) (define (flexibl…

---

## [Working Through Exercises in HtDP 2nd Edition](https://racket.discourse.group/t/working-through-exercises-in-htdp-2nd-edition/3522)

<div class="topic-metadata">

**Author:** [@OldDutchCap](https://racket.discourse.group/u/OldDutchCap)\
**Replies:** 11\
**Last updated:** [February 13, 2025, 9:15pm UTC](https://racket.discourse.group/t/working-through-exercises-in-htdp-2nd-edition/3522 "2025-02-13T21:15:03Z")

</div>

Not that I think this is anything particularly noteworthy or special but I've been working through the exercises in HtDP 2nd Edition and posting my answers up to my blog lately. I decided to try to do the exercises with…

---

## [Typed Struct Property: Problem with prop:custom-write](https://racket.discourse.group/t/typed-struct-property-problem-with-prop-custom-write/3419)

<div class="topic-metadata">

**Author:** [@wurmli](https://racket.discourse.group/u/wurmli)\
**Replies:** 6\
**Last updated:** [December 16, 2024, 12:01pm UTC](https://racket.discourse.group/t/typed-struct-property-problem-with-prop-custom-write/3419 "2024-12-16T12:01:38Z")

</div>

This is probably a question for Suzanne Soy. I tried her struct type properties, but the result is not exactly what I expected. #lang typed/racket (: display-point (-\> Point Output-Port (U #t #f 0 1) Any)) (define (di…

---

## [Converting Struct to JSON](https://racket.discourse.group/t/converting-struct-to-json/3399)

<div class="topic-metadata">

**Author:** [@BenRaz123](https://racket.discourse.group/u/BenRaz123)\
**Replies:** 2\
**Last updated:** [December 6, 2024, 7:09pm UTC](https://racket.discourse.group/t/converting-struct-to-json/3399 "2024-12-06T19:09:01Z")

</div>

Hello, and thanks for answering my beginner question! If I have this struct in typed racket: #lang typed/racket (struct Person (\[name : String\] \[age : Number\] \[gender : Boolean\])) What's the easiest method of converti…

---

## [A new way to type mutable data structures with opposite variance in typed racket](https://racket.discourse.group/t/a-new-way-to-type-mutable-data-structures-with-opposite-variance-in-typed-racket/1846)

<div class="topic-metadata">

**Author:** [@NoahStoryM](https://racket.discourse.group/u/NoahStoryM)\
**Replies:** 16\
**Last updated:** [November 29, 2024, 2:03am UTC](https://racket.discourse.group/t/a-new-way-to-type-mutable-data-structures-with-opposite-variance-in-typed-racket/1846 "2024-11-29T02:03:52Z")

</div>

Hi everyone, I have been experimenting with a way to define types with opposite variance in typed racket (see also Is it possible to make Mutable Types support subtype? · racket/typed-racket · Discussion #1129 · GitHub)…

---

## [How to Require Macros from Untyped Racket in Typed Racket with Dependencies on Typed Imports?](https://racket.discourse.group/t/how-to-require-macros-from-untyped-racket-in-typed-racket-with-dependencies-on-typed-imports/3349)

<div class="topic-metadata">

**Author:** [@NoahStoryM](https://racket.discourse.group/u/NoahStoryM)\
**Replies:** 1\
**Last updated:** [November 25, 2024, 6:13pm UTC](https://racket.discourse.group/t/how-to-require-macros-from-untyped-racket-in-typed-racket-with-dependencies-on-typed-imports/3349 "2024-11-25T18:13:58Z")

</div>

How to Require Macros from Untyped Racket in Typed Racket with Dependencies on Typed Imports? I'm facing an issue when trying to require a macro defined in an untyped Racket module into a Typed Racket module. The macro …

---

## [Trouble with Typed Racket? Try Contract Profile! by Nathaniel Hejduk at the (fourteenth RacketCon) is now available](https://racket.discourse.group/t/trouble-with-typed-racket-try-contract-profile-by-nathaniel-hejduk-at-the-fourteenth-racketcon-is-now-available/3259)

<div class="topic-metadata">

**Author:** [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Replies:** 0\
**Last updated:** [October 28, 2024, 7:00pm UTC](https://racket.discourse.group/t/trouble-with-typed-racket-try-contract-profile-by-nathaniel-hejduk-at-the-fourteenth-racketcon-is-now-available/3259 "2024-10-28T19:00:32Z")

</div>

Trouble with Typed Racket? Try Contract Profile! by Nathaniel Hejduk at the (fourteenth RacketCon) is now available at https://youtu.be/FeDVjomZgmE -- (fourteenth RacketCon) playlist

---

## [Predicate Inconsistency in with List, Listof in Polymorphic Functions](https://racket.discourse.group/t/predicate-inconsistency-in-with-list-listof-in-polymorphic-functions/3187)

<div class="topic-metadata">

**Author:** [@wolfraam](https://racket.discourse.group/u/wolfraam)\
**Replies:** 3\
**Last updated:** [September 28, 2024, 11:50pm UTC](https://racket.discourse.group/t/predicate-inconsistency-in-with-list-listof-in-polymorphic-functions/3187 "2024-09-28T23:50:04Z")

</div>

Hello, If I define a function taking a heterogeneous list (List A ... A) and try to coerce the argument to a pair with (assert lst pair?) or an unless guard, the program typechecks, but the assertion fails even when I p…

---

## [For/sum in typed/racket](https://racket.discourse.group/t/for-sum-in-typed-racket/3166)

<div class="topic-metadata">

**Author:** [@ken](https://racket.discourse.group/u/ken)\
**Replies:** 10\
**Last updated:** [September 17, 2024, 6:40pm UTC](https://racket.discourse.group/t/for-sum-in-typed-racket/3166 "2024-09-17T18:40:25Z")

</div>

I'm experimenting with typed/racket to see if it can speed up some lengthy numerical calculations. As a first step, I tried to sum all the square roots up to a million, first in plain Racket: (for/sum (\[i 1000000\]) (…

---

## [Suggestions on refactoring codes using Typed Racket](https://racket.discourse.group/t/suggestions-on-refactoring-codes-using-typed-racket/2941)

<div class="topic-metadata">

**Author:** [@Antigen-11](https://racket.discourse.group/u/Antigen-11)\
**Replies:** 11\
**Last updated:** [June 8, 2024, 4:30pm UTC](https://racket.discourse.group/t/suggestions-on-refactoring-codes-using-typed-racket/2941 "2024-06-08T16:30:50Z")

</div>

Hello everyone! Recently, there has been widespread discussion in the community about the performance of the Racket language. It applies to a benchmarks game and I find it interesting to solve those problems about DNA b…

---

## [Typeless typed Racket](https://racket.discourse.group/t/typeless-typed-racket/2944)

<div class="topic-metadata">

**Author:** [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Replies:** 1\
**Last updated:** [June 2, 2024, 4:37pm UTC](https://racket.discourse.group/t/typeless-typed-racket/2944 "2024-06-02T16:37:51Z")

</div>

The languages typed/racket/no-check and typed/racket/base/no-check -- Do they supress all type checking? Or do they just suppress static type checking?

---

## [Typed Racket + Org-mode + Org tables and lists](https://racket.discourse.group/t/typed-racket-org-mode-org-tables-and-lists/2254)

<div class="topic-metadata">

**Author:** [@scolobb](https://racket.discourse.group/u/scolobb)\
**Replies:** 4\
**Last updated:** [May 29, 2024, 10:34am UTC](https://racket.discourse.group/t/typed-racket-org-mode-org-tables-and-lists/2254 "2024-05-29T10:34:23Z")

</div>

Hi, I would like to use Typed Racket in Org-mode code blocks with ob-racket-mode and produce Org lists and tables. (Untyped) Racket code works out of the box: #+BEGIN\_SRC racket :results table drawer '((a 1) (b 2)) #+…

---

## [Racket version 8.7 is now available](https://racket.discourse.group/t/racket-version-8-7-is-now-available/1478)

<div class="topic-metadata">

**Author:** [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Replies:** 9\
**Last updated:** [May 24, 2024, 7:44pm UTC](https://racket.discourse.group/t/racket-version-8-7-is-now-available/1478 "2024-05-24T19:44:27Z")

</div>

Racket version 8.7 is now available from https://download.racket-lang.org/ As of this release: Typed Racket offers Shallow and Optional modes for its gradual types. These modes lower the cost of interacting with un…

---

## [Parser combinator in Typed Racket: how to define the type constructor for the parser?](https://racket.discourse.group/t/parser-combinator-in-typed-racket-how-to-define-the-type-constructor-for-the-parser/2909)

<div class="topic-metadata">

**Author:** [@yossarian](https://racket.discourse.group/u/yossarian)\
**Replies:** 1\
**Last updated:** [May 7, 2024, 4:06pm UTC](https://racket.discourse.group/t/parser-combinator-in-typed-racket-how-to-define-the-type-constructor-for-the-parser/2909 "2024-05-07T16:06:35Z")

</div>

I am trying to translate the nice Haskell tutorial by Stephen Diehl on parser combinators in Typed Racket. However, I am already stuck when trying to define the parametric Parser type. Haskell: newtype Parser a = Parser…

---

## [Using formlets from/with typed/racket, formlet-process and typing](https://racket.discourse.group/t/using-formlets-from-with-typed-racket-formlet-process-and-typing/2834)

<div class="topic-metadata">

**Author:** [@gabre](https://racket.discourse.group/u/gabre)\
**Replies:** 2\
**Last updated:** [March 30, 2024, 6:10pm UTC](https://racket.discourse.group/t/using-formlets-from-with-typed-racket-formlet-process-and-typing/2834 "2024-03-30T18:10:04Z")

</div>

I am trying to use formlets from typed/racket. I have the following racket module: #lang racket (require web-server/formlets/syntax) (require web-server/formlets/input) (require "blog-core-model.rkt") (provide new-p…

---

## [Pattern matching 'Some' and 'None'](https://racket.discourse.group/t/pattern-matching-some-and-none/2819)

<div class="topic-metadata">

**Author:** [@mohanr](https://racket.discourse.group/u/mohanr)\
**Replies:** 3\
**Last updated:** [March 26, 2024, 5:28am UTC](https://racket.discourse.group/t/pattern-matching-some-and-none/2819 "2024-03-26T05:28:57Z")

</div>

Hi I am porting SML to Racket. Managed to create a recursive data type like this. I reuse a macro by Alexis King for this. (define-datatype Expr ( BoolValue Boolean ) ( IntValue Number ) ( Op Expr (U Plus GTE…

---

## [Typed Racket guidelines](https://racket.discourse.group/t/typed-racket-guidelines/2805)

<div class="topic-metadata">

**Author:** [@Tyrn](https://racket.discourse.group/u/Tyrn)\
**Replies:** 9\
**Last updated:** [March 20, 2024, 8:34pm UTC](https://racket.discourse.group/t/typed-racket-guidelines/2805 "2024-03-20T20:34:09Z")

</div>

Hi, Frankly, the question should be "Typed Racket: is it safe to use?". I sensibly asked the similar question about the Lazy Racket, and the unanimous answer was "forget it". Well, not exactly, but unless the general la…

---

## [Zero-cost incompatible opaque types](https://racket.discourse.group/t/zero-cost-incompatible-opaque-types/2772)

<div class="topic-metadata">

**Author:** [@default.kramer](https://racket.discourse.group/u/default.kramer)\
**Replies:** 0\
**Last updated:** [March 9, 2024, 8:51pm UTC](https://racket.discourse.group/t/zero-cost-incompatible-opaque-types/2772 "2024-03-09T20:51:20Z")

</div>

Something I always wanted in Typed Racket was a way to create incompatible types which are actually the same underlying type. The idea is that maybe your application has a UserId type and a VendorId type which are both I…

---

## [Coerce #f and pointer in typed racket](https://racket.discourse.group/t/coerce-f-and-pointer-in-typed-racket/2580)

<div class="topic-metadata">

**Author:** [@mode89](https://racket.discourse.group/u/mode89)\
**Replies:** 4\
**Last updated:** [December 10, 2023, 3:19am UTC](https://racket.discourse.group/t/coerce-f-and-pointer-in-typed-racket/2580 "2023-12-10T03:19:50Z")

</div>

There is a function glfwCreateWindow. The last two arguments of this function are of type \_pointer. How to properly import and annotate this function in typed/racket? Here is what I'm doing right now: (require/typed ff…

---

## [How to use union types?](https://racket.discourse.group/t/how-to-use-union-types/2537)

<div class="topic-metadata">

**Author:** [@Kalimehtar](https://racket.discourse.group/u/Kalimehtar)\
**Replies:** 5\
**Last updated:** [November 26, 2023, 6:00pm UTC](https://racket.discourse.group/t/how-to-use-union-types/2537 "2023-11-26T18:00:19Z")

</div>

If I try (: foo (-\> (U Positive-Exact-Rational Negative-Exact-Rational) Positive-Exact-Rational (U Positive-Exact-Rational Negative-Exact-Rational))) (define (foo a b) (\* a b)) I get type mismatch. But both …

---

## [Typed racket identifier in Refined type (or define type to length of vector)](https://racket.discourse.group/t/typed-racket-identifier-in-refined-type-or-define-type-to-length-of-vector/2533)

<div class="topic-metadata">

**Author:** [@Hazematman](https://racket.discourse.group/u/Hazematman)\
**Replies:** 1\
**Last updated:** [November 26, 2023, 1:16am UTC](https://racket.discourse.group/t/typed-racket-identifier-in-refined-type-or-define-type-to-length-of-vector/2533 "2023-11-26T01:16:11Z")

</div>

Hello, I'm trying to figure out a way I can use an identifier in a refined type. If this is not possible my end goal is to have a the range of an integer be restricted by some identifier that I can use else where in my …

---

## [Typed web-server](https://racket.discourse.group/t/typed-web-server/2321)

<div class="topic-metadata">

**Author:** [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Replies:** 7\
**Last updated:** [November 7, 2023, 11:04pm UTC](https://racket.discourse.group/t/typed-web-server/2321 "2023-11-07T23:04:01Z")

</div>

Is there a typed Racket version of all the Racket web-server stuff?

---

## [How to match up macro-generated and user-defined identifiers?](https://racket.discourse.group/t/how-to-match-up-macro-generated-and-user-defined-identifiers/2379)

<div class="topic-metadata">

**Author:** [@pcn](https://racket.discourse.group/u/pcn)\
**Replies:** 2\
**Last updated:** [October 13, 2023, 4:11am UTC](https://racket.discourse.group/t/how-to-match-up-macro-generated-and-user-defined-identifiers/2379 "2023-10-13T04:11:19Z")

</div>

The question is likely very basic. I'm just rusty :grin: I'm trying to implement poor man's module that can be parameterized by types, using structs. An example is I can do something like: (define-signature (expr E) …

[Next page](https://racket.discourse.group/tag/typed-racket/16.md?match_all_tags=true&page=1&tags%5B%5D=typed-racket)
