Skip to content
Discussion options

You must be logged in to vote

In Gleam you would make a custom type. You could either make a type which translates to the exact same thing, like this:

type LinkResult {
  Ok(Pid)
  Ignore
  Error(Dynamic)
}

However this isn't great as it shadows the Ok and Error constructors of the Result type.

What I would probably do instead is write a short function in elixir, which calls the start_link function, pattern matches on the result, and turns it into a Gleam type which you define that better suits your API. This is also good practise for when the return type doesn't map so neatly to a Gleam type

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@evaogbe
Comment options

@giacomocavalieri
Comment options

@GearsDatapacks
Comment options

@GearsDatapacks
Comment options

@evaogbe
Comment options

Answer selected by evaogbe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants