Permit.Operators.GenOperator behaviour (permit v0.3.0)
View SourceGeneric operator behaviour. For each operator, it allows defining:
- the main symbol (e.g.
:==
) - alternative and equivalent symbols (e.g.
:eq
) - semantics function builders, returning functions to determine whether the operator is truthy or falsy.
Part of the private API, subject to changes and not to be used on the application level.
Summary
Types
@type condition_fn() :: Permit.Types.ConditionTypes.fn1_condition() | Permit.Types.ConditionTypes.fn2_condition()
@type operator_result() :: (Permit.Types.struct_field(), Permit.Types.subject(), Permit.Types.object() -> boolean())
Callbacks
@callback alternatives() :: [atom()]
@callback semantics(condition_fn()) :: operator_result()
@callback semantics( condition_fn(), keyword() ) :: operator_result()
@callback symbol() :: atom()