question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implementation of State monad is possible?

See original GitHub issue

As 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:open
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
safarelicommented, May 22, 2016

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.

0reactions
DrBooleancommented, Oct 17, 2016

Love it!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found