You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2025. It is now read-only.
module Events =
type Color =
| Red
| Green
| Blue
| Yellow
type Card =
| Digit of int * Color
type GameStartedEvent = {GameId: int; PlayerCount:int; TopCard: Card}
type CardPlayedEvent = {GameId: int; Player:int; Card: Card}
type Event =
| GameStarted of Events.GameStartedEvent
| CardPlayed of Events.CardPlayedEvent
(There is no Deck.fs)
I did this for the following reasons:
too many types are exposed publically (manifests in intellisense in tests)
because event layouts are schemas I think they should be considered as a whole when designing
people should be aware they're playing with a contract as they change types
it's good to be confronted with the fact that Commands are sharing types
The Event type summarises stuff well while not becoming illegible e.g. if you get to 20 events (and have dependencies interspersed with ands etc).
Any thoughts re
me (or you) doing a PR to apply this same strategy here? (I'd probably gobble Deck.fs too)
removing the Command's reliance on the Events. nested types (I think I'd leave it fr later)
And, wrt #2, should 1) instead push the Events stuff into an Events.fs in preparation for the events of all aggregates being consolidated in a single place?