diff --git a/src/content/chapter0_basics/lesson14_type_imports/code.gleam b/src/content/chapter0_basics/lesson14_type_imports/code.gleam new file mode 100644 index 0000000..61f552a --- /dev/null +++ b/src/content/chapter0_basics/lesson14_type_imports/code.gleam @@ -0,0 +1,10 @@ +import gleam/bytes_builder +import gleam/string_builder.{type StringBuilder} + +pub fn main() { + // Referring to a type in a qualified way + let _bytes: bytes_builder.BytesBuilder = bytes_builder.new() + + // Refering to a type in an unqualified way + let _text: StringBuilder = string_builder.new() +} diff --git a/src/content/chapter0_basics/lesson14_type_imports/en.html b/src/content/chapter0_basics/lesson14_type_imports/en.html new file mode 100644 index 0000000..84f18a5 --- /dev/null +++ b/src/content/chapter0_basics/lesson14_type_imports/en.html @@ -0,0 +1,17 @@ +

+ Other modules may also define types that we wish to refer to. In this case we + need to import them. +

+

+ Like functions types can be referred to in a qualified way by putting + the imported module name and a dot before the type name. For example, + bytes_builder.BytesBuilder +

+

+ Types can also be imported in an unqualified way by listing them in + the import statement with the word type before the type name. +

+

+ It is more common in Gleam code for types to be imported in an unqualified way + than it is for funtions to be imported in an unqualified way. +

diff --git a/src/content/chapter0_basics/lesson14_type_aliases/code.gleam b/src/content/chapter0_basics/lesson15_type_aliases/code.gleam similarity index 100% rename from src/content/chapter0_basics/lesson14_type_aliases/code.gleam rename to src/content/chapter0_basics/lesson15_type_aliases/code.gleam diff --git a/src/content/chapter0_basics/lesson14_type_aliases/en.html b/src/content/chapter0_basics/lesson15_type_aliases/en.html similarity index 100% rename from src/content/chapter0_basics/lesson14_type_aliases/en.html rename to src/content/chapter0_basics/lesson15_type_aliases/en.html diff --git a/src/content/chapter0_basics/lesson15_blocks/code.gleam b/src/content/chapter0_basics/lesson16_blocks/code.gleam similarity index 100% rename from src/content/chapter0_basics/lesson15_blocks/code.gleam rename to src/content/chapter0_basics/lesson16_blocks/code.gleam diff --git a/src/content/chapter0_basics/lesson15_blocks/en.html b/src/content/chapter0_basics/lesson16_blocks/en.html similarity index 100% rename from src/content/chapter0_basics/lesson15_blocks/en.html rename to src/content/chapter0_basics/lesson16_blocks/en.html diff --git a/src/content/chapter0_basics/lesson16_lists/code.gleam b/src/content/chapter0_basics/lesson17_lists/code.gleam similarity index 100% rename from src/content/chapter0_basics/lesson16_lists/code.gleam rename to src/content/chapter0_basics/lesson17_lists/code.gleam diff --git a/src/content/chapter0_basics/lesson16_lists/en.html b/src/content/chapter0_basics/lesson17_lists/en.html similarity index 100% rename from src/content/chapter0_basics/lesson16_lists/en.html rename to src/content/chapter0_basics/lesson17_lists/en.html diff --git a/src/content/chapter0_basics/lesson17_constants/code.gleam b/src/content/chapter0_basics/lesson18_constants/code.gleam similarity index 100% rename from src/content/chapter0_basics/lesson17_constants/code.gleam rename to src/content/chapter0_basics/lesson18_constants/code.gleam diff --git a/src/content/chapter0_basics/lesson17_constants/en.html b/src/content/chapter0_basics/lesson18_constants/en.html similarity index 100% rename from src/content/chapter0_basics/lesson17_constants/en.html rename to src/content/chapter0_basics/lesson18_constants/en.html