[Haskell-cafe] testing for exceptions

Darren Grant dedgrant at gmail.com
Mon Nov 2 02:40:20 UTC 2015


Oops yes! :)
On Nov 2, 2015 13:38, "Kim-Ee Yeoh" <ky3 at atamo.com> wrote:

>
> On Sat, Oct 31, 2015 at 6:10 PM, Roel van Dijk <vandijk.roel at gmail.com>
> wrote:
>
>> Small nitpick, but I would generally put the "exception" or "error" in
>> the Left part of an Either and a correct result in the Right part.
>>
>> This has some advantages.
>> 1 - Right is right as opposed to wrong. Easy to remember mnemonic.
>> 2 - It fits neatly with the Monad (Either e) instance.
>>
>
> I think you're being modest when you call it a "small nitpick." If code
> can't get Left and Right right, that code immediately becomes very
> suspicious.
>
> Thus, not
>
>   f2 :: Integer -> Either Integer ErrorString
>
> but
>
>   f2 :: Integer -> Either ErrorString Integer
> Nice catch.
>
> -- Kim-Ee
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151102/22b3515d/attachment.html>


More information about the Haskell-Cafe mailing list