3 ms·
It's not quite the same. You can emulate literal string types using recursive ADTs (similar lists), storing one character at the time at the typesystem. But th
by valenterry 4y ago
It's not quite the same. You can emulate literal string types using recursive ADTs (similar lists), storing one character at the time at the typesystem.
But the ergonomics are quite different.
For example, in Scala you can do this:
val foo: "Must be this string" = "foo" // fails to compile
In Typescript it's similar. But how would "Must be this string" look in the case of a haskell ADT?