Commit cb70144f authored by Massimo Costantini's avatar Massimo Costantini
Browse files

Updated comment

parent 63c47a07
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ Together, these standards enable interoperable access to astronomical datasets w

The codebase adopts a Haskell-like programming model, embracing **pure functional** programming principles. The design is **language-agnostic**, meaning the business logic can be implemented consistently across different languages and runtimes.

This system enforces an explicit separation between **pure computations** and **impure side effects**, following established functional programming paradigms. Side effects (e.g., file I/O, networking, and database access) are modeled in a controlled and isolated way using **implicit continuation-passing style (CPS)**.
This model enforces an explicit separation between **pure computations** and **impure side effects**, following established functional programming paradigms. Side effects (e.g., file I/O, networking, and database access) are modeled in a controlled and isolated way using **implicit continuation-passing style (CPS)**.

In this model, all effectful computations are represented as higher-order functions.
All effectful computations are represented as higher-order functions.

### Type Signature Examples

@@ -28,13 +28,11 @@ In this model, all effectful computations are represented as higher-order functi
def handler(req: Req) -> Callable[[IO], Awaitable[T]]
```

In these examples:
In these examples, illustrating the conceptual and syntactic equivalence of the functional signatures:
- `req` contains the pure input data (e.g., HTTP request or SQL parameters),
- `IO` is a token representing the **impure world** and must be explicitly passed to authorize the execution of effects.
- The return value (`Promise<T>` or `Awaitable[T]`) represents an asynchronous computation that eventually produces a value of type `T`.

These functions **do not** perform any side effects immediately. Instead, they return deferred computations that only execute once the `IO` token is provided.

### Code Examples

**JavaScript version:**
@@ -55,14 +53,15 @@ def put_str(text) -> Callable[[object], Awaitable[None]]:
    return inner
```

These examples define side-effecting operations (`console.log` and `print`) that remain **pure descriptions** until explicitly invoked with the `IO` token. This mirrors the behavior of `IO` in languages like Haskell.
These functions **do not** perform any side effects immediately. Instead, they return deferred computations that only execute once the `IO` token is provided.
Side-effecting operations (`console.log` and `print`) remain **pure descriptions** until explicitly invoked with the `IO` token. This mirrors the behavior of `IO` in languages like Haskell.

## Language-Agnostic and Portable Design

All core abstractions (e.g., `InternalError`, `IO`, and `Maybe`) are designed to be **language-agnostic** and consistent in semantics. Business logic is also **runtime-agnostic**, as it is decoupled from specific platforms like Node.js or Python.

The code can be ported to any language that supports:
- First-class (including higher-order) functions
- Higher-order functions
- Asynchronous operations (e.g., `Promise<T>` in JavaScript or `Callable[[IO], Awaitable[T]]` in Python)

This design promotes **long-term maintainability**, **code reuse**, and **portability** across ecosystems.