frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Show HN: Lib for real-time agent with streaming support via SSE and RabbitMQ

https://github.com/Cognitive-Stack/mcphub
1•hieutrtr•1m ago•0 comments

Cows get GPS collars to stop them falling in river

https://www.bbc.co.uk/news/articles/cj4229k744lo
1•zeristor•1m ago•1 comments

Show HN: Prototyping with AI as a Product Manager

https://substack.com/home/post/p-164292119
1•manas95•1m ago•0 comments

Just Raised 14M in Grants for a New Blockchain Powered AI Napkin System

https://twitter.com/pumpopoly/status/1918537047746150878
1•palmfacehn•2m ago•0 comments

Switzerland's Responsible Gun Culture (2019) [video]

https://www.youtube.com/watch?v=jgYJ5V2HYy4
1•hubraumhugo•4m ago•0 comments

Claude 4: behavior directly inspired by our Alignment Faking paper

https://www-cdn.anthropic.com/4263b940cabb546aa0e3283f35b686f4f3b2ff47.pdf#page=34
1•beeflet•11m ago•0 comments

Are Human Reasoning Abilities Declining?

https://dailynous.com/2025/04/28/are-human-reasoning-abilities-declining/
2•jruohonen•15m ago•0 comments

How the Non-Essential Spleen Could Regenerate Vital Organs Inside the Body

https://www.discovermagazine.com/health/how-the-non-essential-spleen-could-regenerate-vital-organs-inside-the-body
2•jnord•17m ago•0 comments

Only one country in the world produces all the food it needs

https://www.sciencefocus.com/news/only-one-country-produces-food-it-needs-self-sufficient
3•jnord•20m ago•0 comments

Lidar Can Permanently Damage Your Phone's Camera

https://www.jalopnik.com/1866994/lidar-permanently-damage-phone-camera/
3•jnord•22m ago•0 comments

The False Idol of Sun Worship – Weatherman as Pagan Priest (2023)

https://shagbark.substack.com/p/the-false-idol-of-sun-worship
1•fittingopposite•25m ago•0 comments

I No Longer Recommend RAG for Autonomous Coding Agents

https://pashpashpash.substack.com/p/why-i-no-longer-recommend-rag-for
1•bschne•30m ago•0 comments

AI models decide on increasingly complex trolley problems

https://www.youtube.com/watch?v=1boxiCcpZ-w
1•erikig•31m ago•1 comments

Who Hates AI and Why?

https://deadsimpletech.com/blog/who_hates_ai
1•vishnumohandas•40m ago•0 comments

Would You Use an AI Tool to Generate Twitter Threads and Rephrase Tweets?

https://www.indiehackers.com/post/would-you-use-an-ai-tool-to-generate-twitter-threads-and-rephrase-tweets-help-me-validate-this-idea-8631ce0088
1•iamsurajj•44m ago•0 comments

Show HN: VPN or Private tab doesn't stop trackers, Anonymous Links does

https://chromewebstore.google.com/detail/anonymous-links-by-webfus/lcdiefigibagiaeegdcalbpflndpeikc
1•tonysurfly•49m ago•0 comments

Show HN: Collaborative Web Annotation Tool

https://annotateweb.com/
1•tonysurfly•52m ago•0 comments

Show HN: Guantr - A Type-Safe JS/TS Authorization Library

https://github.com/Hrdtr/guantr
1•hrdtr•53m ago•0 comments

Iocraft: Declarative TUI/CLI Library for Rust, Inspired by React

https://github.com/ccbrown/iocraft
1•prettydope3932•1h ago•0 comments

Chesterton's Fence – Managing Complex Digital Products (and Australian Ecology)

https://www.cohezion.com.au/blog/chestertons-fence-managing-and-supporting-complex-digital-products
2•burlistic•1h ago•0 comments

Power MachTen: Unix as Classic Mac OS App

