-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose more of RuntimeSplice #32
Comments
Hmm, I'm a bit reluctant to expose the constructor. Can you tell me a little more about what your reader type class does so I can understand your use case more? |
It's just MonadReader by a different name, so that you can use both at the same time. Happstack does a similar thing with their ServerMonad. This way you can have two Readers in your stack, and access them without knowing how deep they are in your stack. The issue is more general than our type class though. Any function with RuntimeSplice on a negative position is impossible to implement from outside the package. This goes for things like What are your objections to exposing the constructor? Unsafety? Hiding of implementation? Many packages expose internals through a What about a |
Yeah, but what are you reading from? Would a passthrough Reader instance do the job for you, or are you trying to make a reader that gets its data from some Promise? I'm reluctant to expose the constructor because I don't really want to expose the internal HeterogeneousEnvironment. An opaque RuntimeSplice monad feels like the right level of abstraction to me. A MonadTransControl instance might be ok here, I need to look into that a little more. |
Regarding MonadTransControl...right now the Snap Framework is standardized on MonadCatchIO, so I'm reluctant to add monad-control at this point. However, when the new server comes out, we're switching to monad-control. So at that time I don't think I'll have any objections to a MonadTransControl instance for RuntimeSplice. |
Has any work been done on the switch to monad-control? I'm experimenting with something, and I need these instances for that, as well as instances for |
It's coming. @gregorycollins is working on the rewrite of snap-core [1] and snap-server [2] which uses io-streams under the hood. That will switch us to monad-control. [1] https://github.com/snapframework/snap-core/tree/io-streams |
Ah, great! Probably too soon to switch though, and it won't help me when working on the old code base. |
With the 1.0 release, Heist is now using monad-control. Are you still interested in the MonadTransControl instance for RuntimeSplice? |
We're not using heist anymore so I don't need it at this point. |
We have a
MonadReader
-like typeclass that we'd like to implement forRuntimeSplice m
. Currently this is not possible, since you can't implementlocal
. One option is to expose theRuntimeSplice
constructor andunRS
deconstructor. Then we could do something like:Another option is to provide an instance of
MonadTransControl
for RuntimeSplice. This could be used to writeourLocal
and would also allow use of the functions from lifted-base, likecatch
.I could send a pull request for either option, if you let me know which (if any) you prefer.
The text was updated successfully, but these errors were encountered: