# louthy/language-ext architecture

> Architecture diagram of the GitHub repository louthy/language-ext, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/louthy/language-ext
- Repository: https://github.com/louthy/language-ext

## Overview

##### Main Components

**┌─ Core Framework Layer ─────────────────────────────────────┐**
- ┌─ Functional Effects ─┐ ┌─ Collections ──────────────┐   │
- IO             │ │ - Immutable Collections     │   │
- Eff            │ │ - Atomic Collections        │   │
- Eff<RT, A>        │ │ - Concurrent Collections    │   │
- Pipes             │ └────────────────────────────┘   │
- StreamT           │                                  │
- ┘                                   │

- ┌─ Monads ───────────┐ ┌─ Traits System ────────────┐   │
- Option        │ │ - Higher-Kinded Types      │   │
- Either<L,R>      │ │ - Type Classes             │   │
- Try           │ │ - Value Traits             │   │
- State<S,A>       │ └────────────────────────────┘   │
- ┘                                   │
- ┘

**┌─ Extension Modules ──────────────────────────────────────┐**
- ┌─ Parsec ─────────┐ ┌─ Sys ─────────┐ ┌─ Rx ─────────┐ │
- Parser           │ │ System IO      │ │ Reactive     │ │
- Combinators      │ │ Effects       │ │ Extensions    │ │
- ┘ └───────────────┘ └─────────────┘ │
- ┘

##### Component Relationships

- Core Framework Layer components interact through the Traits System
- Extension Modules depend on Core Framework Layer
- Effects system interacts with Collections through Atomic operations
- Monads can be transformed and composed using Monad Transformers

##### Important Elements

a. Core Framework Components:
- Effects System (IO, Eff)
- Collection Hierarchies
- Monad Implementations
- Traits System

b. Extension Points:
- Parser Combinators
- System IO Effects
- Reactive Extensions Integration

c. Cross-Cutting Concerns:
- Type Safety through Traits
- Immutability
- Concurrency Control

##### Implementation Details to Note

Key architectural patterns:
- Higher-kinded type system implementation
- Effect composition and transformation
- Collection hierarchy relationships
- Monad transformer stack capabilities

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CoreFramework["Core Framework Layer"]
        subgraph Effects["Functional Effects"]
            IO["IO<A>"]:::effects
            Eff["Eff<A>"]:::effects
            EffRT["Eff<RT, A>"]:::effects
            Pipes["Pipes"]:::effects
            StreamT["StreamT"]:::effects
        end

        subgraph Collections["Collections"]
            ImmutableCol["Immutable Collections"]:::collections
            AtomicCol["Atomic Collections"]:::collections
            ConcurrentCol["Concurrent Collections"]:::collections
        end

        subgraph Monads["Monads"]
            Option["Option<A>"]:::monads
            Either["Either<L,R>"]:::monads
            Try["Try<A>"]:::monads
            State["State<S,A>"]:::monads
        end

        subgraph Traits["Traits System"]
            HKT["Higher-Kinded Types"]:::traits
            TypeClasses["Type Classes"]:::traits
            ValueTraits["Value Traits"]:::traits
        end
    end

    subgraph Extensions["Extension Modules"]
        subgraph Parsec["Parsec"]
            Parser["Parser"]:::extension
            Combinators["Combinators"]:::extension
        end

        subgraph Sys["Sys"]
            SystemIO["System IO"]:::extension
            SysEffects["Effects"]:::extension
        end

        subgraph Rx["Rx"]
            Reactive["Reactive Extensions"]:::extension
        end
    end

    %% Relationships
    Traits --> Effects
    Traits --> Collections
    Traits --> Monads
    Effects --> Collections
    Extensions --> CoreFramework
    Monads --> Effects
    
    %% Click Events
    click Effects "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Effects"
    click IO "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Effects/IO"
    click Eff "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Effects/Eff"
    click StreamT "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Effects/StreamT"
    click Collections "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Immutable Collections"
    click AtomicCol "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Concurrency/Atom"
    click ConcurrentCol "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Concurrency"
    click Option "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Monads/Alternative Monads/Option"
    click Either "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Monads/Alternative Monads/Either"
    click Try "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Monads/Alternative Monads/Try"
    click State "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Monads/State and Environment Monads"
    click Traits "https://github.com/louthy/language-ext/tree/main/LanguageExt.Core/Traits"
    click Parsec "https://github.com/louthy/language-ext/blob/main/LanguageExt.Parsec"
    click Sys "https://github.com/louthy/language-ext/blob/main/LanguageExt.Sys"
    click Rx "https://github.com/louthy/language-ext/blob/main/LanguageExt.Rx"

    %% Styles
    classDef effects fill:#2196F3,stroke:#1565C0,color:white
    classDef collections fill:#4CAF50,stroke:#2E7D32,color:white
    classDef monads fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef traits fill:#FFC107,stroke:#FFA000,color:black
    classDef extension fill:#757575,stroke:#424242,color:white

    %% Legend
    subgraph Legend
        L1["Effects"]:::effects
        L2["Collections"]:::collections
        L3["Monads"]:::monads
        L4["Traits"]:::traits
        L5["Extensions"]:::extension
    end
```
