News for hackers. Stuff that matters.
Re:Escaping Hell with Monads (2017) by indrekju on Friday February 23, 2018 @10:17AM (#16446769)
You can. Instead of passing null through the chain you could pass an actual error object.

Check out Elixir With statements for example: http://openmymind.net/Elixirs-With-Statement/

We do something similar in ruby with deterministic gem. Each action returns Success(value) or Failure(error). The error object is one of our own defined error instances (e.g. Responses::Unauthorized.new(msg)). These are then translated to actual error codes and messages in the web layer.

We added something similar to do-notion for ruby in deterministic gem. Not very nice but makes using deterministic a bit more convenient. https://github.com/pzol/deterministic#chaining-with-in_seque...

There are no comments on this comment yet.