How to catch and error message and how to make it create unix files instead of dos files??

Hal Daume III hdaume@ISI.EDU
Sat, 1 Mar 2003 18:11:24 -0800 (PST)


Look at the functions try catch and bracket.

--
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume

On Sat, 1 Mar 2003, Alexandre Weffort Thenorio wrote:

> I am trying to write a small software to take info from one file and write it into another file. The problem is that when I don't give any input I get the normal haskell nosuchfile error message but I want to give my own error message. I am a newbie, how can I do that? Also I need the file that is gonna be created (A text file), to be created in UNIX type and not as a DOS file type, how can I do that? I am using ghc to compile on Windows.
> 
> Here is the main code
> 
> main :: IO()
> main = do
>  args <- getArgs
>  codes <- codes args
>  conax <- readconax "conax.txt"
>  makeIrdFile (lines codes) (lines conax)
>   
> 
> --Read input file------------------------------------
> codes :: [String] -> IO[Char]
> codes [] = return ""
> codes (x:xs) = do
>  first <- readFile x
>  return first
>  
> --Read Inbuilt file---------------------------------
> readconax file = do
>  list <- readFile file
>  return list