All Projects → bkase → swift-di-explorations

bkase / swift-di-explorations

Licence: other
Functional DI explorations in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to swift-di-explorations

Typhoon
Powerful dependency injection for Objective-C ✨✨ (https://PILGRIM.PH is the pure Swift successor to Typhoon!!)✨✨
Stars: ✭ 2,711 (+9582.14%)
Mutual labels:  dependency-injection, di
Alfa
Effortless React State Management.
Stars: ✭ 86 (+207.14%)
Mutual labels:  functional, dependency-injection
func-dependency-injection-go
Dependency injection example using higher order functions
Stars: ✭ 26 (-7.14%)
Mutual labels:  functional, dependency-injection
Ray.di
Guice style dependency injection framework for PHP
Stars: ✭ 175 (+525%)
Mutual labels:  dependency-injection, di
stashbox
A lightweight, fast, and portable dependency injection framework for .NET-based solutions.
Stars: ✭ 120 (+328.57%)
Mutual labels:  dependency-injection, di
Ulfberht
🗡️ A small but powerful & opinionated DI library. Written in Kotlin, and powered by annotation processing.
Stars: ✭ 234 (+735.71%)
Mutual labels:  dependency-injection, di
trembita
Model complex data transformation pipelines easily
Stars: ✭ 44 (+57.14%)
Mutual labels:  functional, typesafe
Deli
Deli is an easy-to-use Dependency Injection(DI).
Stars: ✭ 125 (+346.43%)
Mutual labels:  dependency-injection, di
DI-compiler
A Custom Transformer for Typescript that enables compile-time Dependency Injection
Stars: ✭ 62 (+121.43%)
Mutual labels:  dependency-injection, di
Koin Samples
KOIN - a concise and pragmatic dependency injection framework for Kotlin -- #Samples
Stars: ✭ 200 (+614.29%)
Mutual labels:  functional, dependency-injection
Dig
A reflection based dependency injection toolkit for Go.
Stars: ✭ 2,255 (+7953.57%)
Mutual labels:  dependency-injection, di
awilix-express
Awilix helpers/middleware for Express
Stars: ✭ 100 (+257.14%)
Mutual labels:  dependency-injection, di
Hiboot
hiboot is a high performance web and cli application framework with dependency injection support
Stars: ✭ 150 (+435.71%)
Mutual labels:  dependency-injection, di
trew
A fast and very lightweight dependency injection library for Java 8+
Stars: ✭ 34 (+21.43%)
Mutual labels:  dependency-injection, di
Di
PSR-11 compatible DI container and injector
Stars: ✭ 141 (+403.57%)
Mutual labels:  dependency-injection, di
pyroclastic
Functional dataflow through composable computations
Stars: ✭ 17 (-39.29%)
Mutual labels:  functional, typesafe
Di
psr/container implementation for humans
Stars: ✭ 69 (+146.43%)
Mutual labels:  dependency-injection, di
Container Ioc
Inversion of Control container & Dependency Injection for Javascript and Node.js apps powered by Typescript.
Stars: ✭ 89 (+217.86%)
Mutual labels:  dependency-injection, di
Chaos
The Chaos Programming Language
Stars: ✭ 171 (+510.71%)
Mutual labels:  functional, typesafe
waiter
Dependency injection, Inversion of control container for rust with compile time binding.
Stars: ✭ 71 (+153.57%)
Mutual labels:  dependency-injection, di

Functional DI Solutions in Swift

Our code has dependencies. We would like to not directly invoke code that uses side-effecting singleton-esque services because our code becomes harder to reason about, harder to test, etc. It would be nice to decouple the effects.

Dependency injection is about decoupling your code from your effects. In traditional OO languages, it's tough to get a compile-time-checked type-safe DI solution working, but Swift is functional(ish).

This repository explores the "functional" solutions to DI that are used in other functional languages (Scala, Haskell, etc)

Understanding the solutions

In this repo, every implemenation must declare a dependency on some datastore that has the capability to get a string key-value pair given a string key, and set arbitrary key-value pairs given a key and a value.

In all cases, we define a simple program that sets a key-value pair, and then gets that key and uses it to say "hello".

The programs are declared here in literate Swift:

Cake pattern

Reader Monad

Free Monad

The programs are then all evaluated in this

Test file

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].