Live data from Hacker News

Algebraic Effects for the Rest of Us

overreacted.io

61–70 of 91 posts

Re: Algebraic Effects for the Rest of Us

#61
post #38
post #33

(2019) It’s worth clarifying that for the most part, this article just discusses plain effects, ie. "reified side effects" or "resumable exceptions". Algebraic effects are about the composition (ie. algebra) of effects, exactly like algebraic data types are about the composition of types. This part is generally not meaningful in an untyped language like Javascript because effects are all YOLO and you never know what’…

I've never understood what's meant by "algebraic" in that sense, or what this algebra of combining effect is. Could you say more, or maybe share a link to a useful reference?

This is my favorite one, short and understandable: https://philipnilsson.github.io/Badness10k/posts/2017-05-07-...

I show it when I teach Haskell, and it's what usually makes it "click" for students. Probably because motivating examples are in normal imperative pseudocode.

Re: Algebraic Effects for the Rest of Us

#62
post #38
post #33

(2019) It’s worth clarifying that for the most part, this article just discusses plain effects, ie. "reified side effects" or "resumable exceptions". Algebraic effects are about the composition (ie. algebra) of effects, exactly like algebraic data types are about the composition of types. This part is generally not meaningful in an untyped language like Javascript because effects are all YOLO and you never know what’…

I've never understood what's meant by "algebraic" in that sense, or what this algebra of combining effect is. Could you say more, or maybe share a link to a useful reference?

I'm no expert, but perhaps https://arxiv.org/abs/2302.01415 (especially section 2.2, "Non-Algebraic Effects") will help.

Re: Algebraic Effects for the Rest of Us

#63
post #47

Earlier quoted context omitted.

CL conditions do what you actually need if you program. CL gives you deterministic state, safe resource management etc. Nondeterminism is not a feature you want. Algebraic effects treat the execution stack (continuation) as data, you have total freedom over what you do with it. This flexibility is exactly where you get nondeterminism. This is how logic solvers or probabilistic algorithms work, but you don't want it a…

It’s pretty annoying to comment “this thing was already present in CL 30 years ago”, then to have someone correct you (pointing out that this is a common misconception, and algebraic effects are not equivalent to conditions at all), and then to respond not to admit you’re wrong but instead to say “algebraic effects are bad anyway because you shouldn’t want one of the extra features they give you (nondeterminism)”. By…

Standard usable feature. Features must work with everything else in the language.

I like programming language theory as much as anyone else, but there is a reason some language features exist only so that people can blog and think about them.

Re: Algebraic Effects for the Rest of Us

#64
post #61
post #38

Earlier quoted context omitted.

I've never understood what's meant by "algebraic" in that sense, or what this algebra of combining effect is. Could you say more, or maybe share a link to a useful reference?

This is my favorite one, short and understandable: https://philipnilsson.github.io/Badness10k/posts/2017-05-07-... I show it when I teach Haskell, and it's what usually makes it "click" for students. Probably because motivating examples are in normal imperative pseudocode.

Thanks, I definitely feel like I understand monads and their benefits, and even "effects", but I'm not sure what's "algebraic" in "algebraic effects".

Re: Algebraic Effects for the Rest of Us

#65
post #38

Earlier quoted context omitted.

I've never understood what's meant by "algebraic" in that sense, or what this algebra of combining effect is. Could you say more, or maybe share a link to a useful reference?

I'm no expert, but perhaps https://arxiv.org/abs/2302.01415 (especially section 2.2, "Non-Algebraic Effects") will help.

Thanks. It says

> Algebraic effects & handlers use a free monad and an interpreter to separate the syntax of effects from their semantics

I'm pretty sure not everybody who works with algebraic effects would say they have to be based on a free monad, so I'm skeptical how definitive this definition is.

Re: Algebraic Effects for the Rest of Us

#67
post #61
post #38

Earlier quoted context omitted.

I've never understood what's meant by "algebraic" in that sense, or what this algebra of combining effect is. Could you say more, or maybe share a link to a useful reference?

This is my favorite one, short and understandable: https://philipnilsson.github.io/Badness10k/posts/2017-05-07-... I show it when I teach Haskell, and it's what usually makes it "click" for students. Probably because motivating examples are in normal imperative pseudocode.

Your linked article hints at the advantages of using Monads and therefor ADTs (Algebraic Data Types), and does it really well.

The wiki entry on effect systems[0] tells me that a focus of an effect system is something different from a focus of monads. "The term algebraic effect follows from the type system", where an effect system is effectively a type and effect system. It links to Monadic encapsulation of effects[1] and mentions the runST monad when it mentions support in Haskell, as that one seem to "simulate a type and effect system".

Do have any such a link on the runTS monad?

[0]: https://en.wikipedia.org/wiki/Effect_system

[1]: https://www.cambridge.org/core/journals/journal-of-functiona...

Re: Algebraic Effects for the Rest of Us

#68
Good article! I've been struggling to grasp what these new "effects" were.

When I had been in university twenty years ago, I had constructed a language with "effects" as I had understood them then: side-effects annotations. I could not in my head recognise how the new effects were like those I had read about in the literature back then.

More recently, I've been working on a compiler back-end/runtime in my (too much) free time with support for resumable exceptions. I didn't know it before, but after reading this article, it appears that the runtime actually does have support for "effects", without me really trying.

Post reply on HN