Open HaskellZhangSong opened 2 years ago
@HaskellZhangSong I think everythingButM
and everythingMButM
are reasonable generalisations of what's already in the library (although I'd probably consider having GenericQ (m (Maybe r))
instead of GenericQ (m (r, Bool))
when designing from scratch) but signatures of everythingWithContextM
and everythingMWithContextM
look convoluted. Why can't the context in there (the s -> (..., s)
bit) be passed a part of the monad?
I did not think this very carefully. I just extend everythingBut
by lifting (r, Bool)
to m (r, Bool)
. Similarly applied to everythingWithContext
function too.
Why can't the context in there (the s -> (..., s) bit) be passed a part of the monad?
I am not quite sure about how and what exactly you mean. Do you mean to combine m
with a state monad? Could you show the code? Here, I just think the m
in (m r -> m r -> m r)
should be coherent with the m
in (m (s -> (r, s)))
Thanks
I was thinking about something along the lines
everythingMWithContextM :: forall n s r. Monad n => (StateT s n r -> StateT s n r -> StateT s n r) -> GenericQ (StateT s n r)) -> GenericQ (StateT s n r)
I.e. to obtain everythingMWithContextM
the user instantiates already defined everything
funsction.
I think this looks more complicated and need to bring mtl
library into syb.
syb
doesn't have to depend on mtl
(transformers would be enough) - user can instantiate existing functions themselves in their package.
This commit adds following monadic query functions in issue #35:
which make query with unavoidable monadic query easier.