JasonShin / fp-core.rs

A library for functional programming in Rust
MIT License
1.34k stars 66 forks source link

Monoid -> Semigroup -> Magma refactor #39

Closed JasonShin closed 5 years ago

JasonShin commented 5 years ago

I think we've reached the point where we need to do a proper refactoring around Monoid, Semigroup and Magma.

As a result of introducing the initial baseline for traverse (https://github.com/JasonShin/fp-core.rs/blob/feature%2Ftraverse/fp-core/src/traverse.rs), we need to deal with data structures such as Vectors.

The current algebraic data structure implementations are not scalable, it's already very difficult to extend it to work with Vectors or even HashMap.

The goal of this ticket is to come up with a more scalable alternative to abovementioned data structures and adapt it into the existing type classes that rely on them, pretty much everything that we have built so far.

Ideally, we should structure it so it resembles https://github.com/freebroccolo/algebra.rs

Also, think about the possibility of integrating im.rs for parallelism

Goals:

vec![Some(1), Some(2), Some(3)] with fa of |x| x + 1 and returns Some(vec![2, 3, 4])

JasonShin commented 5 years ago

Didn't include Magma but created a baseline in https://github.com/JasonShin/fp-core.rs/pull/45