https://www.floodgap.com/retrotech/machten/
1•TMWNN•1h ago•1 comments

Show HN: Snappaster – take picture with webcam and put path in clipboard

https://github.com/steezeburger/snappaster
1•steezeburger•1h ago•1 comments

The Supreme Vice President of Technology and Other Tangential Operations

https://www.tobiokewole.com/writing/svptoto
1•flyingsky•1h ago•0 comments

What the failure of a superstar student reveals about economics

https://www.economist.com/finance-and-economics/2025/05/22/what-the-failure-of-a-superstar-student-reveals-about-economics
2•helsinkiandrew•1h ago•1 comments

Record/Replay Debugging Tutorial

https://github.com/sidkshatriya/me/blob/master/009-rr-on-aarch64.md
1•sidkshatriya•1h ago•1 comments

Welcome to the AI Trough of Disillusionment

https://www.economist.com/business/2025/05/21/welcome-to-the-ai-trough-of-disillusionment
2•helsinkiandrew•1h ago•2 comments

A Pregnancy Souvenir: Cells That Are Not Your Own (2015)

https://www.nytimes.com/2015/09/15/science/a-pregnancy-souvenir-cells-that-are-not-your-own.html
13•Tomte•1h ago•4 comments

Data visualization: A view of every Points of View column (2013)

https://blogs.nature.com/methagora/2013/07/data-visualization-points-of-view.html
1•Tomte•1h ago•0 comments

A boy who came back: the near-death, and changed life, of my son Max

https://www.theguardian.com/lifeandstyle/2025/may/24/the-boy-who-came-back-the-near-death-and-changed-life-of-my-son-max
8•ljf•1h ago•0 comments

Mobley vs. Workday Inc 2025 [pdf]

https://s3.documentcloud.org/documents/25947837/us-dis-cand-3-23cv770-d227363983e4833-order-by-judge-rita-f-lin-granting-106-preliminary.pdf
1•hunglee2•1h ago•0 comments
Open in hackernews

Why Algebraic Effects?

https://antelang.org/blog/why_effects/
128•jiggawatts•5h ago

Comments

charcircuit•5h ago
This doesn't give a focused explaination on why. I don't see how dependency injection is a benefit when languages without algebraic effects also have dependency injection. It doesn't explain if this dependency injections is faster to execute or compile or what.
yen223•4h ago
The way dependency injection is implemented in mainstream languages usually involves using metaprogramming to work around the language, not with the language. It's not uncommon to get errors in dependency-injected code that would be impossible to get with normal code.

It's interesting to see how things can work if the language itself was designed to support dependency injection from the get-go. Algebraic effects is one of the ways to achieve that.

vlovich123•4h ago
Don’t algebraic effects offer a compelling answer to the color problem and all sorts of related similar things?
threeseed•1h ago
But they also introduce their own color-like problems.

For example with Scala we have ZIO which is an effect system where you wrap all your code in their type e.g. getName(): ZIO[String]. And it doesn't matter if getName returns immediately or in the future which is nice.

But then the problem is that you can't use normal operators e.g. for/while/if-else you need to use their versions e.g. ZIO.if / ZIO.repeat.

So you don't have the colour problem because everything is their colour.

OtomotO•1h ago
But that's only a problem if it's a library and not done on the language level?!
threeseed•1h ago
But in the research languages listed they still are colouring function types.

So it doesn't seem to matter whether it's a library or in the language.

Either everything is an effect. Or you have to deal with two worlds of code: effects and non-effects.

charcircuit•3h ago
>It's interesting

Which is why I was asking for that interesting thing to be written in the article on why it would better.

cryptonector•1h ago
It's the same as with monads:

1) Testing. Write pure code with "effects" but, while in production the effects are real interactions with the real world, in testing they are mocked. This allows you to write pure code that does I/O, as opposed to writing pure code that doesn't do I/O and needs a procedural shell around it that does do the I/O -- you get to write tests for more of your code this way.

