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

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

21 Aug 2025 10:21AM UTC coverage: 56.775% (-0.2%) from 56.971%
#320

push

github

srs-mate
refactor(behavior)!: removed policy and rules

1081 of 1904 relevant lines covered (56.78%)

7.94 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
 * Core types for the Behavior DSL
9
 *
10
 *   - [[Behavior]] — total, pure decision (`I => A` via `Kleisli[Id, I, A]`)
11
 *   - [[PartialBehavior]] — partial decision (`I => Option[A]` via `Kleisli[Option, I, A]`)
12
 *   - [[Condition]] — boolean predicate on the input
13
 *
14
 * Partial behaviors compose left-biased (first `Some` wins) and are finalized into total behaviors via the DSL’s
15
 * orElse.
16
 */
17
object BehaviorTypes:
18

×
19
  /**
20
   * Total, pure decision (Reader specialized to `Id`).
21
   *
22
   * @param I
23
   *   input type
24
   * @param A
25
   *   output type
26
   */
27
  type Behavior[I, A] = Kleisli[Id, I, A]
28

29
  /**
30
   * Partial decision: returns `Some(a)` if it fires, otherwise `None`.
31
   *
32
   * @param I
33
   *   input type
34
   * @param A
35
   *   output type
36
   */
37
  type PartialBehavior[I, A] = Kleisli[Option, I, A]
38

39
  /**
40
   * Boolean predicate on the input.
41
   *
42
   * @param I
43
   *   input type
44
   */
45
  type Condition[I] = I => Boolean
46

47
  /**
48
   * Constant predicate that always evaluates to `true`.
49
   *
50
   * @return
51
   *   a condition that ignores its input and returns `true`
52
   */
53
  val always: Condition[Any] = _ => true
54
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