State[S, A]means, "a sequence of transformation over an
S, which will result in an
this is what you do when you write
get, and its type is
State[S, S], i.e. the sequence of transformations on
Swhich will return
Sitself (which is what "getting the state" is)
@BalmungSan I read:
Programming Scala - martin
did the coursera and...
https://www.amazon.com/Functional-Programming-Java-functional-techniques/dp/1617292737 - this is very similar to the scala book, but in java and not sooooo deep, more into data structures than category theory / monads.
I had no problem in the Functional Scala till this chapter :/
run, will take the input state, return it as the output, and leave it unmodified for the next state
will take the input state, return it as the output, and leave it unmodified for the next state
that's the English description of what it does, you need to see that same description in the code
get[Int].run(3)._1 == 3
just a second before we go further...