[Haskell-cafe] Doubting Haskell

Anton van Straaten anton at appsolutions.com
Sun Feb 17 02:46:10 EST 2008

Colin Paul Adams wrote:
>>>>>> "Cale" == Cale Gibbard <cgibbard at gmail.com> writes:
>     Cale> So, the first version:
>     Cale> import System.IO import Control.Exception (try)
>     Cale> main = do mfh <- try (openFile "myFile" ReadMode) case mfh
>     Cale> of Left err -> do putStr "Error opening file for reading: "
>     Cale> print err Right fh -> do mline <- try (hGetLine fh) case
>     Cale> mline of Left err -> do putStr "Error reading line: " print
>     Cale> err hClose fh Right line -> putStrLn ("Read: " ++ line)
> Left? Right?
> Hardly descriptive terms. Sounds like a sinister language to me.

I was thinking along the same lines.  Politically-sensitive left-handed 
people everywhere ought to be offended that "Left" is the alternative 
used to represent errors, mnemonic value notwithstanding.

Is there a benefit to reusing a generic Either type for this sort of 
thing?  For code comprehensibility, wouldn't it be better to use more 
specific names?  If I want car and cdr, I know where to find it.


More information about the Haskell-Cafe mailing list