package
Version:
v1.0.95
Opens a new window with list of versions in this module.
Published: Jan 11, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
Iso is an optic which converts elements of type `S` into elements of type `A` without loss.
-
func Compose[S, A, B any](ab Iso[A, B]) func(Iso[S, A]) Iso[S, B]
-
func From[S, A any](a A) func(Iso[S, A]) S
-
func IMap[S, A, B any](ab func(A) B, ba func(B) A) func(Iso[S, A]) Iso[S, B]
-
func Modify[S any, FCT ~func(A) A, A any](f FCT) func(Iso[S, A]) EM.Endomorphism[S]
-
func To[A, S any](s S) func(Iso[S, A]) A
-
func Unwrap[A, S any](s S) func(Iso[S, A]) A
-
func Wrap[S, A any](a A) func(Iso[S, A]) S
-
type Iso
func Compose[S, A, B any](ab Iso[A, B]) func(Iso[S, A]) Iso[S, B]
Compose combines an ISO with another ISO
func From[S, A any](a A) func(Iso[S, A]) S
To unwraps the value
func IMap[S, A, B any](ab func(A) B, ba func(B) A) func(Iso[S, A]) Iso[S, B]
IMap implements a bidirectional mapping of the transform
Modify applies a transformation
func To[A, S any](s S) func(Iso[S, A]) A
From wraps the value
func Unwrap[A, S any](s S) func(Iso[S, A]) A
Wrap wraps the value
func Wrap[S, A any](a A) func(Iso[S, A]) S
Unwrap unwraps the value
type Iso[S, A any] struct {
Get func(s S) A
ReverseGet func(a A) S
}
Id returns an iso implementing the identity operation
func MakeIso[S, A any](get func(S) A, reverse func(A) S) Iso[S, A]
func Reverse[S, A any](sa Iso[S, A]) Iso[A, S]
Reverse changes the order of parameters for an iso
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.