ex_stdlib
Elixir-inspired standard library modules implemented in Erlang.
Overview
This project provides Erlang implementations of useful modules from Elixir's standard library, bringing modern functional programming patterns and concurrent programming abstractions to Erlang.
Modules
Core Modules
agent- Simple state management abstraction around GenServertask- Asynchronous task execution with async/await, await_many/yield_many and async_streamtask_supervisor- Dynamic supervisor for tasks, with linked and unlinked async tasksregistry- Local, decentralized key-value process storage for service discovery and pub-sub (usable as{via, registry, Name})process- Convenient process management utilities and wrapperskeyword- Keyword list operations and utilities inspired by Elixiruri- URI parsing, manipulation, and encoding/decoding utilitiesbase- Base16, Base32, and Base64 encoding/decoding with multiple variantspath- Cross-platform file system path manipulation and utilitiesfunction- Function utilities including composition, currying, and memoizationdynamic_supervisor- Dynamic supervisor optimized for millions of childrenpartition_supervisor- Supervisor that starts multiple partitions of the same childversion- Semantic version parsing, comparison and requirement matching (~> 1.2,>= 1.0.0 and < 2.0.0)tuple- Tuple utilitiesbitwise- Bitwise operations
Features
- Type-safe: Complete
-specannotations for all functions - Well-documented: Comprehensive EDoc documentation with examples
- Battle-tested: Extensive test suites covering edge cases and error conditions
- Production-ready: Follows OTP best practices and Erlang coding conventions
Quick Start
Build
rebar3 compile
Run Tests
rebar3 eunit
Examples
See the examples/ directory for usage examples, or start an Erlang shell:
erl -pa _build/default/lib/ex_stdlib/ebin
% Agent example - simple state management
{ok, Agent} = agent:start_link(fun() -> 0 end).
agent:update(Agent, fun(State) -> State + 1 end).
1 = agent:get(Agent, fun(State) -> State end).
% Task example - async/await
Task = task:async(fun() -> expensive_computation() end).
OtherResult = do_other_work().
TaskResult = task:await(Task).
Project Structure
ex_stdlib/
├── src/ # Core library modules
├── test/ # EUnit test suites
├── examples/ # Usage examples
└── _build/ # Compiled artifacts
Documentation
For detailed API documentation, see individual module documentation in the source files or generate with:
rebar3 edoc