diff options
author | Al Dee <amyalicedee@gmail.com> | 2020-05-21 19:30:14 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-05-21 23:22:36 +0100 |
commit | be2bb14bd3e0e1b7bb09d7caa1bab3bb6d813604 (patch) | |
tree | e576e75e69d721af404b79bb17c6f25b80fd0baf | |
parent | d8ea3288e1a201e89458c4850269525200740fe6 (diff) | |
download | gleam_stdlib-be2bb14bd3e0e1b7bb09d7caa1bab3bb6d813604.tar.gz gleam_stdlib-be2bb14bd3e0e1b7bb09d7caa1bab3bb6d813604.zip |
Adds IO module with print function.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/gleam/io.gleam | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 27860db..8ed8c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Created the `io` module with `print` function. - The `result` module gains the `nil_error` function. - The `string` module gains the `trim`, `trim_left`, `trim_right`, `starts_with`, `ends_with`, `slice`, `pad_left` and `pad_right` functions. diff --git a/src/gleam/io.gleam b/src/gleam/io.gleam new file mode 100644 index 0000000..b7f1691 --- /dev/null +++ b/src/gleam/io.gleam @@ -0,0 +1,17 @@ +external type DoNotLeak + +external fn erl_print(String) -> DoNotLeak = + "io" "fwrite" + +/// Writes string to standard output +/// +/// ## Example +/// +/// > io.print("Hi mum") +/// Nil +/// //=> Hi mum +/// +pub fn print(string: String) -> Nil { + erl_print(string) + Nil +}
\ No newline at end of file |