LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > Bits and Pixels
User Name
Password

Notices

Concerning free software, programming, and whatever else I find interesting. Also the blog for my Web site, frigidcode.com.
Old

haskell: get lines and handle end of file

Posted 01-01-2013 at 02:23 AM by hydraMax (Bits and Pixels)
Updated 01-01-2013 at 02:27 AM by hydraMax
Tags haskell

I thought I'd post this convenience function, since I didn't see an obvious one in base:

Code:
import Prelude hiding (catch)
import Control.Exception
import System.IO.Error hiding (catch)

readl f = catch (getLine >>= return . Just)
                (\e -> if (isEOFErrorType . ioeGetErrorType) e
                         then return Nothing
                         else ioError e)
          >>= \a -> case a of
...
Member
Posted in Uncategorized
Views 638 Comments 0 hydraMax is offline

  



All times are GMT -5. The time now is 01:52 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration