Comments (5)
It is possible, when working directly in DeclareT
, to erase declared values.
ghci> execDeclare [] $ do
declare [1]
DeclareT $ const $ return ([], ())
[]
Now, I see that the laws are carefully constructed such that this isn't a violation of any sort. But it does make me question the usefulness of those laws. When given an arbitrary MonadDeclare d m => m a
, you have no idea if it behaves as a state monad or a declare monad, as it might wipe any declarations you make before using it. I imagine this should be seen as a problem?
from mtl.
@ElvishJerricco I suspect you didn't actually run that in GHCi:
execDeclare
receives arguments in different order;DeclareT $ const $ return ([], ())
is essentiallydeclare []
;- the output is actually
[1]
, as expected.
Here's what I get:
$ stack ghci
...
>>> flip execDeclare [] $ do { declare [1]; DeclareT $ const $ return ([], ()); }
[1]
I believe the laws are useful and although you made me doubt it, I still think they don't allow any MonadDeclare
instance to erase output. However they probably might be better and/or clearer and I am open to suggestions!
from mtl.
Oh geez you're right. That's what I get for browsing github issues on my phone =P My bad!
from mtl.
Starting with transformers-0.5.4.0
there's Control.Monad.Trans.Accum
which is DeclareT
under a different (more general) name — AccumT
.
from mtl.
Since AccumT is now in transformers, and #44 is an open issue, I am going to close this. Anyone feel free to re-open or ping to re-open if I'm missing something.
from mtl.
Related Issues (20)
- "Since" information for `MonadFail` instances missing (haddock, CHANGELOG)
- Add release dates to CHANGELOG HOT 1
- 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
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.