diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1d8d7d..af4076e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,6 @@ jobs: with: otp-version: "25.2" rebar3-version: "3" - gleam-version: "0.27.0" + gleam-version: "0.30.4" - run: gleam test - run: gleam format --check src test diff --git a/CHANGELOG.md b/CHANGELOG.md index 734d9bb..c3a623f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.20.0 - 2023-08-03 + +- Updated for Gleam v0.30.0. + ## v0.19.0 - 2023-05-17 - The `gleam/erlang/process` module gains functions `selecting_record5` diff --git a/src/gleam/erlang.gleam b/src/gleam/erlang.gleam index 7720a71..ac3e51c 100644 --- a/src/gleam/erlang.gleam +++ b/src/gleam/erlang.gleam @@ -3,23 +3,23 @@ import gleam/list import gleam/erlang/atom.{Atom} import gleam/erlang/charlist.{Charlist} -external fn erl_format(String, List(a)) -> Charlist = - "io_lib" "format" +@external(erlang, "io_lib", "format") +fn erl_format(a: String, b: List(a)) -> Charlist /// Return a string representation of any term pub fn format(term: any) -> String { charlist.to_string(erl_format("~p", [term])) } -pub external fn term_to_binary(a) -> BitString = - "erlang" "term_to_binary" +@external(erlang, "erlang", "term_to_binary") +pub fn term_to_binary(a: a) -> BitString type Safe { Safe } -external fn erl_binary_to_term(BitString, List(Safe)) -> Dynamic = - "erlang" "binary_to_term" +@external(erlang, "erlang", "binary_to_term") +fn erl_binary_to_term(a: BitString, b: List(Safe)) -> Dynamic pub fn binary_to_term(binary: BitString) -> Result(Dynamic, Nil) { case rescue(fn() { erl_binary_to_term(binary, [Safe]) }) { @@ -50,8 +50,8 @@ pub type GetLineError { /// // -> Language: <- gleam /// Ok("gleam\n") /// -pub external fn get_line(prompt: String) -> Result(String, GetLineError) = - "gleam_erlang_ffi" "get_line" +@external(erlang, "gleam_erlang_ffi", "get_line") +pub fn get_line(prompt prompt: String) -> Result(String, GetLineError) pub type TimeUnit { Second @@ -63,14 +63,14 @@ pub type TimeUnit { /// Returns the current OS system time. /// /// -pub external fn system_time(TimeUnit) -> Int = - "os" "system_time" +@external(erlang, "os", "system_time") +pub fn system_time(a: TimeUnit) -> Int /// Returns the current OS system time as a tuple of Ints /// /// http://erlang.org/doc/man/os.html#timestamp-0 -pub external fn erlang_timestamp() -> #(Int, Int, Int) = - "os" "timestamp" +@external(erlang, "os", "timestamp") +pub fn erlang_timestamp() -> #(Int, Int, Int) /// Gleam doesn't offer any way to raise exceptions, but they may still occur /// due to bugs when working with unsafe code, such as when calling Erlang @@ -79,8 +79,8 @@ pub external fn erlang_timestamp() -> #(Int, Int, Int) = /// This function will catch any error thrown and convert it into a result /// rather than crashing the process. /// -pub external fn rescue(fn() -> a) -> Result(a, Crash) = - "gleam_erlang_ffi" "rescue" +@external(erlang, "gleam_erlang_ffi", "rescue") +pub fn rescue(a: fn() -> a) -> Result(a, Crash) pub type Crash { Exited(Dynamic) @@ -88,8 +88,8 @@ pub type Crash { Errored(Dynamic) } -external fn get_start_arguments() -> List(Charlist) = - "init" "get_plain_arguments" +@external(erlang, "init", "get_plain_arguments") +fn get_start_arguments() -> List(Charlist) /// Get the arguments given to the program when it was started. /// @@ -116,10 +116,10 @@ pub fn start_arguments() -> List(String) { /// - /// - /// -pub external fn ensure_all_started( - application: Atom, -) -> Result(List(Atom), EnsureAllStartedError) = - "gleam_erlang_ffi" "ensure_all_started" +@external(erlang, "gleam_erlang_ffi", "ensure_all_started") +pub fn ensure_all_started( + application application: Atom, +) -> Result(List(Atom), EnsureAllStartedError) pub type EnsureAllStartedError { UnknownApplication(name: Atom) @@ -135,9 +135,9 @@ pub type EnsureAllStartedError { /// /// [1]: https://www.erlang.org/doc/efficiency_guide/advanced.html#unique_references /// -pub external type Reference +pub type Reference /// Create a new unique reference. /// -pub external fn make_reference() -> Reference = - "erlang" "make_ref" +@external(erlang, "erlang", "make_ref") +pub fn make_reference() -> Reference diff --git a/src/gleam/erlang/atom.gleam b/src/gleam/erlang/atom.gleam index 1e0aac6..a64d059 100644 --- a/src/gleam/erlang/atom.gleam +++ b/src/gleam/erlang/atom.gleam @@ -15,7 +15,7 @@ import gleam/dynamic.{DecodeErrors, Dynamic} /// user input into atoms) we may hit the max limit of atoms and cause the /// virtual machine to crash. /// -pub external type Atom +pub type Atom /// An error returned when no atom is found in the virtual machine's atom table /// for a given string when calling the [`from_string`](#from_string) function. @@ -36,8 +36,8 @@ pub type FromStringError { /// > from_string("some_new_atom") /// Error(AtomNotLoaded) /// -pub external fn from_string(String) -> Result(Atom, FromStringError) = - "gleam_erlang_ffi" "atom_from_string" +@external(erlang, "gleam_erlang_ffi", "atom_from_string") +pub fn from_string(a: String) -> Result(Atom, FromStringError) /// Creates an atom from a string, inserting a new value into the virtual /// machine's atom table if an atom does not already exist for the given @@ -48,8 +48,8 @@ pub external fn from_string(String) -> Result(Atom, FromStringError) = /// convert user input into atoms as filling the atom table will cause the /// virtual machine to crash! /// -pub external fn create_from_string(String) -> Atom = - "erlang" "binary_to_atom" +@external(erlang, "erlang", "binary_to_atom") +pub fn create_from_string(a: String) -> Atom /// Retuns a `String` corresponding to the text representation of the given /// `Atom`. @@ -60,8 +60,8 @@ pub external fn create_from_string(String) -> Atom = /// > to_string(ok_atom) /// "ok" /// -pub external fn to_string(Atom) -> String = - "erlang" "atom_to_binary" +@external(erlang, "erlang", "atom_to_binary") +pub fn to_string(a: Atom) -> String /// Checks to see whether a `Dynamic` value is an atom, and return the atom if /// it is. @@ -75,5 +75,5 @@ pub external fn to_string(Atom) -> String = /// > from_dynamic(dynamic.from(123)) /// Error([DecodeError(expected: "Atom", found: "Int", path: [])]) /// -pub external fn from_dynamic(from: Dynamic) -> Result(Atom, DecodeErrors) = - "gleam_erlang_ffi" "atom_from_dynamic" +@external(erlang, "gleam_erlang_ffi", "atom_from_dynamic") +pub fn from_dynamic(from from: Dynamic) -> Result(Atom, DecodeErrors) diff --git a/src/gleam/erlang/charlist.gleam b/src/gleam/erlang/charlist.gleam index a88c57f..e5b6d65 100644 --- a/src/gleam/erlang/charlist.gleam +++ b/src/gleam/erlang/charlist.gleam @@ -7,19 +7,19 @@ /// A list of characters represented as ints. Commonly used by older Erlang /// modules. -pub external type Charlist +pub type Charlist /// Transform a charlist to a string -pub external fn to_string(Charlist) -> String = - "unicode" "characters_to_binary" +@external(erlang, "unicode", "characters_to_binary") +pub fn to_string(a: Charlist) -> String // Calls `unicode:characters_to_binary(Data, unicode, unicode)` // Note: `unicode is an alias for utf8` // See /// Transform a string to a charlist -pub external fn from_string(String) -> Charlist = - "unicode" "characters_to_list" +@external(erlang, "unicode", "characters_to_list") +pub fn from_string(a: String) -> Charlist // Calls `unicode:characters_to_list(Data, unicode)` // Note: `unicode is an alias for utf8` // See diff --git a/src/gleam/erlang/file.gleam b/src/gleam/erlang/file.gleam index 2e78051..70542e8 100644 --- a/src/gleam/erlang/file.gleam +++ b/src/gleam/erlang/file.gleam @@ -265,8 +265,8 @@ pub type FileInfo { /// Error(Eacces) /// ``` /// -pub external fn file_info(String) -> Result(FileInfo, Reason) = - "gleam_erlang_ffi" "file_info" +@external(erlang, "gleam_erlang_ffi", "file_info") +pub fn file_info(a: String) -> Result(FileInfo, Reason) /// Results in `FileInfo` about the given `path` on success, otherwise a /// `Reason` for failure. @@ -335,8 +335,8 @@ pub external fn file_info(String) -> Result(FileInfo, Reason) = /// Error(Eacces) /// ``` /// -pub external fn link_info(String) -> Result(FileInfo, Reason) = - "gleam_erlang_ffi" "link_info" +@external(erlang, "gleam_erlang_ffi", "link_info") +pub fn link_info(a: String) -> Result(FileInfo, Reason) /// Results in a `Bool` on success that indicates whether the given `path` has /// a `Directory` `FileType`, otherwise a `Reason` for failure. @@ -468,8 +468,8 @@ pub fn link_exists(path: String) -> Result(Bool, Reason) { /// Error(Enoent) /// ``` /// -pub external fn make_directory(String) -> Result(Nil, Reason) = - "gleam_erlang_ffi" "make_directory" +@external(erlang, "gleam_erlang_ffi", "make_directory") +pub fn make_directory(a: String) -> Result(Nil, Reason) /// Lists all files in a directory, except files with /// [raw filenames](https://www.erlang.org/doc/apps/stdlib/unicode_usage.html#notes-about-raw-filenames). @@ -487,8 +487,8 @@ pub external fn make_directory(String) -> Result(Nil, Reason) = /// Error(Enotdir) /// ``` /// -pub external fn list_directory(String) -> Result(List(String), Reason) = - "gleam_erlang_ffi" "list_directory" +@external(erlang, "gleam_erlang_ffi", "list_directory") +pub fn list_directory(a: String) -> Result(List(String), Reason) /// Deletes a directory. /// @@ -505,8 +505,8 @@ pub external fn list_directory(String) -> Result(List(String), Reason) = /// Error(Enoent) /// ``` /// -pub external fn delete_directory(String) -> Result(Nil, Reason) = - "gleam_erlang_ffi" "delete_directory" +@external(erlang, "gleam_erlang_ffi", "delete_directory") +pub fn delete_directory(a: String) -> Result(Nil, Reason) /// Deletes a file or directory recursively. /// @@ -525,8 +525,8 @@ pub external fn delete_directory(String) -> Result(Nil, Reason) = /// Error(Enoent) /// ``` /// -pub external fn recursive_delete(String) -> Result(Nil, Reason) = - "gleam_erlang_ffi" "recursive_delete" +@external(erlang, "gleam_erlang_ffi", "recursive_delete") +pub fn recursive_delete(a: String) -> Result(Nil, Reason) /// Read the contents of the given file as a String /// @@ -584,8 +584,8 @@ pub fn read_bits(from path: String) -> Result(BitString, Reason) { do_read_bits(path) } -external fn do_read_bits(path) -> Result(BitString, Reason) = - "gleam_erlang_ffi" "read_file" +@external(erlang, "gleam_erlang_ffi", "read_file") +fn do_read_bits(a: path) -> Result(BitString, Reason) /// Write the given String contents to a file of the given name. /// @@ -636,8 +636,8 @@ pub fn write_bits( do_write_bits(contents, path) } -external fn do_write_bits(BitString, String) -> Result(Nil, Reason) = - "gleam_erlang_ffi" "write_file" +@external(erlang, "gleam_erlang_ffi", "write_file") +fn do_write_bits(a: BitString, b: String) -> Result(Nil, Reason) /// Append the given String contents to a file of the given name. /// @@ -688,11 +688,11 @@ pub fn append_bits( do_append_bits(contents, path) } -external fn do_append_bits( - contents: BitString, - path: String, -) -> Result(Nil, Reason) = - "gleam_erlang_ffi" "append_file" +@external(erlang, "gleam_erlang_ffi", "append_file") +fn do_append_bits( + contents contents: BitString, + path path: String, +) -> Result(Nil, Reason) /// Delete the given file. /// @@ -709,5 +709,5 @@ external fn do_append_bits( /// Error(Enoent) /// ``` /// -pub external fn delete(String) -> Result(Nil, Reason) = - "gleam_erlang_ffi" "delete_file" +@external(erlang, "gleam_erlang_ffi", "delete_file") +pub fn delete(a: String) -> Result(Nil, Reason) diff --git a/src/gleam/erlang/os.gleam b/src/gleam/erlang/os.gleam index 6832696..7a715bd 100644 --- a/src/gleam/erlang/os.gleam +++ b/src/gleam/erlang/os.gleam @@ -14,8 +14,8 @@ import gleam/map.{Map} /// ... /// ]) /// -pub external fn get_all_env() -> Map(String, String) = - "gleam_erlang_ffi" "get_all_env" +@external(erlang, "gleam_erlang_ffi", "get_all_env") +pub fn get_all_env() -> Map(String, String) /// Returns the value associated with the given environment variable name. /// @@ -27,8 +27,8 @@ pub external fn get_all_env() -> Map(String, String) = /// > get_env(name: "PWD") /// "/home/j3rn" /// -pub external fn get_env(name: String) -> Result(String, Nil) = - "gleam_erlang_ffi" "get_env" +@external(erlang, "gleam_erlang_ffi", "get_env") +pub fn get_env(name name: String) -> Result(String, Nil) /// Associates the given value with the given environment variable name. /// @@ -42,8 +42,8 @@ pub external fn get_env(name: String) -> Result(String, Nil) = /// > set_env(value: "MYVALUE", name: "MYVAR") /// Nil /// -pub external fn set_env(name: String, value: String) -> Nil = - "gleam_erlang_ffi" "set_env" +@external(erlang, "gleam_erlang_ffi", "set_env") +pub fn set_env(name name: String, value value: String) -> Nil /// Removes the environment variable with the given name. /// @@ -61,8 +61,8 @@ pub external fn set_env(name: String, value: String) -> Nil = /// > unset_env(name: "MYVAR") /// Nil /// -pub external fn unset_env(name: String) -> Nil = - "gleam_erlang_ffi" "unset_env" +@external(erlang, "gleam_erlang_ffi", "unset_env") +pub fn unset_env(name name: String) -> Nil /// Represents operating system kernels pub type OsFamily { @@ -91,5 +91,5 @@ pub type OsFamily { /// > family() /// Other("sunos") /// -pub external fn family() -> OsFamily = - "gleam_erlang_ffi" "os_family" +@external(erlang, "gleam_erlang_ffi", "os_family") +pub fn family() -> OsFamily diff --git a/src/gleam/erlang/process.gleam b/src/gleam/erlang/process.gleam index 4cb7c0a..7fdca8b 100644 --- a/src/gleam/erlang/process.gleam +++ b/src/gleam/erlang/process.gleam @@ -7,11 +7,11 @@ import gleam/erlang/atom.{Atom} /// process has a `Pid` and it is one of the lowest level building blocks of /// inter-process communication in the Erlang and Gleam OTP frameworks. /// -pub external type Pid +pub type Pid /// Get the `Pid` for the current process. -pub external fn self() -> Pid = - "erlang" "self" +@external(erlang, "erlang", "self") +pub fn self() -> Pid /// Create a new Erlang process that runs concurrently to the creator. In other /// languages this might be called a fibre, a green thread, or a coroutine. @@ -32,11 +32,11 @@ pub fn start(running implementation: fn() -> anything, linked link: Bool) -> Pid } } -external fn spawn(fn() -> anything) -> Pid = - "erlang" "spawn" +@external(erlang, "erlang", "spawn") +fn spawn(a: fn() -> anything) -> Pid -external fn spawn_link(fn() -> anything) -> Pid = - "erlang" "spawn_link" +@external(erlang, "erlang", "spawn_link") +fn spawn_link(a: fn() -> anything) -> Pid /// A `Subject` is a value that processes can use to send and receive messages /// to and from each other in a well typed way. @@ -78,10 +78,10 @@ pub fn subject_owner(subject: Subject(message)) -> Pid { subject.owner } -external type DoNotLeak +type DoNotLeak -external fn raw_send(Pid, message) -> DoNotLeak = - "erlang" "send" +@external(erlang, "erlang", "send") +fn raw_send(a: Pid, b: message) -> DoNotLeak /// Send a message to a process using a `Subject`. The message must be of the /// type that the `Subject` accepts. @@ -155,13 +155,13 @@ pub fn receive( /// Ok("1") /// ``` /// -pub external type Selector(payload) +pub type Selector(payload) /// Create a new `Selector` which can be used to receive messages on multiple /// `Subject`s at once. /// -pub external fn new_selector() -> Selector(payload) = - "gleam_erlang_ffi" "new_selector" +@external(erlang, "gleam_erlang_ffi", "new_selector") +pub fn new_selector() -> Selector(payload) /// Receive a message that has been sent to current process using any of the /// `Subject`s that have been added to the `Selector` with the `selecting` @@ -178,17 +178,17 @@ pub external fn new_selector() -> Selector(payload) = /// To wait forever for the next message rather than for a limited amount of /// time see the `select_forever` function. /// -pub external fn select( - from: Selector(payload), - within: Int, -) -> Result(payload, Nil) = - "gleam_erlang_ffi" "select" +@external(erlang, "gleam_erlang_ffi", "select") +pub fn select( + from from: Selector(payload), + within within: Int, +) -> Result(payload, Nil) /// Similar to the `select` function but will wait forever for a message to /// arrive rather than timing out after a specified amount of time. /// -pub external fn select_forever(from: Selector(payload)) -> payload = - "gleam_erlang_ffi" "select" +@external(erlang, "gleam_erlang_ffi", "select") +pub fn select_forever(from from: Selector(payload)) -> payload /// Add a transformation function to a selector. When a message is received /// using this selector the tranformation function is applied to the message. @@ -196,8 +196,8 @@ pub external fn select_forever(from: Selector(payload)) -> payload = /// This function can be used to change the type of messages received and may /// be useful when combined with the `merge_selector` function. /// -pub external fn map_selector(Selector(a), fn(a) -> b) -> Selector(b) = - "gleam_erlang_ffi" "map_selector" +@external(erlang, "gleam_erlang_ffi", "map_selector") +pub fn map_selector(a: Selector(a), b: fn(a) -> b) -> Selector(b) /// Merge one selector into another, producing a selector that contains the /// message handlers of both. @@ -205,8 +205,8 @@ pub external fn map_selector(Selector(a), fn(a) -> b) -> Selector(b) = /// If a subject is handled by both selectors the handler function of the /// second selector is used. /// -pub external fn merge_selector(Selector(a), Selector(a)) -> Selector(a) = - "gleam_erlang_ffi" "merge_selector" +@external(erlang, "gleam_erlang_ffi", "merge_selector") +pub fn merge_selector(a: Selector(a), b: Selector(a)) -> Selector(a) pub type ExitMessage { ExitMessage(pid: Pid, reason: ExitReason) @@ -249,8 +249,8 @@ pub fn selecting_trapped_exits( /// message to the current process and are waiting for a response, so use with /// caution. /// -pub external fn flush_messages() -> Nil = - "gleam_erlang_ffi" "flush_messages" +@external(erlang, "gleam_erlang_ffi", "flush_messages") +pub fn flush_messages() -> Nil /// Add a new `Subject` to the `Selector` to that it's messages can be received. /// @@ -442,25 +442,25 @@ pub fn selecting_anything( insert_selector_handler(selector, Anything, handler) } -external fn insert_selector_handler( - Selector(payload), - for: tag, - mapping: fn(message) -> payload, -) -> Selector(payload) = - "gleam_erlang_ffi" "insert_selector_handler" +@external(erlang, "gleam_erlang_ffi", "insert_selector_handler") +fn insert_selector_handler( + a: Selector(payload), + for for: tag, + mapping mapping: fn(message) -> payload, +) -> Selector(payload) /// Suspends the process calling this function for the specified number of /// milliseconds. /// -pub external fn sleep(Int) -> Nil = - "gleam_erlang_ffi" "sleep" +@external(erlang, "gleam_erlang_ffi", "sleep") +pub fn sleep(a: Int) -> Nil /// Suspends the process forever! This may be useful for suspending the main /// process in a Gleam program when it has no more work to do but we want other /// processes to continue to work. /// -pub external fn sleep_forever() -> Nil = - "gleam_erlang_ffi" "sleep_forever" +@external(erlang, "gleam_erlang_ffi", "sleep_forever") +pub fn sleep_forever() -> Nil /// Check to see whether the process for a given `Pid` is alive. /// @@ -468,15 +468,15 @@ pub external fn sleep_forever() -> Nil = /// /// [1]: http://erlang.org/doc/man/erlang.html#is_process_alive-1 /// -pub external fn is_alive(Pid) -> Bool = - "erlang" "is_process_alive" +@external(erlang, "erlang", "is_process_alive") +pub fn is_alive(a: Pid) -> Bool type ProcessMonitorFlag { Process } -external fn erlang_monitor_process(ProcessMonitorFlag, Pid) -> Reference = - "erlang" "monitor" +@external(erlang, "erlang", "monitor") +fn erlang_monitor_process(a: ProcessMonitorFlag, b: Pid) -> Reference pub opaque type ProcessMonitor { ProcessMonitor(tag: Reference) @@ -523,8 +523,8 @@ pub fn selecting_process_down( /// If the message has already been sent it is removed from the monitoring /// process' mailbox. /// -pub external fn demonitor_process(monitor: ProcessMonitor) -> Nil = - "gleam_erlang_ffi" "demonitor" +@external(erlang, "gleam_erlang_ffi", "demonitor") +pub fn demonitor_process(monitor monitor: ProcessMonitor) -> Nil /// An error returned when making a call to a process. /// @@ -603,11 +603,11 @@ pub fn call( /// Returns `True` if the link was created successfully, returns `False` if the /// process was not alive and as such could not be linked. /// -pub external fn link(pid: Pid) -> Bool = - "gleam_erlang_ffi" "link" +@external(erlang, "gleam_erlang_ffi", "link") +pub fn link(pid pid: Pid) -> Bool -external fn erlang_unlink(pid: Pid) -> Bool = - "erlang" "unlink" +@external(erlang, "erlang", "unlink") +fn erlang_unlink(pid pid: Pid) -> Bool /// Removes any existing link between the caller process and the target process. /// @@ -616,10 +616,10 @@ pub fn unlink(pid: Pid) -> Nil { Nil } -pub external type Timer +pub type Timer -external fn erlang_send_after(Int, Pid, msg) -> Timer = - "erlang" "send_after" +@external(erlang, "erlang", "send_after") +fn erlang_send_after(a: Int, b: Pid, c: msg) -> Timer /// Send a message over a channel after a specified number of milliseconds. /// @@ -627,8 +627,8 @@ pub fn send_after(subject: Subject(msg), delay: Int, message: msg) -> Timer { erlang_send_after(delay, subject.owner, #(subject.tag, message)) } -external fn erlang_cancel_timer(Timer) -> Dynamic = - "erlang" "cancel_timer" +@external(erlang, "erlang", "cancel_timer") +fn erlang_cancel_timer(a: Timer) -> Dynamic /// Values returned when a timer is cancelled. /// @@ -658,8 +658,8 @@ type KillFlag { Kill } -external fn erlang_kill(to: Pid, because: KillFlag) -> Bool = - "erlang" "exit" +@external(erlang, "erlang", "exit") +fn erlang_kill(to to: Pid, because because: KillFlag) -> Bool // Go, my pretties. Kill! Kill! // - Bart Simpson @@ -676,8 +676,8 @@ pub fn kill(pid: Pid) -> Nil { Nil } -external fn erlang_send_exit(to: Pid, because: whatever) -> Bool = - "erlang" "exit" +@external(erlang, "erlang", "exit") +fn erlang_send_exit(to to: Pid, because because: whatever) -> Bool // TODO: test /// Sends an exit signal to a process, indicating that the process is to shut @@ -712,5 +712,5 @@ pub fn send_abnormal_exit(pid: Pid, reason: String) -> Nil { /// crashes an exit message is sent to the process instead. These messages can /// be handled with the `selecting_trapped_exits` function. /// -pub external fn trap_exits(Bool) -> Nil = - "gleam_erlang_ffi" "trap_exits" +@external(erlang, "gleam_erlang_ffi", "trap_exits") +pub fn trap_exits(a: Bool) -> Nil diff --git a/test/gleam/erlang/charlist_test.gleam b/test/gleam/erlang/charlist_test.gleam index 0f6e3a6..367e288 100644 --- a/test/gleam/erlang/charlist_test.gleam +++ b/test/gleam/erlang/charlist_test.gleam @@ -8,8 +8,8 @@ pub fn to_string_test() { |> charlist.to_string() } -external fn lists_duplicate(n: Int, elem: Int) -> charlist.Charlist = - "lists" "duplicate" +@external(erlang, "lists", "duplicate") +fn lists_duplicate(n n: Int, elem elem: Int) -> charlist.Charlist pub fn from_char_list_test() { // Test conversion from a char list generated by Erlang diff --git a/test/gleam/erlang/process_test.gleam b/test/gleam/erlang/process_test.gleam index e65f7a1..170d8b4 100644 --- a/test/gleam/erlang/process_test.gleam +++ b/test/gleam/erlang/process_test.gleam @@ -227,8 +227,8 @@ pub fn call_test() { let assert 2 = process.call(call_subject, fn(subject) { #(1, subject) }, 50) } -external fn send(process.Pid, anything) -> Nil = - "erlang" "send" +@external(erlang, "erlang", "send") +fn send(a: process.Pid, b: anything) -> Nil pub fn selecting_record_test() { send(process.self(), #("a", 1))