2) Sandboxing. Like in (1), but where your mock isn't a mock but a firewall that limits what the code can do.

(2) is a highly-desirable use-case. Think of it as a mitigation for supply-chain vulnerabilities. Think of log4j.

Both of these are doable with monads as it is. Effects can be more ergonomic. But they're also more dynamic, which complicates the implementations. Dynamic features are always more costly than static features.

charcircuit•28m ago
Again you are listing things that are possible but not explaining why it's better to do it via algebraic effects as opposed to the alternatives.

For example if you were in a meeting with Oracle to try and convince them to invest 100 million dollars for adding algebraic effects to Java and its ecosystem how would you convince them it would have a positive return on investment by providing value to developers.

For example, "Writing mocks for tests using algebraic effects is better than using jmock because ..."

cryptonector•3m ago
The only reason I can think of -but I'm not the right person to ask- is ergonomics, that in many cases it might be easier to push an effect handler than to build a whole monad or whatever. Elsewhere in this thread there's talk of effects solving the color problem.
cdaringe•5h ago
I did protohackers in ocaml 5 alpha a couple of years ago with effects. It was fun, but the toolchain was a lil clunky back then. This looks and feels very similar. Looking forward to seeing it progressing.
abathologist•3h ago
Effects in OCaml 5.3 are quite a bit cleaner than there were a few years back (tho still not typed).
AdieuToLogic•4h ago
> You can think of algebraic effects essentially as exceptions that you can resume.

How is this substantively different than using an ApplicativeError or MonadError[0] type class?

> You can “throw” an effect by calling the function, and the function you’re in must declare it can use that effect similar to checked exceptions ...

This would be the declared error type in one of the above type classes along with its `raiseError` method.

> And you can “catch” effects with a handle expression (think of these as try/catch expressions)

That is literally what these type classes provide, with a "handle expression" using `handleError` or `handleErrorWith` (depending on need).

> Algebraic effects1 (a.k.a. effect handlers) are a very useful up-and-coming feature that I personally think will see a huge surge in popularity in the programming languages of tomorrow.

Not only will "algebraic effects" have popularity "in the programming languages of tomorrow", they actually enjoy popularity in programming languages today.

https://typelevel.org/cats/typeclasses/applicativemonaderror...

anon-3988•4h ago
I don't really get it, but is this related to delimited continuation as well?
tempodox•4h ago
Yes, see for instance https://github.com/ocaml-multicore/ocaml-effects-tutorial.
cryptonector•1h ago
That's just an implementation detail. I don't think there's anything about effects that _requires_ delimited continuations to implement them.
cryptonector•4h ago
> How is this substantively different than using an ApplicativeError or MonadError[0] type class?

It think it's about static vs. dynamic behavior.

In monadic programming you have to implement all the relevant methods in your monad, but with effects you can dynamically install effects handlers wherever you need to override whatever the currently in-effect handler would be.

I could see the combination of the two systems being useful. For example you could use a bespoke IO-compatible monad for testing and sandboxing, and still have effects handlers below which.. can still only invoke your IO-like monad.

davery22•3h ago
Algebraic effects are in delimited continuation territory, operating on the program stack. No amount of monad shenanigans is going to allow you to immediately jump to an effect handler 5 levels up the call stack, update some local variables in that stack frame, and then jump back to execution at the same point 5 levels down.
grg0•3h ago
That sounds like a fucking nightmare to debug. Like goto, but you don't even need to name a label.
vkazanov•2h ago
Well, you test the fact that the handler receives the right kind of data, and then how it processes it.

And it is useful to be able to provide these handlers in tests.

Effects are AMAZING

cryptonector•1h ago
> Like goto, but you don't even need to name a label.

That's what exceptions are.

But effects don't cause you to see huge stack traces in errors because the whole point is that you provide the effect and values expected and the code goes on running.

