Comments (5)
This would violate user expectation somewhat severely.
from mtl.
Just as a datapoint, it happened to be the instance I wanted, inasmuch as MonadReader
is "simpler" than MonadState
: indeed you can kinda/sorta make MonadReader
a superclass of MonadState
, though I'm not actually proposing this.
instance MonadReader s m where
ask = get
-- | imperfect, but you get the idea
local ss ma = do
s <- get
put (ss s)
a <- ma
put s
return a
from mtl.
Reader and State do have a sort of incestuous relationship.
Codensity (Reader s) ~ State s
, because State is made up of the composition of Reader s and its adjoint functor: (, s)
. Using this you can always embed reader effects into State.
In an almost equally universal manner you can embed writer effects into state, but there are some minor complications on that front, and while the reader embedding costs you commutativity the latter costs you productivity.
from mtl.
Would it be worth the trouble to come up with a ContT
wrapper offering this instance?
from mtl.
Possibly. If so it should belong in transformers
though, not mtl
, and then mtl
would inherit support for it.
from mtl.
Related Issues (20)
- mtl current master is Safe-inferred (but actually may not be) HOT 9
- Changelog for mtl-2.3 doesn't mention removal of re-export of several modules
- mtl 3.0 planning HOT 12
- `mtl-2.3` dropped `ExceptT` HOT 15
- `mtl-2.3` needs a migration guide for removal of re-exports HOT 3
- Redundant constraint Monoid w in GHC 9.4 build HOT 1
- Tag for `mtl-2.3` HOT 7
- FYI: A paper on how Hackage packages use `mtl`.
- Why not use rank 2 polymorphism for `callCC` HOT 2
- Make MonadCont instance for ContT polykinded HOT 2
- how can i help with a 2.3.1 release or the like? HOT 1
- Build error against transformers-0.6 with GHC-9.0 HOT 13
- Conversions between lazy and strict StateT
- LiftingState
- Request: Export runWriterT from Writer.CPS HOT 1
- How to combine two different `r` `MonadReaders` ? HOT 1
- Windows CI Fails
- More general MonadAccum instance missing HOT 1
- Add onError
- Control.Monad.Accum does not Export Accum nor AccumT
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mtl.