From fafeda2ac3beddb00bfd066de0465384eba38378 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Fri, 26 Sep 2025 09:02:12 +0300 Subject: [PATCH] lecture 5: fix typo closes #104 --- part1.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/part1.html b/part1.html index ac48ce6..f0f03d3 100644 --- a/part1.html +++ b/part1.html @@ -3216,7 +3216,7 @@ It turns a list of pairs into a list of elements

This gives you accessor functions like field1 :: TypeName -> Field1Type for free.

5.6 Sidenote: Other Ways of Defining Types

In addition to the data keyword, there are two additional ways of defining types in Haskell.

-

The newtype keyword works like data, but you can only have a single constructor with a single field. It’s sometimes wise to use newtype for performance resons, but we’ll get back to those in part 2.

+

The newtype keyword works like data, but you can only have a single constructor with a single field. It’s sometimes wise to use newtype for performance reasons, but we’ll get back to those in part 2.

The type keyword introduces a type alias. Type aliases don’t affect type checking, they just offer a shorthand for writing types. For example the familiar String type is an alias for [Char]:

type String = [Char]

This means that whenever the compiler reads String, it just immediately replaces it with [Char]. Type aliases seem useful, but they can easily make reading type errors harder.