[Haskell-beginners] how to catch the error thrown by openFile?

Ovidiu Deac ovidiudeac at gmail.com
Sun Sep 25 11:55:45 CEST 2011


>>  content ←  liftIO $ hGetContents hFile
>>  return content
>
> These two lines can be replaced by the shorter
>
>   liftIO $ hGetContents hFile
>

You are right and I knew this before. This was the from movie "The
imperative return strikes again!"

>>
>> Somehow I understand but I don't have the feeling yet why I apply
>> ErrorT to the whole catched expression instead of liftIO. Do you have
>> a nice explanation for it?
>
> Hm, not sure whether I can come up with something nice.
>
...

I think I understood at least part of it. When I read it it does make
sense but I have to polish my monadic skills before I get to actually
feel it.

Thanks a million for the effort of explaining it!
ovidiu



More information about the Beginners mailing list