Error -> Except migration

Henning Thielemann lemming at
Tue Mar 3 07:44:03 UTC 2015

On Tue, 3 Mar 2015, Ganesh Sittampalam wrote:

> This doesn't seem like a trivial like-for-like replacement since the
> implementation of 'fail' is different - in ErrorT it produces an
> exception within the ErrorT itself, and in ExceptT it just calls fail in
> the underlying monad.
> Is there any guidance or simple trick to find if a program is relying on
> the old behaviour? Otherwise migrating could be rather
> painful/dangerous, particularly as tests often don't cover exceptional
> cases well.

I think you should never call 'fail' in ExceptT, only throwE or mzero. 
That is, all pattern matches on the left hand side of '<-' must succeed.

More information about the Libraries mailing list