Comments (4)
Throwing exceptions is done using throw
. For handling exceptions there are two options:
runExcept
from C.M.C.Run, which is the same asrunExceptT
(but with a different name)- let them reach the IO layer and turn them into ordinary runtime exceptions
The situation with functions like catch
and withExcept
is subtle. The user might get an impression that she's just mapping exceptions, but in reality she's also moving them from one layer to another, which may affect how exceptions interact with other effects.
So yes, my intention was to use runExcept
to make the semantics a bit more explicit. But if you have compelling use cases for these other functions, I am open to reconsider.
from monad-classes.
i am frequently using withExceptT
to map from one type of exception to another.
say given an ExceptT m InternalException a
i want to wrap it in a sum type data MyException = InternalE InternalException | SomeOtherExceptionwith
withExceptT InternalE`.
what do you think about making catch
and a type changing mapException
part of the type class? that way it won't move from one layer to another. of course the order of layers might still change.
btw. in extensible-effects
the moral equivalent to withExcept
is called rethrowExc
. perhaps that makes it more clean.
from monad-classes.
Making mapExcept
part of a type class addresses my concerns. Only I'd like it to be a separate class (cf. MonadReader
/MonadLocal
). MonadMapExcept
? One of the reasons to do so is that it'll require an additional MFunctor
constraint, if I'm not mistaken.
Same for catch
. I guess you'll need MonadTransControl
to lift it automatically.
from monad-classes.
I am aware that catch and thus withExcept need additional constraints. I'll send a pull request within that week i suppose.
Thanks for being supportive.
from monad-classes.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monad-classes.