Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Event Sourcing as 3 functions.
f(events) -> state
match f(state, event) -> state
f(state, command) -> events
@fride

This comment has been minimized.

Copy link

@fride fride commented Jun 25, 2015

I'm not sure about the semantics of ' match f(state, event) -> state'. Care to explain?

@jbrains

This comment has been minimized.

Copy link

@jbrains jbrains commented Jun 25, 2015

I'm guessing it's "figure out which ones of events apply to state, then apply it."

@fride

This comment has been minimized.

Copy link

@fride fride commented Jun 30, 2015

Sounds sensible.

@kijanawoodard

This comment has been minimized.

Copy link

@kijanawoodard kijanawoodard commented Jul 8, 2015

Given a state and a event, produce a new state

match is how you progress through the collection of events - f(events)

@gregoryyoung

This comment has been minimized.

Copy link
Owner Author

@gregoryyoung gregoryyoung commented Jul 30, 2015

@kijanawoodard yes.

in some systems it may even be more complex than just match by type (see erlang/haskell)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.