package
module
Version:
v0.0.0-...-e05dd65
Opens a new window with list of versions in this module.
Published: Aug 24, 2024
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Functional programming library for golang
Features
- Map
- Filter
- Reduce
- Currying
- Partial Application
- Memorize
- Monads
[!IMPORTANT]
This is a work-in-progress library. The functionility and structure might change as it's being developed
Documentation
¶
func Filter[I any](i []I, p Predicate[I]) []I
func Reduce[T1, T2 any](i []T1, seed T2, acc Accumulator[T2, T1]) T2
type Accumulator[R, I any] func(R, I) R
type Either[R any] struct {
Right R
Left error
}
TODO: Either[R, L any] for more generic options
func NewEither[R any](r R, l error) Either[R]
func (e Either[R]) Bind(b func(R) Either[R]) Either[R]
type Function[I, O any] func(I) O
func (m Maybe[T]) Bind(b BindFn[T]) Monad[T]
type Monad[T any] interface {
Bind(BindFn[T]) Monad[T]
}
type Try[T any] struct {
Result T
Err error
}
TODO: Bind with Monad generic interface
func NewTry[T any](t T, err error) Try[T]
func (t Try[T]) Bind(b func(T) Try[T]) Try[T]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.