Documentation ¶
Overview ¶
Package fun provides reusable general-purpose functions (Const, Swap, Curry) and data structures (Unit, Either).
Index ¶
- Variables
- func Const[A any, B any](b B) func(A) B
- func ConstUnit[B any](b B) func(Unit) B
- func Curry[A any, B any, C any](f func(a A, b B) C) func(a A) func(b B) C
- func Fold[A any, B any, C any](eab Either[A, B], left func(A) C, right func(B) C) C
- func Identity[A any](a A) A
- func IsLeft[A any, B any](eab Either[A, B]) bool
- func IsRight[A any, B any](eab Either[A, B]) bool
- func Swap[A any, B any, C any](f func(a A) func(b B) C) func(b B) func(a A) C
- type Either
- type Pair
- type Unit
Constants ¶
This section is empty.
Variables ¶
View Source
var Unit1 = Unit{}
Unit1 is the value of type Unit.
Functions ¶
func ConstUnit ¶
ConstUnit creates a function that will ignore it's Unit input and return the specified value.
func Curry ¶
Curry takes a function that has two arguments and returns a function with two argument lists.
func Identity ¶ added in v0.0.11
func Identity[A any](a A) A
Identity function returns the given value unchanged.
Types ¶
type Either ¶ added in v0.0.10
Either is a simple data structure that can have either left value or right value.
Click to show internal directories.
Click to hide internal directories.