News for hackers. Stuff that matters.
Re:Go: Support for Generic Methods by dnnddidiej on Wednesday May 27, 2026 @07:09PM (#48302011)
Can we have Exception monads? Asking for friend.
Re:Go: Support for Generic Methods by AdieuToLogic on Thursday May 28, 2026 @01:02AM (#48304749)
> Can we have Exception monads? Asking for friend.

This is nonsensical. Monads define a strict set of behaviors formalized as "monad laws"[0].

Perhaps what you want is a container which adheres to monad laws capable of abstracting exceptions. Two exemplars of same are Haskell's Data.Either[1] and Scala's Either[2].

0 - https://wiki.haskell.org/Monad_laws

1 - https://hackage-content.haskell.org/package/base-4.22.0.0/do...

2 - https://www.scala-lang.org/api/3.8.3/scala/util/Either.html

Re:Go: Support for Generic Methods by lacker on Thursday May 28, 2026 @01:17AM (#48304859)
I don't think it's nonsensical, it's just another name for the same thing. E.g. in the Haskell wiki it says, "the Error monad, also called the Exception monad".

https://wiki.haskell.org/index.php?title=All_About_Monads

Re:Go: Support for Generic Methods by AdieuToLogic on Thursday May 28, 2026 @10:58PM (#48318468)
I was unaware of "Exception monad" being an industry equivalent term for Either/Error. Given no other context, desiring an "Exception monad" could be interpreted as "a type which handles raising Exception types." Which is how I did.

Thank you for clarifying this for me.

Re:Go: Support for Generic Methods by dnnddidiej on Thursday May 28, 2026 @06:10AM (#48306893)
> Perhaps what you want is a container which adheres to monad laws capable of abstracting exceptions

That is what I meant. Struggling to picture what the other "nonsensical" thing is.

Re:Go: Support for Generic Methods by AdieuToLogic on Thursday May 28, 2026 @11:02PM (#48318491)
As I commented here[0], my interpretation of:

  Can we have Exception monads? Asking for friend.
Was a desire to have "a type which handles raising Exception types." Until now, I was unaware of "Exception monad" being an alternate moniker for Either/Error types.

0 - https://news.ycombinator.com/item?id=48318468