Why Subject is generic type? #3881
-
I'm not completely understand why https://github.com/gleam-lang/erlang/blob/main/src/gleam/erlang/process.gleam#L64 What is the For example, in this example |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It's called a phantom type. Even though a value of that type isn't stored in the value itself, it determines what kind of values should be used in combination with it. I would recommend reading Hayleigh's blog post on phantom types. |
Beta Was this translation helpful? Give feedback.
That's it!
If it didn't have a type parameter there would be no way for the subject to specify what type of message it accepts.