Craig
Craig

Reputation: 265

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!

Upvotes: 4

Views: 220

Answers (1)

Craig
Craig

Reputation: 265

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.

Upvotes: 0

Related Questions