Functional Core (C++)

View as Markdown

functional_core.hpp is still part of the UE plugin, but in the current SDK it primarily supports the store/thunk runtime rather than replacing it with a separate public architecture.

Core Helper Types

  • func::Maybe<T>: optional values used by selectors
  • func::Either<L, R>: validation and result composition
  • func::AsyncResult<T>: async thunk completion type
  • func::TestResult<T>: command/test success and failure wrapper
  • func::ValidationPipeline<I, O>: command validation and composition helper

Maybe<T> In Practice

Selectors use Maybe when an entity may not exist:

1const auto Active = NPCSlice::SelectActiveNPC(Store.getState().NPCs);
2if (Active.hasValue) {
3 UE_LOG(LogTemp, Display, TEXT("%s"), *Active.value.Id);
4}

AsyncResult<T> In Practice

Direct thunk dispatch returns func::AsyncResult<T>:

1auto Task = Store.dispatch(rtk::getSoulListThunk(20));
2
3Task.then([](const TArray<FSoulListItem>& Souls) {
4 UE_LOG(LogTemp, Display, TEXT("%d"), Souls.Num());
5 })
6 .catch_([](std::string Error) {
7 UE_LOG(LogTemp, Error, TEXT("%s"), UTF8_TO_TCHAR(Error.c_str()));
8 });
9
10Task.execute();

ValidationPipeline In Practice

The current commandlet uses ValidationPipeline to reject unsupported commands before dispatch.

If you build your own tooling layer, these helpers remain useful. If you just want to integrate the SDK, stay at the store/thunk or SDKOps level.