Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Scala Programming

You're reading from   Learn Scala Programming A comprehensive guide covering functional and reactive programming with Scala 2.13, Akka, and Lagom

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788836302
Length 498 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Slava Schmidt Slava Schmidt
Author Profile Icon Slava Schmidt
Slava Schmidt
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. An Introduction to Scala 2.13 2. Understanding Types in Scala FREE CHAPTER 3. Deep Dive into Functions 4. Getting to Know Implicits and Type Classes 5. Property-Based Testing in Scala 6. Exploring Built-In Effects 7. Understanding Algebraic Structures 8. Dealing with Effects 9. Familiarizing Yourself with Basic Monads 10. A Look at Monad Transformers and Free Monad 11. An Introduction to the Akka and Actor Models 12. Building Reactive Applications with Akka Typed 13. Basics of Akka Streams 14. Project 1 - Building Microservices with Scala 15. Project 2 - Building Microservices with Lagom 16. Preparing the Environment and Running Code Samples 17. Assessments 18. Other Books You May Enjoy

Questions

  1. Implement Monad[Try].
  2. Prove the right identity law for the State monad.
  3. Pick one of the monads we defined in this chapter and implement the go function, which will encode the notion of sinking the boat with a probability of 1%.
  4. Please do the same as question 3, but encode the notion of motor breaking in 1% of the moves, leaving the boat immobilized.
  5. Describe the essence of the monads we defined in this chapter by using the (loosely) following template—The state monad passes state between chained computations. The computation itself accepts the outcome of the previous calculation and returns the result, along with the new state.
  1. Define a go method that both tracks the position of the boat and takes the possibility of sinking the boat by using the structure with the following type:
type WriterOption[B] = Writer[Vector[(Double, Double)], Option[Boat]]
  1. Compare...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime