简体   繁体   中英

How do I know where in my Haskell Program an Exception can be Thrown?

I'm working on a 1-10k line personal Haskell project, and I'm using various IO-libraries such as Network.HTTP.Conduit inside workers spawned with Pipes.Concurrent.

I just realized that some of these IO libraries are throwing exceptions in edge cases.

Is there any way for GHC to give me compile-time warnings about uncaught exceptions? What is the best way to find out the exceptions a library can throw?

Thanks!

Just answering my own question as it stands in 2018. Hopefully this will improve over time.

At compile-time, there is no way to know which parts of your Haskell program can throw exceptions. Some libraries choose to return Either/Maybe monads to deal with edge cases safely and others choose to throw exceptions.

Personally, I believe this makes Haskell a lot less attractive to run in production, especially since these exceptions will rarely have stack traces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM