package traversal

import "github.com/IBM/fp-go/optics/traversal"

Index

Functions

func Compose

func Compose[
	S, A, B, HKTS, HKTA, HKTB any](ab G.Traversal[A, B, HKTA, HKTB]) func(sa G.Traversal[S, A, HKTS, HKTA]) G.Traversal[S, B, HKTS, HKTB]

Compose composes two traversables

func Fold

func Fold[S, A any](sa G.Traversal[S, A, C.Const[A, S], C.Const[A, A]]) func(S) A

Fold maps each target to a `Monoid` and combines the result

func FoldMap

func FoldMap[M, S, A any](f func(A) M) func(sa G.Traversal[S, A, C.Const[M, S], C.Const[M, A]]) func(S) M

FoldMap maps each target to a `Monoid` and combines the result

func GetAll

func GetAll[S, A any](s S) func(sa G.Traversal[S, A, C.Const[[]A, S], C.Const[[]A, A]]) []A

GetAll gets all the targets of a traversal

func Id

func Id[S, A any]() G.Traversal[S, S, A, A]

Id is the identity constructor of a traversal

func Modify

func Modify[S, A any](f func(A) A) func(sa G.Traversal[S, A, S, A]) func(S) S

Modify applies a transformation function to a traversal

func Set

func Set[S, A any](a A) func(sa G.Traversal[S, A, S, A]) func(S) S

Set sets a constant value for all values of the traversal

Source Files

traversal.go

Directories

PathSynopsis
optics/traversal/array
optics/traversal/array/const
optics/traversal/array/generic
optics/traversal/array/generic/const
optics/traversal/array/generic/identity
optics/traversal/array/identity
optics/traversal/either
optics/traversal/generic
optics/traversal/option
optics/traversal/record
optics/traversal/record/const
optics/traversal/record/generic
optics/traversal/record/generic/const
optics/traversal/record/generic/identity
optics/traversal/record/identity
Version
v1.0.151 (latest)
Published
Nov 23, 2024
Platform
linux/amd64
Imports
3 packages
Last checked
4 months ago

Tools for package owners.