Error -> Except migration

Hi, In recent versions of transformers, 'ErrorT' has been deprecated in favour of 'ExceptT': https://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-... 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've spent a while searching for past discussion of the change, but haven't found anything, so please do point me at anything relevant if this has already been discussed. Cheers, Ganesh

On Tue, 3 Mar 2015, Ganesh Sittampalam wrote:
https://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-...
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.

On 03/03/2015 07:44, Henning Thielemann wrote:
On Tue, 3 Mar 2015, Ganesh Sittampalam wrote:
https://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-...
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.
What I need is to find all the *existing* calls to fail in my currently working ErrorT code so I can remove them. Ganesh
participants (2)
-
Ganesh Sittampalam
-
Henning Thielemann