A tutorial on functional Scala, cats effect and fs2
APACHE-2.0 License
This is a tutorial on functional programming in Scala with cats, cats-effect and fs2.
Over the course of the tutorial you'll learn about:
sbt
to enter the sbt console.run 12
.Take a look inside the pie.PizzaShop
to see what gets run.
Make sure you're familiar with Modelling Data with Traits
Take a look at the tests in ValidateSizeTest
. Write a function validateSize
that:
The error must be one of:
NegativeSize
PizzaTooBig
PizzaTooSmall
Discuss: Should this really evaluate to a pizza? Could there be a better type to use.
Write a function correction
. As an argument, it should take in an error.
PizzaTooBig
error, it evaluates to a 16 inch pizzaPizzaTooSmall
error, it evaluates to a 3 inch pizzaWrite a function validateSauce
that:
Bechamel
, Tomato
or a StrangeSauce
errorUse a Validated
to evaluate both vaildateSize
and validateSauce
.