Skip to content

Commit

Permalink
Some minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
johanhaleby committed Oct 31, 2023
1 parent 0c5f369 commit 79e828e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import java.util.*

fun <C, S, E> decider(initialState: S?, decide: (C, S?) -> List<E>, evolve: (S?, E) -> S, isTerminal: (S?) -> Boolean = { false }): Decider<C, S, E> = Decider.create(initialState, decide, evolve, isTerminal)

@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
fun <C, S, E> Decider<C, S, E>.decide(events: List<E>, command: C): Decider.StateChanges<S, E> = decide(events, command)

operator fun <S, E> Decider.StateChanges<S, E>.component1() = state
operator fun <S, E> Decider.StateChanges<S, E>.component2() = events
operator fun <S, E> Decider.StateChanges<S, E>.component1() : S? = state
operator fun <S, E> Decider.StateChanges<S, E>.component2() : List<E> = events


fun <C, S, E> ApplicationService<E>.execute(streamId: String, c: C, decider: Decider<C, S, E>) = execute(streamId) { events: List<E> ->
Expand Down

0 comments on commit 79e828e

Please sign in to comment.