Did Racket become a better Haskell while I wasn't looking? What's the catch? Those look like some powerful type system features.
Did Racket become a better Haskell while I wasn't looking? What's the catch? Those look like some powerful type system features.
I have stopped using for-loops for complex things, since they expand to something that makes life hard for the type checker.
With ML I never have the feeling that I am fighting the type checker, but with typed racket I have more problems than I'd like to admit.
I am however no programmer and have no background in CS or even maths, and there are people that write a lot of code in typed racket.
And last time I tried typed racket I had some weird slow downs when specifying types less generally (like: integer instead of real, positive-integer instead of integer).
There is a bit of non-trivial code written in typed racket, and that is probably a good complementary reading to the typed racket guide.
This is probably not your fault.
Scheme (from which Racket descends) has a very intricate numeric hierarchy. Typed Racket models the numeric hierarchy very accurately, and the technique they use to do this (intersection types) has bad worst-case complexity -- you can encode arbitrary SAT problems in it pretty easily. So the numeric types are actually aliases for quite complicated formulae, and this can tip you over into bad cases for inference. Writing a more specific type gives you a smaller formula, which makes typechecking faster.
In a clean-slate design, you would set things up to minimize the use of intersection types, but to get smooth access to the pre-existing Racket ecosystem, this is a price you have to pay.
(Warning: my information is a few years old. Racket's type system could have changed in the meantime.)
But the big one compared to Haskell is:
> Typed Racket will type-check all expressions at the run-time phase of the given module and will prevent errors that would occur at run-time. However, expressions at compile-time—including computations that occur inside macros—are not checked.
What makes you see this as a caveat relative to Haskell? I can't imagine most Racket users typically deal with macros at such a low level; don't Schemers tend to use syntax-rules?
And usually, you don't need to care if what you're calling is a macro or a procedure. Now you do.
Sort of, but the expansion of any macros is still type-checked.
https://lexi-lambda.github.io/blog/2017/05/27/realizing-hack...
> Typed Racket is Racket’s gradually-typed sister language which allows the incremental addition of statically-checked type annotations. https://docs.racket-lang.org/ts-guide/
> One of the key features of Typed Racket is that it allows the combination of both typed and untyped code in a single program. https://docs.racket-lang.org/ts-guide/typed-untyped-interact...
Typed Racket offers parametric polymorphism, the Typed Racket guide shows how to implement Haskell's Maybe type as their first example. It still handles lexical scope and variable arity, as well.
Lastly, Typed Racket is hardly a "bolt-on" type system. It's a language with it's own parser and lexer. It just happens to be capable of interacting with every language also running on the Racket backend. That's like calling GHC a bolt-on, because it's part of GCC.
Eh? AFAIK, GHC has absolutely nothing to do with GCC.
Certainly, it was just nitpicking, regardless.
[1] https://downloads.haskell.org/~ghc/7.8.3/docs/html/users_gui...
> Typed Racket is Racket’s gradually-typed sister language which allows the incremental addition of statically-checked type annotations. https://docs.racket-lang.org/ts-guide/index.html
> This package provides optimization coaching support to help you get the most of the Racket and Typed Racket optimizers. https://docs.racket-lang.org/optimization-coach/index.html