io.github.srs.model.entity.dynamicentity.behavior.dsl

Members list

Type members

Classlikes

object BehaviorDsl

Minimal DSL to build decision logic:

Behavior DSL (pure)

Minimal DSL to build decision logic:

  • PartialBehavior = Kleisli[Option, I, A] – a partial decision (“may produce”).
  • Behavior = Kleisli[Id, I, A] – a total decision (“always produces”).

Partial behaviors compose left-biased (the first Some wins) and are finalized into total behaviors via orElse (or the compatibility alias default).

Attributes

Example
val isEven: Condition[Int] = _ % 2 == 0
val rule: PartialBehavior[Int, String] =
 (isEven ==> "even") | (_ => true) ==> "odd"
val behavior: Behavior[Int, String] =
 rule.orElse("n/a")
behavior.run(2)  // "even"
behavior.run(3)  // "odd"
Supertypes
class Object
trait Matchable
class Any
Self type