abathologist•2h ago
It seems to me that monads and effects are likely best viewed as complementary approaches to reasoning about computational contexts, rather than as rivals. See, e.g., https://goto.ucsd.edu/~nvazou/koka/padl16.pdf or https://goto.ucsd.edu/~nvazou/koka/padl16.pdf .
threeseed•2h ago
> they actually enjoy popularity in programming languages today

They have enjoyed popularity amongst the Scala FP minority.

They are not broadly popular as they come with an unacceptable amount of downsides i.e. increased complexity, difficult to debug, harder to instantly reason about, uses far more resources etc. I have built many applications using them and the ROI simply isn't there.

It's why Odersky for example didn't just bundle it into the compiler and instead looked at how to achieve the same outcomes in a simpler and more direct way i.e. Gears, Capabilities.

wild_egg•4h ago
> You can think of algebraic effects essentially as exceptions that you can resume.

So conditions in Common Lisp? I do love the endless cycle of renaming old ideas

riffraff•3h ago
Also literal "resumable exceptions" in Smalltalk.
valcron1000•2h ago
No, algebraic effects are a generalization that support more cases than LISP's condition system since continuations are multi-shot. The closest thing is `call/cc` from Scheme.

Sometimes making these parallelism hurts more than not having them in the first place

ww520•1h ago
Also dependency injection.
nemo1618•3h ago
I see two downsides. Looking at this snippet:

    my_function (): Unit can AllErrors =
      x = LibraryA.foo ()
      y = LibraryB.bar ()
The first thing to note is that there is no indication that foo or bar can fail. You have to lookup their type signature (or at least hover over them in your IDE) to discover that these calls might invoke an error handler.

