git.iko.soy/lynxjs-elm/compiler
on master help sign in
Merge pull request #1991 from jfmengels/typo-fixing
8639484Evan Czaplicki
hints/bad-recursion.md+1−1
@@ -10,7 +10,7 @@ There are two problems that will lead you here, both of them pretty tricky:
10
10
11## No Mutation
11## No Mutation
12
12
13−Languages like JavaScript let you “reassign” variables. When you say `x = x + 1` it means: whatever `x` was pointing to, have it point to `x + 1` instead. This called *mutating* a variable. All values are immutable in Elm, so reassigning variables does not make any sense! Okay, so what *should* `x = x + 1` mean in Elm?
13+Languages like JavaScript let you “reassign” variables. When you say `x = x + 1` it means: whatever `x` was pointing to, have it point to `x + 1` instead. This is called *mutating* a variable. All values are immutable in Elm, so reassigning variables does not make any sense! Okay, so what *should* `x = x + 1` mean in Elm?
14
14
15Well, what does it mean with functions? In Elm, we write recursive functions like this:
15Well, what does it mean with functions? In Elm, we write recursive functions like this:
16
16
hints/comparing-custom-types.md+1−1
@@ -54,7 +54,7 @@ add info (Table nextId dict) =
54 )
54 )
55```
55```
56
56
57−There are a couple nice thing about this approach:
57+There are a couple nice things about this approach:
58
58
591. The only way to get a new `User.Id` is to `add` information to a `User.Table`.
591. The only way to get a new `User.Id` is to `add` information to a `User.Table`.
602. All the operations on a `User.Table` are explicit. Does it make sense to remove users? To merge two tables together? Are there any special details to consider in those cases? This will always be captured explicitly in the interface of the `User` module.
602. All the operations on a `User.Table` are explicit. Does it make sense to remove users? To merge two tables together? Are there any special details to consider in those cases? This will always be captured explicitly in the interface of the `User` module.
hints/comparing-records.md+3−3
@@ -7,7 +7,7 @@ This page aims to catalog these scenarios and offer alternative paths that can g
7
7
8## Sorting Records
8## Sorting Records
9
9
10−Say we want a `view` function that can show a list of students sorted by different characterists.
10+Say we want a `view` function that can show a list of students sorted by different characteristics.
11
11
12We could create something like this:
12We could create something like this:
13
13
@@ -23,7 +23,7 @@ type alias Student =
23type Order = Name | Age | GPA
23type Order = Name | Age | GPA
24
24
25viewStudents : Order -> List Student -> Html msg
25viewStudents : Order -> List Student -> Html msg
26−viewStudents order studentns =
26+viewStudents order students =
27 let
27 let
28 orderlyStudents =
28 orderlyStudents =
29 case order of
29 case order of
@@ -54,7 +54,7 @@ type alias Student =
54 }
54 }
55
55
56viewStudents : Order -> List Student -> Html msg
56viewStudents : Order -> List Student -> Html msg
57−viewStudents order studentns =
57+viewStudents order students =
58 let
58 let
59 orderlyStudents =
59 orderlyStudents =
60 case order of
60 case order of
hints/implicit-casts.md+1−1
@@ -41,7 +41,7 @@ So for any ML-family language designed before Scala, it is safe to assume that i
41
41
42 2. Based on experience reports from Scala users, it seemed like the convenience was not worth the hidden cost. Yes, you can convert `n` in `(n + 1.5)` and everything is nice, but when you are in larger programs that are sparsely annotated, it can be quite difficult to figure out what is going on.
42 2. Based on experience reports from Scala users, it seemed like the convenience was not worth the hidden cost. Yes, you can convert `n` in `(n + 1.5)` and everything is nice, but when you are in larger programs that are sparsely annotated, it can be quite difficult to figure out what is going on.
43
43
44−This user data may be confounded by the fact that Scala allows quite extensive conversions, not just from `Int` to `Float`, but I think it is worth taking seriously nonetheless. So it is _possible_, but it is has tradeoffs.
44+This user data may be confounded by the fact that Scala allows quite extensive conversions, not just from `Int` to `Float`, but I think it is worth taking seriously nonetheless. So it is _possible_, but it has tradeoffs.
45
45
46
46
47## Conclusion
47## Conclusion
hints/import-cycles.md+1−1
@@ -55,7 +55,7 @@ type alias User =
55 }
55 }
56```
56```
57
57
58−Notice that the `Comment` type alias is defined in terms of the `User` type alias and vice versa. Having recursive type aliases like this does not work! That problem is described in depth [here](recursive-alias), but the quick takeaway is that one `type alias` needs to become a `type` to break the recursion. So let’s try again:
58+Notice that the `Comment` type alias is defined in terms of the `User` type alias and vice versa. Having recursive type aliases like this does not work! That problem is described in depth [here](recursive-alias.md), but the quick takeaway is that one `type alias` needs to become a `type` to break the recursion. So let’s try again:
59
59
60```elm
60```elm
61module BadCombination2 exposing (..)
61module BadCombination2 exposing (..)
hints/recursive-alias.md+2−2
@@ -39,7 +39,7 @@ It is much easier to write down `Person` in a type, and then it will just expand
39
39
40## Recursive type aliases?
40## Recursive type aliases?
41
41
42−Okay, so lets say you have some type that may contain itself. In Elm, a common example of this is a comment that might have subcomments:
42+Okay, so let's say you have some type that may contain itself. In Elm, a common example of this is a comment that might have subcomments:
43
43
44```elm
44```elm
45type alias Comment =
45type alias Comment =
@@ -102,7 +102,7 @@ type Comment =
102 }
102 }
103```
103```
104
104
105−Now lets say you want to register an upvote on a comment:
105+Now let's say you want to register an upvote on a comment:
106
106
107```elm
107```elm
108upvote : Comment -> Comment
108upvote : Comment -> Comment
hints/type-annotations.md+1−3
@@ -8,7 +8,7 @@ This document is going to outline the various things that can go wrong and show
8
8
9## Annotation vs. Definition
9## Annotation vs. Definition
10
10
11−The most common issue is with user-defined type variables that are too general. So lets say you have defined a function like this:
11+The most common issue is with user-defined type variables that are too general. So let's say you have defined a function like this:
12
12
13```elm
13```elm
14addPair : (a, a) -> a
14addPair : (a, a) -> a
@@ -58,5 +58,3 @@ filter isOkay list =
58This case is very unfortunate because all the type annotations are correct, but there is a detail of how type inference works right now that **user-defined type variables are not shared between annotations**. This can lead to probably the worst type error messages we have because the problem here is that `a` in the outer annotation does not equal `a` in the inner annotation.
58This case is very unfortunate because all the type annotations are correct, but there is a detail of how type inference works right now that **user-defined type variables are not shared between annotations**. This can lead to probably the worst type error messages we have because the problem here is that `a` in the outer annotation does not equal `a` in the inner annotation.
59
59
60For now the best route is to leave off the inner annotation. It is unfortunate, and hopefully we will be able to do a nicer thing in future releases.
60For now the best route is to leave off the inner annotation. It is unfortunate, and hopefully we will be able to do a nicer thing in future releases.
61−
62−"""