Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Tutorial fixes #7

Merged
merged 7 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/Lessons/Components/01-Basics.mint
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Lessons {
],
contents:
<<#MARKDOWN
A **component** is a collection of UI elements which together a serve
A **component** is a collection of UI elements which together serve a
specific function. You can think of buttons, checkboxes, selects, images,
etc... as components.

Expand Down
6 changes: 3 additions & 3 deletions source/Lessons/Components/03-Dynamic-Attributes.mint
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ module Lessons {
```

When building web apps, it's important to make sure that they're
accessible to the broadest possible userbase, including people with
accessible to the broadest possible user base, including people with
(for example) impaired vision or motion, or people without powerful
hardware or good internet connections.

To that end we should add the `alt` attribute that describes the image
for people using screenreaders, or people with slow or flaky internet
To that end, we should add the `alt` attribute that describes the image
for people using screen readers, or people with slow or flaky internet
connections that can't download the image. Let's add it:

```mint
Expand Down
4 changes: 2 additions & 2 deletions source/Lessons/Components/04-Styling.mint
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Lessons {
],
contents:
<<#MARKDOWN
In HTML you normally put your styles into a `<style>` element. In Mint
In HTML, you normally put your styles into a `<style>` element. In Mint
you put it into `style` blocks.

```mint
Expand All @@ -57,7 +57,7 @@ module Lessons {
Style blocks are like CSS classes, they have a name and can be added to
any element in the component.

Styling is a topic so big that it has it's own chapter so stick around
Styling is a topic so big that it has its own chapter, so stick around
to learn everything about it!
MARKDOWN
}
Expand Down
4 changes: 2 additions & 2 deletions source/Lessons/Components/05-Composition.mint
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module Lessons {
Instead, we can write components in other files and use them as we
would other elements.

Once your component is ready all you need to do is add it as markup:
Once your component is ready, all you need to do is add it as markup:

```mint
<Nested/>
Expand All @@ -78,7 +78,7 @@ module Lessons {
compiler finds all `.mint` files in your project and parses them
automatically. Anything in them is available everywhere.

Also notice that the component name `Nested` is capitalised. This
Also notice that the component name `Nested` is capitalized. This
convention has been adopted to allow us to differentiate between
user-defined components and regular HTML tags.
MARKDOWN
Expand Down
4 changes: 2 additions & 2 deletions source/Lessons/Components/06-Properties.mint
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module Lessons {
* Properties can be referenced by name within the component (in styles,
functions, computed properties, etc...).

The type definition or default value can be omitted but not both:
The type definition or default value can be omitted, but not both:

```mint
// Type inferred from the default value
Expand All @@ -70,7 +70,7 @@ module Lessons {
property name : String
```

If the passed property doesn't match it's given type then you will get
If the passed property doesn't match its given type, then you will get
a compile error.
MARKDOWN
}
Expand Down
4 changes: 2 additions & 2 deletions source/Lessons/Components/08-State.mint
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module Lessons {
Sometimes you need to have some data for a component to describe it's
internal state.

For that you can use the `state` keyword:
For that, you can use the `state` keyword:

```mint
component Main {
Expand All @@ -73,7 +73,7 @@ module Lessons {

The state can be moved forward using the `next` keyword.

As an exercise you can add an other button to hide the text!
As an exercise, you can add another button to hide the text!
MARKDOWN
}
}
2 changes: 1 addition & 1 deletion source/Lessons/Components/09-References.mint
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module Lessons {
contents:
<<#MARKDOWN
Sometimes it's necessary to access elements or components in a component
for a number of reasons. To do that you can use the `as name` notation:
for a number of reasons. To do that, you can use the `as name` notation:

```mint
<input as input/>
Expand Down
6 changes: 3 additions & 3 deletions source/Lessons/ControlExpressions/01-If.mint
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module Lessons {
],
contents:
<<#MARKDOWN
As most other languages Mint has a structrue to return different
As most other languages, Mint has a construct to return different
values based on some condition.

It looks like this:
Expand All @@ -72,11 +72,11 @@ module Lessons {
}
```

Unlike in some languages `if` in Mint is an expression and not a
Unlike in some languages, `if` in Mint is an expression and not a
statement, and because of this both branches need to return something
and those need to be of the same type.

With this information you should be able update the code to display the
With this information, you should be able to update the code to display the
correct button based on the `userLoggedIn` state.
MARKDOWN
}
Expand Down
10 changes: 5 additions & 5 deletions source/Lessons/ControlExpressions/02-For.mint
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ module Lessons {
],
contents:
<<#MARKDOWN
As most other languages Mint has a structrue to iterate over certain
As most other languages, Mint has a construct to iterate over certain
data structures.

It's the `for` block and it looks like this:
It's the `for` block, and it looks like this:

```mint
for (item of iterable) {
expressions
}
```

Unlike in some languages `for` in Mint is an expression and not a
Unlike in some languages, `for` in Mint is an expression and not a
statement, and because of this it returns an `Array(item)` where
`item` is the type of the last `expression`.

Currently it only can iterate through these types: `Array(item)`, `Set(item)`,
Currently, it can iterate through these types: `Array(item)`, `Set(item)`,
and `Map(key,value)`.

## Filtering using `when`
Expand All @@ -105,7 +105,7 @@ module Lessons {
}
```

Let's display the links of the cat videos usin a `for` expression.
Let's display the links of the cat videos using a `for` expression.
MARKDOWN
}
}
4 changes: 2 additions & 2 deletions source/Lessons/ControlExpressions/03-Case.mint
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ module Lessons {
```

The `case` expression is more powerful than this simple example shows
and will be covering it in other lessons.
and we will be covering it in other lessons.

As an exercise you can add the branches for `3` and `4`.
As an exercise, you can add the branches for `3` and `4`.
MARKDOWN
}
}
16 changes: 8 additions & 8 deletions source/Lessons/Html/01-Tags.mint
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ module Lessons {
contents:
<<#MARKDOWN
Mint mostly supports writing HTML as is and you can use any tags you
would like. It uses a **virtual dom** to render the defined tags to
the document (currenty [Preact](https://preactjs.com/) but it might
would like. It uses a **virtual DOM** to render the defined tags to
the document (currently [Preact](https://preactjs.com/), but it might
change in the future).

There are some changes and additions which you should be aware of:

* Text needs to be sepcified as strings, this is because it allows you
to control whitespace expilictly.
* Text needs to be specified as strings, this is because it allows you
to control whitespace explicitly.

* You can use some expressions inside the HTML tags, like `if` and
`for`.

* Attributes cannot be naked so they must have a value.
* Attributes cannot be naked, so they must have a value.

Attributes are usually strings but there are some exceptions:
Attributes are usually strings, but there are some exceptions:

* Anything starting with `on` are considered events a take functions
instead of strings `onClick={() { Window.alert("Hello!") }}`.
* Anything starting with `on` is considered an event, which takes
a function instead of a string (`onClick={() { Window.alert("Hello!") }}`).

* `readonly`, `disabled` and `checked` takes a `Bool`
(`checked={true}`).
Expand Down
4 changes: 2 additions & 2 deletions source/Lessons/Html/02-Events.mint
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ module Lessons {
* `Function(Html.Event, a)`
* `Function(a)`

In regular JavaScript there are multiple event objects with different
In regular JavaScript, there are multiple event objects with different
values. [`Html.Event`](https://www.mint-lang.com/api/records/Html.Event)
is a record which contains normalized values so it can be used in all
is a record which contains normalized values, so it can be used in all
event handlers.
MARKDOWN
}
Expand Down
2 changes: 1 addition & 1 deletion source/Lessons/Html/03-Inline-Styles.mint
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module Lessons {
],
contents:
<<#MARKDOWN
One of the was you can define CSS for a HTML tag using inline styles.
You can define CSS for an HTML tag using inline styles.

Inline styles can be defined using the `style` attribute. It takes
either CSS string or a `Map(String, String)` of CSS values:
Expand Down
6 changes: 3 additions & 3 deletions source/Lessons/Html/04-Fragments.mint
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ module Lessons {
contents:
<<#MARKDOWN
There are cases where you don't want to wrap multiple `HTML` elements
into for example a `div`. In those cases you can use a **HTML
into for example a `div`. In those cases, you can use a **HTML
fragment**.

It's written as an HTML tag without a tagname:
It's written as an HTML tag without a tag name:

```mint
<>
Expand All @@ -41,7 +41,7 @@ module Lessons {
```

HTML fragments can only have one attribute `key` which is used to
identify the fragment in specific cases which we will cover later.
identify the fragment in specific cases, which we will cover later.
MARKDOWN
}
}
13 changes: 6 additions & 7 deletions source/Lessons/Language/01-Types.mint
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ module Lessons {
Mint is a strongly typed programming language, which means that you will
encounter a lot of type definitions.

Syntax wise a type definition consists of an identifier starting with a
Syntax wise, a type definition consists of an identifier starting with a
capital letter, and followed by letters and numbers.

A type basically gives a name to a value conforming to a specific data
structure.
A type gives a name to a value conforming to a specific data structure.

```mint
"Hello World!" // Type type of this value is `String`
"Hello World!" // The type of this value is `String`
```

A type can have **type variables**. These variables makes the type
A type can have **type variables**. These variables make the type
[polymorphic](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)),
which means that the type can be used with other types
instead of the type variable.
Expand All @@ -33,10 +32,10 @@ module Lessons {
Maybe(String)
```

These kind of types are called composite types because the data
These kinds of types are called composite types because the data
structure they describe are composed of multiple types.

Types appear in Mint code in multiple places usually preceeded by a
Types appear in Mint code in multiple places, usually preceded by a
colon:

```mint
Expand Down
6 changes: 3 additions & 3 deletions source/Lessons/Language/02-Literals.mint
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Lessons {
<<#MARKDOWN
## Boolean

Represents the Boolean type. It has two possible values `true` and
Represents the `Boolean` type. It has two possible values `true` and
`false`.

```mint
Expand All @@ -18,7 +18,7 @@ module Lessons {
```
## Number

Represents a Number. In Mint all numbers are floats.
Represents a `Number`. In Mint, all numbers are floats.

```mint
3.14
Expand All @@ -28,7 +28,7 @@ module Lessons {

## Regexp

Regular expressions are represented by the `Regex` type.
Regular expressions are represented by the `Regexp` type.

```mint
/foo|bar/
Expand Down
8 changes: 4 additions & 4 deletions source/Lessons/Language/03-Strings.mint
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Lessons {
<<#MARKDOWN
A `String` represents a sequence of characters.

Strings are created with string literals using qoutes `""`:
Strings are created with string literals using quotes `""`:

```mint
"A single line string!"
Expand All @@ -26,7 +26,7 @@ module Lessons {
"Third line" == "First lineSecond lineThird line"
```

Strings can be concanated with the `+` operator:
Strings can be concatenated with the `+` operator:

```mint
("Hello" + " World" + "!") == "Hello World!"
Expand All @@ -41,9 +41,9 @@ module Lessons {
"Hello \#{world}!" == "Hello World!"
```

Since Mint is a strongly typed language you can only interpolate other
Since Mint is a strongly typed language, you can only interpolate other
`String` or `Number` typed values (numbers are implicitly converted to
string). If you try to use something else you will get a nice error
string). If you try to use something else, you will get a nice error
message.
MARKDOWN
}
Expand Down
8 changes: 4 additions & 4 deletions source/Lessons/Language/04-Arrays.mint
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module Lessons {
["A", "B", "C"]
```

You can define the type of an array using the of keyword. It is useful
You can define the type of an array using the `of` keyword. It is useful
for defining the type of an empty array:

```mint
Expand All @@ -46,7 +46,7 @@ module Lessons {
```

We can access an arrays item at a given index using the bracket
notiation:
notation:

```mint
let array =
Expand All @@ -55,8 +55,8 @@ module Lessons {
array[0] == Maybe::Just(1)
```

When accessing an item this way the type of the item will be `Maybe(a)`
where a is the type of item in the array. This is so because there might
When accessing an item this way, the type of the item will be `Maybe(a)`
where `a` is the type of the item in the array. This is so because there might
not be an item at that index.
MARKDOWN
}
Expand Down
Loading