[Haskell-cafe] error handling (esp. IO/exceptions)

Donn Cave donn at avvanta.com
Tue Apr 14 18:26:16 EDT 2009


Quoth brian at lorf.org,

>> execute :: FilePath -> [String] -> IO (Either ExecuteError ExitCode)
>
> where 'ExecuteError' is a data type representing all the ways 'execute'
> could fail and that 'execute p args' is supposed to
>
> * ensure p exists
> * get p's permissions
> * ensure p is readable
> * ensure p is executable

 * read UNIX "magic number" from first 2 bytes of p
   case number of
     "#!" -> interpret rest of line, start validation process over on 
             interpreter file
     valid executable type for OS ->  OK
     _ -> not OK

> * execute p and return its exit code

	Donn



More information about the Haskell-Cafe mailing list