Implement Monadic Extensions/Rendering #117
Draft
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:
T
on types andM
on functions but maybe they should all just beM
?EndoM
as(a -> m a) -> a -> m a
in 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*TransM
API similar to the*RenderM
API.mtl
is already a dependency, would some test usingState
,Reader
,Writer
, etc. be sufficient?