***

title: Functional Core (C++)
description: Support types used by the current store/thunk runtime
slug: ue/functional-core
------------------------

`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:

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

## `AsyncResult<T>` In Practice

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

```cpp
auto Task = Store.dispatch(rtk::getSoulListThunk(20));

Task.then([](const TArray<FSoulListItem>& Souls) {
      UE_LOG(LogTemp, Display, TEXT("%d"), Souls.Num());
    })
    .catch_([](std::string Error) {
      UE_LOG(LogTemp, Error, TEXT("%s"), UTF8_TO_TCHAR(Error.c_str()));
    });

Task.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.
