On 27 Aug 2013, at 08:33, Niklas Hambüchen wrote:
> @Malcolm, would you mind a change towards throwing an exception that is
> different from error so that it can be easily caught, or even better, a
> change from
>
> runCpphs :: ... -> IO String
>
> to
>
> runCpphs :: ... -> IO (Either String String)
>
> or similar?
Have you tried simply wrapping the call to runCpphs in a "catch"? Something
like
safeRunCpphs :: ... -> IO (Either String String)
safeRunCpphs foo = fmap Right (runCpphs foo) `catch` (\(UserError s)-> Left
s
> If an exception based interface is kept, it would be nice to add some
> haddock to `runCpphs`; not knowing about the existence of #error, it is
> easy to assume that the IO is only used for accessing the FilePath
> passed in.
The IO is used also for reading #include'd files, of course. I'd be happy to
add some extra documentation making the behaviour on #error clearer, if you can
suggest some text that would have helped you.
Regards,
Malcolm
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe