-
Notifications
You must be signed in to change notification settings - Fork 133
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
Refactor ActionT to use ReaderT pattern #314
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it works omg it w o r k s I'm so happeeeehhh |
ocramz
changed the title
WIP refactor ActionT to use ReaderT pattern
Refactor ActionT to use ReaderT pattern
Oct 2, 2023
Noice |
fumieval
reviewed
Oct 2, 2023
fumieval
reviewed
Oct 2, 2023
fumieval
reviewed
Oct 2, 2023
@ocramz Is it intentional that you merged this PR? Before merging this PR, At very least I expected you to
|
@fumieval yes sorry for not waiting but I triple checked everything, added more tests around the new exception mechanism and made a Hackage release. These were long-due changes anyway.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
scotty-0.20
:ActionT
using the "ReaderT pattern" : https://www.fpcomplete.com/blog/readert-design-pattern/StatusError
type can be thrown and caught, butNext
,Finish
andRedirect
cannot be caught by the user. ForStatusError
and any user-defined (or imported) exception types, one can either catch exceptions inline withrescue
or globally for the whole app withdefaultHandler
.Breaking changes:
unliftio
as a dependency, and base exception handling oncatch
.rescue
changes signature to use properException
types rather than strings.text
,html
etc.) have now a MonadIO constraint on the base monad rather than Monad because the Response is in a TVar insideActionEnv
.rescue
has a MonadUnliftIO constraint. The Alternative instance of ActionT is also based on MonadUnliftIO because<|>
is implemented in terms ofcatch
.Closes #310 , closes #309 in passing
closes #110 , closes #153