Skip to content

Guides

This section provides in-depth guides for working with Haiway's core concepts and patterns.

Core Concepts

State Management

Learn how to work with Haiway's immutable state system, including:

  • Defining state classes with type validation
  • Working with immutability and updates
  • Using generic state types
  • Path-based updates for nested structures
  • Performance considerations

Functionalities

Understand Haiway's functional programming approach:

  • Protocol-based function interfaces
  • Dependency injection through context
  • Factory patterns for implementations
  • Organizing business logic functionally
  • Complete example: Notes management system

Packages

Structure larger applications effectively:

  • Module organization patterns
  • Package boundaries and interfaces
  • Composing functionalities
  • Managing dependencies between packages

Configuration Management

Simple type-safe configuration with automatic defaults:

  • Define configuration classes with State
  • Load configurations from various backends
  • Automatic fallback to class defaults

Concurrent Processing

Master concurrent and parallel processing patterns:

  • Structured concurrency with task spawning
  • Context preservation across tasks
  • Concurrent processing helpers
  • Streaming multiple sources
  • Performance optimization strategies

Learning Path

  1. Start with State - Understanding immutable state is fundamental to using Haiway effectively
  2. Learn Functionalities - See how to organize business logic using functional patterns
  3. Manage Configuration - Handle application configuration with type safety and automatic defaults
  4. Master Concurrency - Build high-performance applications with concurrent processing
  5. Scale with Packages - Apply these concepts to structure larger applications