Skip to content

Commit

Permalink
Merge pull request #255 from RichardBrown384/patch-1
Browse files Browse the repository at this point in the history
Fix typo in instance-selection.md
  • Loading branch information
noelwelsh authored Dec 20, 2024
2 parents 3db5a23 + d504e87 commit a5b7246
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/codata/extensibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

We have seen that codata can represent types with an infinite number of elements, such as `Stream`. This is one expressive difference from data, which must always be finite. We'll now look at another, which is the type of extensibility we get from data and from codata. Together these gives use guidelines to choose between the two.

Firstly, let's define extensibility. It means the ability to add new features without modifying existing code. (If we allow modification of existing code then any extension becomes trivial.) In particular there are two dimension along which we can extend code: adding new functions or adding new elements. We will see that data and codata have orthogonal extensibility: it's easy to add new functions to data but adding new elements is impossible without modifying existing code, while adding new elements to codata is straight-forward but adding new functions is not.
Firstly, let's define extensibility. It means the ability to add new features without modifying existing code. (If we allow modification of existing code then any extension becomes trivial.) In particular there are two dimensions along which we can extend code: adding new functions or adding new elements. We will see that data and codata have orthogonal extensibility: it's easy to add new functions to data but adding new elements is impossible without modifying existing code, while adding new elements to codata is straight-forward but adding new functions is not.

Let's start with a concrete example of both data and codata. For data we'll use the familiar `List` type.

Expand Down
2 changes: 1 addition & 1 deletion src/pages/type-classes/instance-selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ This is the default semantics for Scala type constructors.

### Variance and Instance Selection

When the compiler searches for a given instnace
When the compiler searches for a given instance
it looks for one matching the type *or subtype*.
Thus we can use variance annotations
to control type class instance selection to some extent.
Expand Down

0 comments on commit a5b7246

Please sign in to comment.