pkg

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnitC = &Unit{}

Functions

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 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[A any, K comparable] struct {
	Elems      map[K]A
	Projection func(A) K
}

func NewSet added in v0.0.2

func NewSet[A comparable](elems []A) *Set[A, A]

func NewSetBy added in v0.1.2

func NewSetBy[A any, K comparable](projection func(A) K, elems []A) *Set[A, K]

func (*Set[A, K]) Add added in v0.0.2

func (s *Set[A, K]) Add(a A)

func (*Set[A, K]) Contains added in v0.0.2

func (s *Set[A, K]) Contains(a A) bool

func (*Set[A, K]) Delete added in v0.0.2

func (s *Set[A, K]) Delete(a A)

func (*Set[A, K]) Len added in v0.0.2

func (s *Set[A, K]) Len() int

func (*Set[A, K]) ToSlice added in v0.0.2

func (s *Set[A, K]) ToSlice() []A

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