AshGleam.GleamBridge
(ash_gleam v0.4.0)
Copy Markdown
Standalone DSL for bidirectional Elixir↔Gleam function bridging.
Exposes Elixir functions to Gleam (expose) and makes Gleam functions
callable from Elixir (consume).
defmodule MyApp.Math do
use AshGleam.GleamBridge
gleam do
consume do
function :add_in_gleam, :integer do
argument :a, :integer, allow_nil?: false
argument :b, :integer, allow_nil?: false
run &:gleam_module.add/2
end
end
expose do
function :add_in_elixir, :integer do
argument :a, :integer, allow_nil?: false
argument :b, :integer, allow_nil?: false
run fn a, b -> {:ok, a + b} end
end
end
end
endOptions
:extensions(list of module that adoptsSpark.Dsl.Extension) - A list of DSL extensions to add to theSpark.Dsl:otp_app(atom/0) - The otp_app to use for any application configurable options:fragments(list ofmodule/0) - Fragments to include in theSpark.Dsl. See the fragments guide for more.