[rabbitmq-discuss] trying to figure out erlando

Matthew Sackman matthew at rabbitmq.com
Sun May 22 12:25:58 BST 2011


On Sat, May 21, 2011 at 03:35:58PM -0500, Jon Brisbin wrote:
> I'm digging through the blog post on Erlando and it seems there's some
> changes in Erlando recently w.r.t. the error monad. It seems to be
> called "error_t" now and looks like it works similarly to state_t. Is
> that correct?

Yes.

> At any rate, I'm still missing something because I can't seem to
> figure how to use this in the context of the erlang amqp client.
> 
> I'm basically trying to do a maybe on getting a channel so I don't
> have to do:
> 
> case amqp_connection:start(network, AMQPParams) of
>   {ok, Conn} -> case amqp_connection:open_channel(AMQP) of
>     {ok, Channel} -> % do some work
>   end
> end
> 
> and so on and so forth...
> 
> How would I use Erlando for this?

ErrorT = error_t:new(identity_m),
do([ErrorT || {ok, Conn} <- amqp_connection:start(AMQPParams),
              {ok, Chan} <- amqp_connection:open_channel(Conn),
              etc
   ]).

Matthew


More information about the rabbitmq-discuss mailing list