View Source Babel.Step behaviour (Babel v1.2.0)

This module is meant to be used to create your own Babel custom steps, and is used internally to create all of Babel's built-in steps.

It's required that any module which uses Babel.Step defines a struct.

What happens when I use Babel.Step?

Your struct will:

  1. implement the Babel.Step behaviour (apply/2)
  2. implement the Babel.Applicable protocol, whose invocations delegate to apply/2

Inspect

If you'd like to customize the inspect/2 rendition of your custom Babel.Step, you can use Babel.Step, inspect: true; this will implement the Inspect protocol and delegate all invocations to inspect/2.

Summary

Types

t()

An implementation of this behaviour.

An implementation of this behaviour whose apply/2 function produces the specified output.

An implementation of this behaviour whose apply/2 function accepts the given input and produces the specified output.

Types

@type result(output) :: output | {:ok, output} | :error | {:error, reason :: any()}
Link to this type

result_or_trace(output)

View Source
@type result_or_trace(output) :: result(output) | Babel.Trace.t(output)
@type t() :: t(any())

An implementation of this behaviour.

@type t(output) :: t(any(), output)

An implementation of this behaviour whose apply/2 function produces the specified output.

@type t(_input, _output) :: any()

An implementation of this behaviour whose apply/2 function accepts the given input and produces the specified output.

Callbacks

@callback apply(t(output), Babel.Context.t()) :: result_or_trace(output)
when output: any()
Link to this callback

inspect(t, t)

View Source (optional)
@callback inspect(t(), Inspect.Opts.t()) :: Inspect.Algebra.t()