fp

package
v0.0.0-...-d9d3431 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pipe2

func Pipe2[A any, B any, C any](a A, fa func(A) (B, error), fb func(B) (C, error)) (*C, error)

Sometimes you want to compose functions only if each call is successful, stopping if any return an error code. This is what the Pipe functions do. TODO: The Pipe functions seem like great candidates for code generation.

func Pipe3

func Pipe3[A any, B any, C any, D any](a A, fa func(A) (B, error), fb func(B) (C, error), fc func(C) (D, error)) (*D, error)

func Pipe4

func Pipe4[A any, B any, C any, D any, E any](a A, fa func(A) (B, error), fb func(B) (C, error), fc func(C) (D, error), fd func(D) (E, error)) (*E, error)

func Pipe5

func Pipe5[A any, B any, C any, D any, E any, F any](a A, fa func(A) (B, error), fb func(B) (C, error), fc func(C) (D, error), fd func(D) (E, error), fe func(E) (F, error)) (*F, error)

func SucceedOrCrash

func SucceedOrCrash(e error)

Log a fatal error if e is not nil and exit.

func ValOrCrash

func ValOrCrash[V any](v V, e error) V

Return the given value if e is nil, otherwise log a fatal error and exit.

Types

This section is empty.

Jump to

Keyboard shortcuts

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