Error -> Except migration
Ganesh Sittampalam
ganesh at earth.li
Tue Mar 3 12:29:32 UTC 2015
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-Trans-Error.html
>>
>>
>> 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
More information about the Libraries
mailing list