• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Scala-Robotics-Simulator / PPS-22-srs / #229

08 Aug 2025 11:20AM UTC coverage: 73.348% (+2.2%) from 71.116%
#229

Pull #31

github

davidcohenDC
chore: add clean script to package.json for improved project maintenance
Pull Request #31: feat: model and refactor behavior

37 of 42 new or added lines in 4 files covered. (88.1%)

688 of 938 relevant lines covered (73.35%)

10.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/main/scala/io/github/srs/model/entity/dynamicentity/behavior/BehaviorTypes.scala
1
package io.github.srs.model.entity.dynamicentity.behavior
2

3
import cats.Id
4
import cats.data.Kleisli
5
import io.github.srs.model.entity.dynamicentity.*
6

7
/**
8
 * Types used by the Behavior DSL and policy.
9
 *
10
 * All aliases are kept package-internal so they do **not** be part of the public namespace
11
 */
12
private[behavior] object BehaviorTypes:
NEW
13

×
14
  /**
15
   * **Behavior** – a pure function in any effect [[F]].
16
   *
17
   * @param F
18
   *   effect type (e.g. [[Id]], [[IO]])
19
   * @param I
20
   *   input.
21
   * @param A
22
   *   output.
23
   */
24
  type Behavior[F[_], I, A] = Kleisli[F, I, A]
25

26
  /**
27
   * Shorthand for a pure rule (no effect).
28
   *
29
   * A rule that operates without any effect, using the [[Id]] type.
30
   *
31
   * @param I
32
   *   The input type.
33
   * @param A
34
   *   The output type.
35
   */
36
  type BehaviorId[I, A] = Behavior[Id, I, A]
37

38
  /**
39
   * **Rule** – “may decide”.
40
   *
41
   * Represents a rule that takes an input [[I]] and may produce an output [[A]] wrapped in an [[Option]]. If the rule
42
   * produces [[Some(action)]], it has fired; otherwise, it defers to the next rule.
43
   *
44
   * @param F
45
   *   The effect type (e.g., [[Id]], [[IO]]).
46
   * @param I
47
   *   The input type.
48
   * @param A
49
   *   The output type.
50
   */
51
  type Rule[F[_], I, A] = Kleisli[F, I, Option[A]]
52

53
  /**
54
   * Shorthand for a pure rule (no effect).
55
   *
56
   * A rule that operates without any effect, using the [[Id]] type.
57
   *
58
   * @param I
59
   *   The input type.
60
   * @param A
61
   *   The output type.
62
   */
63
  type RuleId[I, A] = Rule[Id, I, A]
64

65
  /**
66
   * Boolean predicate on the policy input.
67
   *
68
   * Represents a condition that evaluates to `true` or `false` based on the input [[I]].
69
   *
70
   * @param I
71
   *   The input type.
72
   */
73
  type Condition[I] = I => Boolean
74

75
  /**
76
   * Constant predicate that is always `true`.
77
   */
78
  val always: Condition[Any] = _ => true
79
end BehaviorTypes
10✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc