© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
D. YangIntroducing ReScripthttps://doi.org/10.1007/978-1-4842-8888-7_3

3. Composite Data Types

Danny Yang1  
(1)
Mountain View, CA, USA
 

In this chapter, we’ll discuss two composite data types fundamental to ReScript: tuples and variants.

Tuples are sequences of multiple values, while variants represent a value that can be one of several possibilities. Tuples and variants belong to a class of data types called algebraic data types, which allows us to model and manipulate complex data cleanly and safely.

This chapter will also cover how exceptions work in ReScript – how to throw exceptions, how to handle exceptions, and how to define custom exceptions.

Finally, ...

Get Introducing ReScript: Functional Programming for Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.