Be Smart, Constrain Your Types to Free Your Brain!

Jorge VásquezJorge Vásquez
1 min read

Admit it: You have used a String to model email values, even though most strings aren’t valid emails (don’t worry, we all have!). Imprecise data models are easy, but they crash applications and corrupt external systems. On the other hand, precise data models take time and generate boilerplate.

So-called newtype libraries have stepped up to the challenge, making it easier to model data precisely using runtime validation. However, newtype libraries aren’t able to validate constants at compile-time.

Enter ZIO Prelude Smart Types, which make it simple to model data types precisely, without any boilerplate, runtime overhead, or compile-time overhead. ZIO Prelude Smart Types work at compile-time and runtime, and they have a uniform API across Scala 2 & 3.

Watch the recording:

💡
You can find the slides here
0
Subscribe to my newsletter

Read articles from Jorge Vásquez directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jorge Vásquez
Jorge Vásquez

I'm a Software Developer, mostly focused on the backend. I've had the chance to work with several technologies and programming languages across different industries, such as Telco, AdTech, Streaming and Online Education. I'm always looking to improve my skills, finding new and better ways to solve business problems. Above all, I love Functional Programming. I'm convinced it can help to make better software, and I'm excited about languages and libraries that are making FP more accessible to developers