dedbox/racket-algebraic

Question: Typed algebraic Racket

shabesoglu opened this issue · 2 comments

I am new to Racket and still learning. I was wondering if it is possible to add algebraic types to typed Racket? Is there a plan to do so?

Hi, and thanks for the question! I'm not sure what exactly you're asking, so I'll do my best to break down what I think you're asking. Feel free to re-orient the discussion around your original question if I got it wrong.

If you're wondering how, in general, one might go about extending Typed Racket - i.e., #lang typed/racket or #lang typed/racket/base - with algebraic data types (ADTs), I believe this is an open discussion among people who regularly use or work on Typed Racket.

Algebraic Racket and Typed Racket are two dialects of Racket with very different design priorities. Most notably, Typed Racket is billed as "a gradually-typed sister language" of Racket, whereas Algebraic Racket tries to support type-directed features while remaining type-system agnostic.

Although importing Algebraic Racket's base ADT functionality into Typed Racket is possible and might even be straight forward (I'm unaware of the particulars here), ADTs aren't very useful if functions don't know how to automatically de-construct them to get at their fields. Moreover, I'm not yet sure what it would take to support Typed Racket's more interesting type-directed functionality like determining whether a function handle all possible instances of an algebraic data type.

With regard to the general future of Typed Racket, I can't really say anything because I'm not involved with its development. You might have better luck cross-posing this question on the racket-users mailing list - the author of Typed Racket and his students are very active there.

Regarding the future of type checking in Algebraic Racket, the next major-version release (v2.0) will add a generic framework for compile-time type checking and code generation (see #85 and #86 for a preview), at which point extending Typed Racket by importing Algebraic Racket features may become feasible.

Thank you for the response, and it makes sense. I will dig more into this.