The evalution of the Ast is performed by HXL.Eval it does not expose the internal do_eval/2 functions which does the actual evaluation. Define a new behaviour HXL.Evaluator and provide a base implementation of HXL.Evaluator i.e the same functionality as in HXL.Eval. Allow for specifying a custom evaluator adapter in the decode/2 functions.
Something like:
defmodule HXL.Evaluator do
defmodule Ctx do
defstruct [:functions, :key_encoder, document: %{}, symbol_table: %{}]
@type t :: %__MODULE__{
document: map(),
functions: map(),
symbol_table: map(),
key_encoder: (binary -> term())
}
end
@callback eval(HXL.Ast.t(), Ctx.t()) :: Ctx.t()
end
The evalution of the Ast is performed by
HXL.Eval
it does not expose the internaldo_eval/2
functions which does the actual evaluation. Define a new behaviourHXL.Evaluator
and provide a base implementation ofHXL.Evaluator
i.e the same functionality as inHXL.Eval
. Allow for specifying a custom evaluator adapter in thedecode/2
functions.Something like:
Ref #4