Implementation of State monad is possible?
See original GitHub issueAs I understand point of Free monad is to not write monad instance for our data structures, so why do we have chain defined on State
?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
State monad implementation + example - GitHub Gist
State monad implementation + example. GitHub Gist: instantly share code, notes, ... instance Monad (State s) where. return a = State $ \s...
Read more >Implementation of State Monad - haskell - Stack Overflow
I am working on a simple example to implement the state monad in Haskell. I have made a data type GlobState using record...
Read more >State Monad - HaskellWiki
This is a short tutorial on the state monad. Emphasis is placed on intuition. The types have been simplified to protect the innocent....
Read more >Deriving the State monad from first principles | William Yao
Remember that you can deconstruct the passed-in State values as well. You're currently implementing the abstractions, not using them, so it's ...
Read more >Haskell/Understanding monads/State - Wikibooks
If you have programmed in any other language before, you likely wrote some functions that "kept state". For those new to the concept,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it might be useful, if we add
foldRun
so that Interpreter could carry some state around.We could still reuse normal stateless transformers when foldRun-ing:
[Either, stateless(eitherToTask)]
const stateless = f => a => acc => [f(a), acc]
We could also add Freer Transformer.
Love it!