Implement Monadic Extensions/Rendering#117
Draft
emekoi wants to merge 2 commits intommark-md:masterfrom
Draft
Conversation
This file contains hidden or 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
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.
Closes #46.
I hadn't seen #74 until now, but it seems this is more or less the same idea. So most of the comments on it still apply. Instead of duplicating the API we could just expose the monadic interface, but I'm concerned that the usability for those not so familiar with monad transformers and the like, might suffer. However, I didn't want to break the existing API.
A couple of other things:
Ton types andMon functions but maybe they should all just beM?EndoMas(a -> m a) -> a -> m ain order to reassociate the binds soEndoM f <> (EndoM <> g <> EndoM h)doesn't end up asEndo (\x -> (h x >>= g) >>= f)but ratherEndoM (\k x -> g (h (f k)) x). This seemed to be slightly faster (take that with a grain of salt) and might allow a*TransMAPI similar to the*RenderMAPI.mtlis already a dependency, would some test usingState,Reader,Writer, etc. be sufficient?