Skip to content

Commit f70356d

Browse files
committed
cleanup
1 parent d105b87 commit f70356d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

_chapters/haskell1.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ By the way, once you are in the `IO` monad, you can’t easily get rid of it. A
151151
The `print` function is equivalent to the PureScript `log $ show`. That is, it uses any available `show` function for the type of value being printed to convert it to a string, and it then prints that string. Haskell defines show for many types in the Prelude, but print in this case invokes it for us. The other difference here is that square brackets operators are defined in the prelude for linked lists. In PureScript they were used for Arrays---which (in PureScript) don’t have the range operator (`..`) defined so I avoided them. Speaking of List operators, here’s a summary:
152152

153153
<div class="cheatsheet" markdown="1">
154-
155-
## Basic List and Tuple Operator Cheatsheet
154+
**Basic List and Tuple Operator Cheatsheet**
156155

157156
The default Haskell lists are cons lists (linked lists defined with a `cons` function), similar to [those we defined in JavaScript](/functionaljavascript/#computation-with-pure-functions).
158157

@@ -450,7 +449,7 @@ fibs n = case n of
450449
```
451450

452451
</div>
453-
452+
---
454453
## Glossary
455454

456455
*GHCi REPL*: The interactive Read-Eval-Print Loop for GHC, the Glasgow Haskell Compiler, allowing users to test Haskell programs and expressions interactively.

_chapters/haskell2.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Now we can create a small list like so:
2929
l = Cons 1 $ Cons 2 $ Cons 3 Nil
3030
```
3131

32-
### Aside: data vs newtype
32+
<div class="alert-box alert-info" markdown="1">
33+
**`data` vs `newtype`**
3334

3435
We can construct a type `UserId` with one parameter, `Int`
3536

@@ -45,9 +46,10 @@ student :: UserId
4546
student = UserId 1337
4647
```
4748

48-
The `newtype` keyword is used to define a type that has **exactly** one constructor with **exactly** one field. It is primarily used for creating a distinct type from an existing type with *zero runtime* overhead. This can be useful for adding type safety to your code by creating new types that are distinct from their underlying types or giving types a greater semantic meaning, e.g., a UserId compared to an Int.
49+
The `newtype` keyword is used to define a type that has *exactly* one constructor with *exactly* one field. It is primarily used for creating a distinct type from an existing type with *zero runtime* overhead. This can be useful for adding type safety to your code by creating new types that are distinct from their underlying types or giving types a greater semantic meaning, e.g., a UserId compared to an Int.
4950

5051
The data keyword is used to define an algebraic data type (ADT). This allows for the creation of complex data structures that can have multiple constructors. Each constructor can take zero or more arguments, and these arguments can be of any type.
52+
</div>
5153

5254
## Pattern Matching
5355

0 commit comments

Comments
 (0)