←back to thread

97 points appliku | 3 comments | | HN request time: 0.303s | source
1. mrkeen ◴[] No.45158442[source]
> Solving the “what color is your function” problem.

Eh. I currently use monads for my effects, and am open to the idea of language-based effects.

But this isn't a solution to the colour problem - it is the colour problem. The compiler stops you accidentally calling red from blue. If you want to do it deliberately, you change the caller from blue to red.

replies(2): >>45158745 #>>45161717 #
2. epolanski ◴[] No.45158745[source]
This depends on the implementation. In effect typescript land, synchronous and asynchronous code is treated equally as soon as it's lifted in an effect.
3. gf000 ◴[] No.45161717[source]
One important thing that languages with algebraic types can usually do and most others can't is being generic in this "colorness" - precisely because this is the color problem they are solving.

So they can e.g. have a `map` function that can take a pure lambda, or an effectful one, and based on that itself will become pure or the given effect. Colors will stop being "infectious" without limits, you can now better barrier their reach.