Skip to content

Commit

Permalink
Remove more shorthand
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Aug 21, 2024
1 parent 79c7b83 commit b51788f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/gleam/otp/static_supervisor.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pub fn supervisor_child(
///
/// The default value for significance is `False`.
pub fn significant(child: ChildBuilder, significant: Bool) -> ChildBuilder {
ChildBuilder(..child, significant:)
ChildBuilder(..child, significant: significant)
}

/// This defines the amount of milliseconds a child has to shut down before
Expand All @@ -261,7 +261,7 @@ pub fn timeout(child: ChildBuilder, ms ms: Int) -> ChildBuilder {
///
/// The default value for significance is `Permenent`.
pub fn restart(child: ChildBuilder, restart: Restart) -> ChildBuilder {
ChildBuilder(..child, restart:)
ChildBuilder(..child, restart: restart)
}

fn convert_child(child: ChildBuilder) -> Dict(Atom, Dynamic) {
Expand Down
9 changes: 2 additions & 7 deletions test/gleam/otp/static_supervisor_test.gleam
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import gleam/erlang/process.{type Pid, type Subject}
import gleam/otp/actor
import gleam/otp/static_supervisor as sup
import gleeunit

pub fn main() {
gleeunit.main()
}

fn actor_child(name name, init init, loop loop) -> sup.ChildBuilder {
sup.worker_child(name, fn() {
let spec = actor.Spec(init:, init_timeout: 10, loop:)
let spec = actor.Spec(init: init, init_timeout: 10, loop: loop)
let assert Ok(subject) = actor.start_spec(spec)
Ok(process.subject_owner(subject))
})
Expand All @@ -22,7 +17,7 @@ fn init_notifier_child(
name: String,
) -> sup.ChildBuilder {
actor_child(
name:,
name: name,
init: fn() {
process.send(subject, #(name, process.self()))
actor.Ready(name, process.new_selector())
Expand Down

0 comments on commit b51788f

Please sign in to comment.