fmap

package
v0.0.0-...-e3f2fdf Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package fmap contains the implementation of the fmap plugin, which generates the deriveFmap function.

The deriveFmap function applies a given function to each element of a list, returning a list of results in the same order.

deriveFmap(func(A) B, []A) []B
deriveFmap(func(rune) B, string) []B

deriveFmap can also be applied to a function that returns a value and an error.

deriveFmap(func(A) B, func() (A, error)) (B, error)
deriveFmap(func(A) (B, error), func() (A, error)) (func() (B, error), error)
deriveFmap(func(A), func() (A, error)) error
deriveFmap(func(A) (B, c, d, ...), func() (A, error)) (func() (B, c, d, ...), error)

deriveFmap will propagate the error and not apply the first function to the result of the second function, if the second function returns an error.

deriveFmap can also be applied to a channel.

deriveFmap(func(A) B, <-chan A) <-chan B

deriveFmap will return the output channel immediately and start up a go routine in the background to process the incoming channel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New is a constructor for the fmap code generator. This generator should be reconstructed for each package.

func NewPlugin

func NewPlugin() derive.Plugin

NewPlugin creates a new fmap plugin. This function returns the plugin name, default prefix and a constructor for the fmap code generator.

Types

This section is empty.

Jump to

Keyboard shortcuts

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