pkg

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnitC = &Unit{}

Functions

func GroupSlice added in v0.0.2

func GroupSlice[A EqOrComparable[A]](xs []A) map[A][]A

func MapMap added in v0.0.2

func MapMap[A comparable, B, C any](f F1[B, C], kvs map[A]B) map[A]C

func ReduceMaybe

func ReduceMaybe[A, B any](m *Maybe[A], b B, f F2[B, A, B]) B

Types

type Either added in v0.0.2

type Either[E any, A any] struct {
	Success *A
	Error   *E
}

func App2 added in v0.0.2

func App2[E, A, B, C any](f func(A, B) C, m1 *Either[E, A], m2 *Either[E, B]) *Either[E, C]

func Bind added in v0.0.2

func Bind[E, A, B any](m *Either[E, A], f func(A) *Either[E, B]) *Either[E, B]

func Fmap added in v0.0.2

func Fmap[E, A, B any](m *Either[E, A], f func(a A) B) *Either[E, B]

func MapError added in v0.0.2

func MapError[E1, E2, A any](m *Either[E1, A], f func(E1) E2) *Either[E2, A]

func NewError added in v0.0.2

func NewError[E any, A any](error E) *Either[E, A]

func NewSuccess added in v0.0.2

func NewSuccess[E any, A any](value A) *Either[E, A]

func (*Either[E, A]) IsValid added in v0.0.2

func (e *Either[E, A]) IsValid() bool

IsValid is a debugging check

func (*Either[E, A]) Plus added in v0.0.2

func (e *Either[E, A]) Plus(other *Either[E, A]) *Either[E, A]

type List

type List[A any] struct {
	Head A
	Tail *List[A] // TODO use maybe
}

func NewList

func NewList[A any](xs []A) *List[A]

type Maybe

type Maybe[A any] struct {
	Value *A
}

func BindMaybe

func BindMaybe[A, B any](m *Maybe[A], f F1[A, *Maybe[B]]) *Maybe[B]

func FilterMaybe

func FilterMaybe[A any](m *Maybe[A], f F1[A, bool]) *Maybe[A]

func Just

func Just[A any](a A) *Maybe[A]

func MapMaybe

func MapMaybe[A, B any](f F1[A, B], m *Maybe[A]) *Maybe[B]

func Nothing

func Nothing[A any]() *Maybe[A]

func (*Maybe[A]) Default added in v0.0.2

func (m *Maybe[A]) Default(defaultValue A) A

type Set added in v0.0.2

type Set[T EqOrComparable[T]] struct {
	Elems map[T]bool
}

func NewSet added in v0.0.2

func NewSet[T EqOrComparable[T]](elems []T) *Set[T]

func (*Set[T]) Add added in v0.0.2

func (s *Set[T]) Add(a T)

func (*Set[T]) Contains added in v0.0.2

func (s *Set[T]) Contains(a T) bool

func (*Set[T]) Delete added in v0.0.2

func (s *Set[T]) Delete(a T)

func (*Set[T]) Len added in v0.0.2

func (s *Set[T]) Len() int

func (*Set[T]) ToSlice added in v0.0.2

func (s *Set[T]) ToSlice() []T

type Unit

type Unit struct{}

Unit represents the Haskell value `()`

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL