Documentation ¶
Index ¶
- Constants
- Variables
- func AllSlice[A any](f F1[A, bool], xs []A) bool
- func And(a bool, b bool) bool
- func AnySlice[A any](f F1[A, bool], xs []A) bool
- func Apply[A, B any](f F1[A, B], x A) B
- func ConcatSlice[A any](xs []A, ys []A) []A
- func ConcatSlices[A any](xss [][]A) []A
- func Divide[T Number](a T, b T) T
- func EqExample()
- func Example()
- func FilterSlice[A any](f F1[A, bool], xs []A) []A
- func First[A, B any](p *Pair[A, B]) A
- func GreaterThan[T Ord[T]](a T, b T) bool
- func GreaterThanOrEqual[T Ord[T]](a T, b T) bool
- func GroupSlice[A EqOrComparable[A]](xs []A) map[A][]A
- func Id[A any](x A) A
- func Index[T Eq[T]](s []T, e T) int
- func Intercalate[A any](sep []A, xss [][]A) []A
- func Intersperse[A any](sep A, xs []A) []A
- func IsEmptySlice[A any](xs []A) bool
- func LessThan[T Ord[T]](a T, b T) bool
- func LessThanOrEqual[T Ord[T]](a T, b T) bool
- func MapMap[A comparable, B, C any](f F1[B, C], kvs map[A]B) map[A]C
- func MapSlice[A, B any](f F1[A, B], xs []A) []B
- func Max[T Ord[T]](a T, b T) T
- func Merge[A any](xs []A, ys []A, f func(A, A) Ordering) []A
- func MergeSortWithComparator[A any](xs []A, f func(A, A) Ordering) []A
- func Min[T Ord[T]](a T, b T) T
- func Minus[T Number](a T, b T) T
- func NotEqual[T Eq[T]](a T, b T) bool
- func Or(a bool, b bool) bool
- func PartitionSlice[A any](predicate F1[A, bool], xs []A) ([]A, []A)
- func Plus[T Number](a T, b T) T
- func ProductSlice[A Number](xs []A) A
- func ReduceMaybe[A, B any](m *Maybe[A], b B, f F2[B, A, B]) B
- func ReduceSlice[A, B any](f F2[B, A, B], b B, xs []A) B
- func Replicate[A any](count int, item A) []A
- func ReverseSlice[A any](xs []A) []A
- func Second[A, B any](p *Pair[A, B]) B
- func Sort[A Ord[A]](xs []A) []A
- func SortBy[A any](xs []A, f F2[A, A, Ordering]) []A
- func SortOn[A any, B Ord[B]](xs []A, f F1[A, B]) []A
- func SumSlice[A Number](xs []A) A
- func Times[T Number](a T, b T) T
- func UnfoldrSlice[A, B any](f F1[B, *Maybe[*Pair[A, B]]], b B) []A
- type Bool
- type Complex128
- type Complex64
- type Either
- 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[E, A, B any](m *Either[E, A], f func(A) *Either[E, B]) *Either[E, B]
- func Fmap[E, A, B any](m *Either[E, A], f func(a A) B) *Either[E, B]
- func MapError[E1, E2, A any](m *Either[E1, A], f func(E1) E2) *Either[E2, A]
- func NewError[E any, A any](error E) *Either[E, A]
- func NewSuccess[E any, A any](value A) *Either[E, A]
- type Eq
- type EqOrComparable
- type F1
- func Compose[A, B, C any](f F1[B, C], g F1[A, B]) F1[A, C]
- func Const[A, B any](x A) F1[B, A]
- func Partial2[A, B, Z any](f F2[A, B, Z]) F1[A, F1[B, Z]]
- func Partial3[A, B, C, Z any](f F3[A, B, C, Z]) F1[A, F1[B, F1[C, Z]]]
- func Partial4[A, B, C, D, Z any](f F4[A, B, C, D, Z]) F1[A, F1[B, F1[C, F1[D, Z]]]]
- type F2
- type F3
- type F4
- type F5
- type Float32
- type Float64
- type Int
- type Int16
- type Int32
- type Int64
- type Int8
- type List
- type MapEq
- type Maybe
- type Number
- type Ord
- type Ordering
- type Pair
- type Set
- type SliceEq
- type SliceOrd
- type String
- type Uint
- type Uint16
- type Uint32
- type Uint64
- type Uint8
- type Uintptr
- type Unit
Constants ¶
View Source
const ( OrderingLessThan = "OrderingLessThan" OrderingEqual = "OrderingEqual" OrderingGreaterThan = "OrderingGreaterThan" )
Variables ¶
View Source
var UnitC = &Unit{}
Functions ¶
func ConcatSlice ¶ added in v0.0.2
func ConcatSlice[A any](xs []A, ys []A) []A
func ConcatSlices ¶ added in v0.0.2
func ConcatSlices[A any](xss [][]A) []A
func FilterSlice ¶
func GreaterThan ¶
func GreaterThanOrEqual ¶
func GroupSlice ¶ added in v0.0.2
func GroupSlice[A EqOrComparable[A]](xs []A) map[A][]A
func Intercalate ¶ added in v0.0.2
func Intercalate[A any](sep []A, xss [][]A) []A
func Intersperse ¶ added in v0.0.2
func Intersperse[A any](sep A, xs []A) []A
func IsEmptySlice ¶ added in v0.0.2
func LessThanOrEqual ¶
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 MergeSortWithComparator ¶
MergeSortWithComparator needs to be rewritten iteratively TODO
func PartitionSlice ¶ added in v0.0.2
func ProductSlice ¶ added in v0.0.2
func ProductSlice[A Number](xs []A) A
func ReduceMaybe ¶
func ReduceSlice ¶
func ReverseSlice ¶ added in v0.0.2
func ReverseSlice[A any](xs []A) []A
Types ¶
type Complex128 ¶
type Complex128 complex128
func (Complex128) Equal ¶
func (a Complex128) Equal(b Complex128) bool
type Either ¶ added in v0.0.2
func NewSuccess ¶ added in v0.0.2
type EqOrComparable ¶
type EqOrComparable[A Eq[A]] interface { Eq[A] comparable }
EqOrComparable allows us to avoid getting "invalid map key type A (missing comparable constraint)"
errors, if we just used Eq[A] without this additional interface
type F2 ¶
type F2[A, B, Z any] func(A, B) Z
func ComparingP ¶ added in v0.0.3
ComparingP is a partial application of Comparing, fixing the first argument
type MapEq ¶
type MapEq[A EqOrComparable[A], B Eq[B]] map[A]B
type Number ¶ added in v0.0.2
type Number interface { constraints.Integer | constraints.Float }
Number is built out of:
https://pkg.go.dev/golang.org/x/exp@v0.0.0-20220706164943-b4a6d9510983/constraints
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]
type SliceOrd ¶
type SliceOrd[A Ord[A]] []A
Source Files ¶
Click to show internal directories.
Click to hide internal directories.