The second thing to note is that, once you ascertain that foo and bar can fail, how do you find the code that will run when they do fail? You would have to traverse the callstack upwards until you find a 'with' expression, then descend into the handler. And this cannot be done statically (i.e. your IDE can't jump to the definition), because my_function might be called from any number of places, each with a different handler.

I do think this is a really neat concept, but I have major reservations about the readability/debuggability of the resulting code.

MrJohz•3h ago
> And this cannot be done statically (i.e. your IDE can't jump to the definition), because my_function might be called from any number of places, each with a different handler.

I believe this can be done statically (that's one of the key points of algebraic effects). It works work essentially the same as "jump to caller", where your ide would give you a selection of options, and you can find which caller/handler is the one you're interested in.

edding4500•3h ago
I wrote my bachelors thesis about IDE support for lexical effects and handlers: https://se.cs.uni-tuebingen.de/teaching/thesis/2021/11/01/ID...

All of what you state is very doable.

abathologist•2h ago
> The first thing to note is that there is no indication that foo or bar can fail

I think this is a part of the point: we are able to simply write direct style, and not worry at all about the effectual context.

> how do you find the code that will run when they do fail

AFAIU, this is also the point: you are able to abstract away from any particular implementation of how the effects are handled. The code that will when they fail is determined later, whenever you decide how you want to run it. Just as, in `f : g:(A -> B) -> t(A) -> B` there is no way to find "the" code that will run when `g` is executed, because we are abstracting over any particular implementation of `g`.

nine_k•2h ago
It looks like exceptions (write the happy path in direct style, etc), but with exceptions, there is a `catch`. You can look for it and see the alternate path.

What might be a good way to find / navigate to the effectual context quickly? Should we just expect an IDE / LSP color it differently, or something?

MrJohz•2h ago
There's a `catch` with effects as well, though, the effect handler. And it works very similarly to `catch` in that it's not local to the function, but happens somewhere in the calling code. So if you're looking at a function and you want to know how that function's exceptions get handled, you need to look at the calling code.
zvrba•2h ago
> [...] how do you find the code that will run when they do fail? You would have to traverse [...]

I work in a .NET world and there many developers have this bad habit of "interface everything", even if it has just 1 concrete implementation; some even do it for DTOs. "Go to implementation" of a method, and you end up in the interface's declaration so you have to jump through additional hoops to get to it. And you're out of luck when the implementation is in another assembly. The IDE _could_ decompile it if it were a direct reference, but it can't find it for you. When you're out of luck, you have to debug and step into it.

But this brings me to dependency injection containers. More powerful ones (e.g., Autofac) can establish hierarchical scopes, where new scopes can (re)define registrations; similar to LISP's dynamically scoped variables. What a service resolves to at run-time depends on the current DI scope hierarchy.

Which brings me to the point: I've realized that effects can be simulated to some degree by injecting an instance of `ISomeEffectHandler` into a class/method and invoking methods on it to cause the effect. How the effect is handled is determined by the current DI registration of `ISomeEffectHandler`, which can be varied dynamically throughout the program.

So instead of writing

    void DoSomething(...) {
        throw SomeException(...);
    }
you establish an error protocol through interface `IErrorConditions` and write

    void DoSomething(IErrorConditions ec, ...) {
        ec.Report(...);
    }
(Alternately, inject it as a class member.) Now, the currently installed implementation of `IErrorConditions` can throw, log, or whatever. I haven't fully pursued this line of though with stuff like `yield`.
SkiFire13•1h ago
> I work in a .NET world and there many developers have this bad habit of "interface everything", even if it has just 1 concrete implementation

I work on a Java backend that is similar to what you're describing, but Intellij IDEA is smart enough to notice there is exactly one non-test implementation and bring me to its source code.

jiggawatts•49m ago
The annoyance is that the .NET standard library already does this precise thing, but haphazardly and in far fewer places than ideal.

ILogger and IProgress<T> comes to mind immediately, but IMemoryCache too if you squint at it. It literally just "sets" and "gets" a dictionary of values, which makes it a "state" effect. TimeProvider might be considered an algebraic effect also.

wavemode•2h ago
> there is no indication that foo or bar can fail

Sounds like you're just criticizing try-catch style error handling, rather than criticizing algebraic effects specifically.

Which, I mean, is perfectly fair to not like this sort of error handling (lack of callsite indication that an exception can be raised). But it's not really a step backward from a vast majority of programming languages. And there are some definite upsides to it as well.

cryptonector•1h ago
> how do you find the code that will run when they do fail?

That's part of the point: it's dynamic code injection. You can use shallow- or deep-binding strategies for implementing this just as with any dynamic feature. Dynamic means just that bindings are introduced by call frames of callers or callers of callers, etc., so yes, notionally you have to traverse the stack.

> And this cannot be done statically (i.e. your IDE can't jump to the definition),

Correct, because this is a _dynamic_ feature.

However, you are expected not to care. Why? Because you're writing pure code but for the effects it invokes, but those effects could be pure or impure depending on context. Thus your code can be used in prod and hooked up to a mock for testing, where the mock simply interposes effects other than real IO effects.

It's just dependency injection.

You can do this with plain old monads too you know, and that's a much more static feature, but you still need to look way up the call stack to find where _the_ monad you're using might actually be instantiated.

In other words, you get some benefits from these techniques, but you also pay a price. And the price and the benefit are two sides of the same coin: you get to do code injection that lets you do testing and sandboxing, but it becomes less obvious what might be going on.

knuckleheads•2h ago
First time in a long while where I’ve read the intro to a piece about new programming languages and not recognized any of the examples given at all even vaguely. How times change!
rixed•2h ago
Maybe I'm too archaic but I do not share the author's hope that algebraic effects will ever become prevalently used. They certainly can be useful now and then, but the similitude with dynamic scoping brings too many painful memories.
threeseed•1h ago
I wouldn't worry. Even the simplest and most friendly effects library: https://effect.website

Shows clearly why they will never be a mainstream concept. The value proposition is only there when you have more elaborate concurrency needs. But that is a tiny fraction of the applications most people are writing today.

ollysb•2h ago
As I understand it this was the inspiration for React's hooks model. The compiler won't give you the same assurances but in practice hooks do at least allow to inject effects into components.
YuukiRey•2h ago
I don’t see the similarity. Since hooks aren’t actually passed to, or injected into components, there’s no way to evaluate the same hooks in different ways.

I can’t have a hook that talks to a real API in one environment but to a fake one in another. I’d have to use Jest style mocking, which is more like monkey patching.

From the point of view of a React end user, there’s also no list of effects that I can access. I can’t see which effects or hooks a component carries around, which ones weren’t yet evaluated, and so on.

ww520•2h ago
It's different. Hooks in React is basically callback on dependency of state changes. It's more similar to the signaling system.
nabla9•1h ago
Yet another thing Common Lisp programmers have been doing since the time of hoe and axe.
ctenb•1h ago
But Lisp is untyped, which is a major difference. EDIT: dynamically typed I mean
nikita2206•1h ago
Have you thought of using generators as a closest example to compare effects to? I think they are much closer to effects than exceptions are. Great explainer anyway, it was tge first time I have read about this idea and it was immediately obvious
yen223•1h ago
Exceptions are usually used because the syntax for "performing" exceptions (throw) vs handling exceptions (try-catch) is familiar to most programmers, and is basically the same as the syntax for "performing" an effect vs handling the effect, except that the latter also includes resuming a function.

It would be cool to see how generators will be implemented with algebraic effects.

yyyk•1h ago
The state effects example seems unlike the others - the examples avoid syntax for indentation, omit polymorphic effect mention and use minimal syntax for functions - but for state effects you need to repeat "can Use Strings" each function? Presumably one may want to group those under type Strings or can Use Strings, at which point you have a namespace of sorts...
thdhhghgbhy•1h ago
Just seems to be a way of organising code really.
practal•1h ago
Algebraic effects seem very interesting. I have heard about this idea before, but assumed that it somehow belonged into the territory of static type systems. I am not a fan of static type systems, so I didn't look further into the idea.

But I found these two articles [1] about an earlier dynamic version of Eff (the new version is statically typed), which explains the idea nicely without introducing types or categories. I find it particularly intriguing that what Andrej Bauer describes there as "parameterised operation with generalised arity", I would just call an abstraction of shape [0, 1] (see [2]). So this might be helpful for using concepts from algebraic effects to turn abstraction algebra into a programming language.

[1] https://math.andrej.com/2010/09/27/programming-with-effects-...

[2] http://abstractionlogic.com

nicoty•58m ago
What's wrong with static type systems?
hinoki•11m ago
Forget it Jake, it’s land of Lisp.
xixixao•55m ago
It feels powerful. I think the effects in return types could be inferred.

But I share the concerns of others about the downsides of dependency injection. And this is DI on steroids.

For testing, I much prefer to “override” (mock) the single concrete implementation in the test environment, rather than to lose the static caller -> callee relationship in non-test code.

nevertoolate•51m ago
When I see a new (for me) idea coming from (presumably) category theory I wonder if it really will land in any mainstream language. In my experience having cohesion on the philosophical level of the language is the reason why it is nice to work with it in a team of programmers who are adept in both programming and in the business context. A set of programming patterns to solve a problem usually can be replaced with a possibly disjunct set of patterns where both solutions have all the same ilities in the code and solve the business problem.

My question is - can a mainstream language adopt the algebraic effects (handlers?) without creating deep confusion or a new language should be built from the ground up building on top of these abstractions in some form.

nwienert•42m ago
React hooks are them, basically. Not at the language level, but widely adopted and understood.
ww520•16m ago
> can a mainstream language adopt the algebraic effects (handlers?) without creating deep confusion or a new language should be built from the ground up building on top of these abstractions in some form.

Algebraic Effect is a variant/enhancement of dependency injection formalized into a language. Dependency injection has massive usage in the wild for a long time with just library implementation.