Creating Type Aliases
Throughout this chapter, you’ve learned how to create new data types from scratch to describe the values in your program, but there are some cases where creating an entirely new type from scratch isn’t necessary. In some cases, you might just want to provide a new name to some existing type. In these cases, rather than creating a new type, you can use a type alias.
Type aliases can be a useful way to improve the readability of your code while retaining a degree of flexibility and avoiding introducing the overhead of constructing new data types, but they can also be misused in ways that remove some of the protections you can get with proper types. In this section, we’ll look first at one of the cases where type aliases ...
Get Effective Haskell 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.