You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: 01-FP-Philosophical-Foundations/01-Composition-Everywhere.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,9 @@ But what kinds of things do we compose? In Functional Programming, we compose ty
16
16
17
17
## Composing Types Algebraically
18
18
19
-
Algebraic Data Types (ADTs) use Algerbra to define the total number of values a given type (i.e. named Set) can have.
19
+
Algebraic Data Types (ADTs) use Algebra to define the total number of values a given type (i.e. named Set) can have.
20
20
21
-
There are two videos worth watching in this regard. The table and visualizations that follow merely summarizes their points, except for the ideas behind the `List` and `Tree` types in the second video.
21
+
There are two videos worth watching in this regard. The table and visualizations that follow merely summarize their points, except for the ideas behind the `List` and `Tree` types in the second video.
22
22
-['Algebraic Data Types' as "Composable Data Types" (stop at 12:40)](https://youtu.be/Up7LcbGZFuo?t=1155)
23
23
- Same ideas already explained in the above "Power of Composition" video:
24
24
- It uses a different syntax than `PureScript` but the ideas still apply.
@@ -27,11 +27,11 @@ There are two videos worth watching in this regard. The table and visualizations
27
27
- explains the "algebraic laws" behind ADTs
28
28
- covers `List`s and `Tree`s (unlike first video)
29
29
30
-
| Name | Math Operator | Logic Operator | PureScript Type | Idea
31
-
| - | - | - | - |
32
-
| Product Type | `x * y` | AND | `Tuple` | "One value from type `x`**AND** one value from type `y`"
33
-
| Sum Type | `x + y` | OR | `Either` | "One value from type `x`**OR** one value from type `y`"
Copy file name to clipboardexpand all lines: 01-FP-Philosophical-Foundations/04-Lazy-vs-Strict.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@ This is "Lazy evaluation." Your parent tells you to _remember_ to do some chore
9
9
| Term | Definition | Pros | Cons
10
10
| - | - | - | - |
11
11
| Strict | computes its results immediately | Expensive computations can be run at the most optimum time | Wastes CPU cycles and memory for storing/evaluating expensive computations that are unneeded/unused |
12
-
| Lazy | defers compututation until its needed | Saves CPU cycles and memory: unneeded/unused computations are never computed | When computations will occur every time, this adds unneeded overhead
12
+
| Lazy | defers computation until its needed | Saves CPU cycles and memory: unneeded/unused computations are never computed | When computations will occur every time, this adds unneeded overhead
13
13
14
-
To make something lazy, we turn it into a function. This function takes one argument (`Unit`) and returns the value we desire. This is called a `thunk`: a computation that we know how to do but have not yet executed yet. To run the code stored in the `thunk`, we use the phrase `forcing the thunk`.
14
+
To make something lazy, we turn it into a function. This function takes one argument (`Unit`) and returns the value we desire. This is called a `thunk`: a computation that we know how to do but have not executed yet. To run the code stored in the `thunk`, we use the phrase `forcing the thunk`.
Copy file name to clipboardexpand all lines: 01-FP-Philosophical-Foundations/05-Looping-via-Recursion.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ Just 1
137
137
138
138
## Other Loops
139
139
140
-
The following Purescript examples are very _crude_ ways of mimicking the following loops. More appropriate examples would require explaning and using type classes like `Foldable` and `Monad` (intermediate FP concepts). Thus, take these examples with a grain of salt.
140
+
The following Purescript examples are very _crude_ ways of mimicking the following loops. More appropriate examples would require explaining and using type classes like `Foldable` and `Monad` (intermediate FP concepts). Thus, take these examples with a grain of salt.
Copy file name to clipboardexpand all lines: 01-FP-Philosophical-Foundations/06-Type-Classes.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Video: [Code Reuse in PureScript: Functions, Type Classes, and Interpreters](htt
14
14
15
15
## Where Do Type Classes Come From?
16
16
17
-
Type classes are usually "encodings" of various concepts from Category Theory. Category Theory (herafter referred to as 'CT') is all about the various ways we can compose functions and do so while adhering to specific laws. It's typically used for control flow (e.g. FP-style "if then else" statements, loops, etc.).
17
+
Type classes are usually "encodings" of various concepts from Category Theory. Category Theory (hereafter referred to as 'CT') is all about the various ways we can compose functions and do so while adhering to specific laws. It's typically used for control flow (e.g. FP-style "if then else" statements, loops, etc.).
18
18
19
19
Type classes make developers productive. They enable programmers...
20
20
- to write 1 line of code that is the equivalent of writing 100s of lines of code.
@@ -37,10 +37,10 @@ Thus, type classes abstract general concepts into an "interface" that can be imp
37
37
2. (Almost Always) The laws by which implementations of a type class must abide.
38
38
- These laws guarantee certain properties, increasing developers' confidence that their code works as expected.
39
39
- They also help one to know how to refactor code. Given `left-hand-side == right-hand-side`, evaluating code on the left may be more expensive (memory, time, IO, etc.) than the code on the right.
40
-
-**Laws cannot be enforced by the compiler.** For example, one could define a a type class' instance for some type which satisfies the type signature. However, the implementation of that instance might not satisfy the type class' law(s). The compiler can verify that the type signature is correct, but not the implementation. Thus, one will need to insure an instance's lawfulness via tests, (usually by using a testing library called `quickcheck-laws`, which is covered later in this repo)
40
+
-**Laws cannot be enforced by the compiler.** For example, one could define a type class' instance for some type which satisfies the type signature. However, the implementation of that instance might not satisfy the type class' law(s). The compiler can verify that the type signature is correct, but not the implementation. Thus, one will need to insure an instance's lawfulness via tests, (usually by using a testing library called `quickcheck-laws`, which is covered later in this repo)
41
41
3. (Frequently) The functions/values that can be derived once one implements the type class.
42
42
- Most of the power/flexibility of type classes come from the combination of the main functions/values implemented in a type class' definition and these derived functions. When a type class extends another, the type class' power increases, its flexibility decreases, and its costs increase.
43
-
- For example, one can consider `Apply` and `Monad`. `Apply` is a less powerful typeclass than `Monad` because it requires its arguments to be known at compile-time whereas `Monad`'s arguments must be known at runtime. However, `Apply` is more flexibile because it can compute things in parallel whereas `Monad` must compute things sequentially.
43
+
- For example, one can consider `Apply` and `Monad`. `Apply` is a less powerful typeclass than `Monad` because it requires its arguments to be known at compile-time whereas `Monad`'s arguments must be known at runtime. However, `Apply` is more flexible because it can compute things in parallel whereas `Monad` must compute things sequentially.
Copy file name to clipboardexpand all lines: 02-Build-Tools/01-Dependency-Managers/01-Bower-Explained.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ The following issue is happening less and less frequently due to the PureScript
46
46
47
47
#### Annoyance Defined
48
48
49
-
If a compiler release that includes breaking changes was released recently, it will take some time for libraries in the ecosystem to become compatible with that release. If you are using Bower as your dependency manager, it may try to install libraries that are and are not compatible with the new release, creating problems.
49
+
If a compiler release that includes breaking changes was released recently, it will take some time for libraries in the ecosystem to become compatible with that release. If you are using Bower as your dependency manager, it may try to install libraries that are not compatible with the new release, creating problems.
Copy file name to clipboardexpand all lines: 02-Build-Tools/01-Dependency-Managers/02-Spago-Explained.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ When a new PureScript release with breaking changes occurs, using `bower` is pai
15
15
- fix a bug in its implementation
16
16
- update a library to a newer PS release if it hasn't been done yet
17
17
- update a library's transitive dependency to a newer release without needing to submit a PR
18
-
- add local or cloud-based dependencies not found in the official packaget set
18
+
- add local or cloud-based dependencies not found in the official package set
19
19
- a project you use frequently, like a custom `Prelude` library.
20
20
- a project with your preferred aliases to functions/values (i.e. using `<!>` for `map` instead of `<$>`)
21
21
@@ -31,13 +31,13 @@ A **package** in this context is 4 things:
31
31
32
32
Thus, a package is a unique named `repo-tag-dependencies` combination (e.g. `prelude` could indicate the [Prelude repo at the 'v0.4.1' tag](https://github.com/purescript/purescript-prelude/tree/v4.1.0)).
33
33
34
-
A **package set** consists of a set of packages. It's a JSON-like file that maps a package name to its corresponding `repo-tag-dependencies` combination. A package set gets **verified** to ensure that its set of packages compile together on a given PureScript compiler erelease. Once verified, they are considered "immutable."
34
+
A **package set** consists of a set of packages. It's a JSON-like file that maps a package name to its corresponding `repo-tag-dependencies` combination. A package set gets **verified** to ensure that its set of packages compiles together on a given PureScript compiler release. Once verified, they are considered "immutable."
35
35
36
36
A package set includes all dependencies: direct ones and their transitive dependencies. For example, if the set includes the package, `PackA`, which depends on the package, `PackB`, the package set must include both packages:
37
37
-`PackA`
38
38
- Version: `v1.0.0`
39
39
- Repo: `https://exampleRepo.com/PackA.git`
40
-
- Dependencies: `["PackB"]` (spago will look up "PackB" in the packaget set to resolve it)
40
+
- Dependencies: `["PackB"]` (spago will look up "PackB" in the package set to resolve it)
Copy file name to clipboardexpand all lines: 02-Build-Tools/01-Dependency-Managers/03-Why-We-Need-Both.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ Updating each library in the ecosystem to account for those breaking changes is
6
6
7
7
In our above analogy, the `purescript-prelude` library and other libraries with no dependencies are the "roots" of the ecosystem. As they get updated, the libraries that depend on them (i.e. the "branches") can now be updated. A "leaf" corresponds to a library which has no dependents.
8
8
9
-
A package set is immutable. Thus, one cannot add to the packaget set a package that has been updated to the new release unless all of the packages in the package set can also be updated.
9
+
A package set is immutable. Thus, one cannot add to the package set a package that has been updated to the new release unless all of the packages in the package set can also be updated.
10
10
11
-
During that transitionary time, `spago` cannot help. Rather, we must depend on `Bower` to slowly update each library to its new version that depends on transitive libraries that have been updated to new versions.
11
+
During that transitional time, `spago` cannot help. Rather, we must depend on `Bower` to slowly update each library to its new version that depends on transitive libraries that have been updated to new versions.
12
12
13
13
Again, `spago` is more suited for application developers and `bower` is more suited for library developers.
0 commit comments