Sunday 26 April 2020

Scala with Cats: Revision Questions



Earlier this year I read a fantastic book about Ultralearning. One tip from the book was to make notes in the form of questions without the answers rather than making notes to browse. Therefore, to review my work I can answer the questions and test my recall rather than just reading information and hope it goes in. 

The answers are in another post

Chapter 1: Introduction

  1. What is a type class? 
  2. What is an interface syntax in cats?
  3. What do Show and Eq do in cats? 
  4. Explain covariance, contravariance and invariance. 

Chapter 2: Monoids and Semigroups

  1. Define monoid and semigroup and give examples of each. 

Chapter 3: Functors

  1. What is a type constructor? 
  2. What is a covariant functor?
  3. Write a method 'power' which can operate on either List(1,2,3) or Option(2) and returns List(1,4,9) and Option(4) respectively. 
  4. What is a contravariant functor? 

Chapter 4: Monads

  1. What is a monad? 
  2. What is the 'Id' monad for? 
  3. What is the 'Eval' monad for? 
  4. What does each line print? 
  5. What is the output of the following code snippet? 
  6. What is the writer monad for?
  7. What is the reader monad for? 
  8. What is the state monad for? 




No comments:

Post a Comment

Scala with Cats: Answers to revision questions

I'm studying the 'Scala with Cats' book. I want the information to stick so I am applying a technique from 'Ultralearning&#...