diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-05-29 21:02:55 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-06-02 21:12:59 +0100 |
commit | 5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31 (patch) | |
tree | 5d0d281c66cf71c6e3ca880e6621138a71b95e7b /src/std/iodata.gleam | |
parent | ee03f5a0465e176e220060164a5ffc408f73ed0d (diff) | |
download | gleam_stdlib-5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31.tar.gz gleam_stdlib-5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31.zip |
Enable namespaced modules
Diffstat (limited to 'src/std/iodata.gleam')
-rw-r--r-- | src/std/iodata.gleam | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/std/iodata.gleam b/src/std/iodata.gleam new file mode 100644 index 0000000..56efc65 --- /dev/null +++ b/src/std/iodata.gleam @@ -0,0 +1,58 @@ +pub external type Iodata; + +pub external fn prepend(Iodata, String) -> Iodata = + "gleam__stdlib" "iodata_prepend"; + +pub external fn append(Iodata, String) -> Iodata = + "gleam__stdlib" "iodata_append"; + +pub external fn prepend_iodata(Iodata, Iodata) -> Iodata = + "gleam__stdlib" "iodata_prepend"; + +pub external fn append_iodata(Iodata, Iodata) -> Iodata = + "gleam__stdlib" "iodata_append"; + +pub external fn from_strings(List(String)) -> Iodata = + "gleam__stdlib" "identity"; + +pub external fn concat(List(Iodata)) -> Iodata = + "gleam__stdlib" "identity"; + +pub external fn new(String) -> Iodata = + "gleam__stdlib" "identity"; + +pub external fn to_string(Iodata) -> String = + "erlang" "iolist_to_binary"; + +pub external fn byte_size(Iodata) -> Int = + "erlang" "iolist_size"; + +pub external fn from_float(Float) -> Iodata = + "io_lib_format" "fwrite_g"; + +pub external fn lowercase(Iodata) -> Iodata = "string" "lowercase" + +pub external fn uppercase(Iodata) -> Iodata = "string" "uppercase" + +pub external fn reverse(Iodata) -> Iodata = "string" "reverse" + +enum Direction = + | All + +external fn erl_split(Iodata, String, Direction) -> List(Iodata) = + "string" "split" + +pub fn split(iodata, on) { + erl_split(iodata, on, All) +} + +external fn erl_replace(Iodata, String, String, Direction) -> Iodata = + "string" "replace" + +pub fn replace(iodata, pattern, replacement) { + erl_replace(iodata, pattern, replacement, All) +} + +pub external fn is_equal(Iodata, Iodata) -> Bool = "string" "equal" + +pub external fn is_empty(Iodata) -> Bool = "string" "is_empty" |