Issue
Though this book was just finalized in August, they appear to be using some deprecated Arrow library code in their code examples.
Here's an example from Chapter 6:
Listing 6.18. State propagation using a for-comprehension.
val ns2: State<RNG, List<Int>> =
State.fx(Id.monad()) {
val x: Int = int.bind()
val y: Int = int.bind()
val xs: List<Int> = ints(x).bind()
xs.map { it % y }
}
Using latest Arrow libs, the above snippet fails syntax checker in Idea. 'Id' is not recognized, and Arrow docs say it was slated for deprecation.
Wondering if anyone can help refactor this to current Arrow version, or recommend previous version this will work with?
Solution
I was able to contact the authors on this issue.
Currently, there are no updated code examples for the latest Arrow libs, but they may release that in the future.
In the meantime, there is a git repository of the code (Idea project) that works with the older libs. It can be found here: Functional Programming in Kotlin
I've been recreating the exercise files within the project to avoid seeing the answers before I complete the exercises, and it works.
Answered By - bigswifty
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.