package
Version:
v0.0.1
Opens a new window with list of versions in this module.
Published: Jul 11, 2022
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
- Constants
- Variables
-
func Apply[A, B any](f F1[A, B], x A) B
-
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 Id[A any](x A) A
-
func Index[T Eq[T]](s []T, e T) int
-
func LessThan[T Ord[T]](a T, b T) bool
-
func LessThanOrEqual[T Ord[T]](a T, b T) bool
-
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 MergeSort[A Ord[A]](xs []A) []A
-
func MergeSortWithComparator[A any](xs []A, f func(A, A) Ordering) []A
-
func Min[T Ord[T]](a T, b T) T
-
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 Second[A, B any](p *Pair[A, B]) B
-
type Bool
-
type Complex128
-
type Complex64
-
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, C any](f F2[A, B, C]) F1[A, F1[B, C]]
-
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 Ord
-
type Ordering
-
type Pair
-
type SliceEq
-
type SliceOrd
-
type String
-
type Uint
-
type Uint16
-
type Uint32
-
type Uint64
-
type Uint8
-
type Unit
View Source
const (
OrderingLessThan = "OrderingLessThan"
OrderingEqual = "OrderingEqual"
OrderingGreaterThan = "OrderingGreaterThan"
)
func Apply[A, B any](f F1[A, B], x A) B
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 Index[T Eq[T]](s []T, e T) int
func LessThan[T Ord[T]](a T, b T) bool
func LessThanOrEqual[T Ord[T]](a T, b T) bool
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
Merge needs to be rewritten iteratively TODO
func MergeSort[A Ord[A]](xs []A) []A
func MergeSortWithComparator[A any](xs []A, f func(A, A) Ordering) []A
MergeSortWithComparator needs to be rewritten iteratively TODO
func Min[T Ord[T]](a T, b T) T
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 Second[A, B any](p *Pair[A, B]) B
type Eq[T any] interface {
Equal(T) bool
}
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 F1[A, Z any] func(A) Z
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, C any](f F2[A, B, C]) F1[A, F1[B, C]]
type F2[A, B, Z any] func(A, B) Z
func Flip[A, B, C any](f F2[A, B, C]) F2[B, A, C]
type F3[A, B, C, Z any] func(A, B, C) Z
type F4[A, B, C, D, Z any] func(A, B, C, D) Z
type F5[A, B, C, D, E, Z any] func(A, B, C, D, E) Z
type List[A any] struct {
Head A
Tail *List[A]
}
func NewList[A any](xs []A) *List[A]
type Maybe[A any] struct {
Value *A
}
type Pair[A, B any] struct {
A A
B B
}
func NewPair[A, B any](a A, b B) *Pair[A, B]
type SliceEq[A Eq[A]] []A
type SliceOrd[A Ord[A]] []A
Compare should work like in Haskell. Examples from Haskell:
Prelude> [1,2,3] < [3,4,5]
True
Prelude> [1,2,3] < [3,4]
True
Prelude> [1,2,3] < []
False
Unit represents the Haskell value `()`
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.