|
|
|
|
|
by tel
4669 days ago
|
|
The Haskell solution is to decompose the problem into the pure and impure parts while using types to eliminate a number of these. Then you end up with general classes of exceptions which can be handled using pure Maybe types, perhaps, in various locations as appropriate. Resource availability (Is the network up? Is the connection to SQL up? Can we find the server? Did I just try to access the session but some other idiot clear it?) Incomplete response (Did someone just turn off the SQL machine half way through the query? Have you just terminated me as a result of a deadlock?) Result semantics and types (Are there any rows? Did you return a Null when I was expecting a value? Did you return a float when I was expecting an int? Did my value just overflow? Did you just return 0 and I tried to use it in division?) Translation to intermediate language (Did the SQL compile?) Assumptions about remote state (Do I have rights on this table? Did I just try to call a method on an object that is in fact null?) Smart code handles these all separately. It's crazy to try to bundle them all into one function. |
|