Skip to content

Commit

Permalink
fix: rename FormEndomorphism and FormBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
  • Loading branch information
CarstenLeue committed Dec 17, 2023
1 parent e82575f commit 1d02f21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions http/form/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
)

type (
// FormEndomorphism returns an [ENDO.Endomorphism] that transforms a form
FormEndomorphism = ENDO.Endomorphism[url.Values]
// Endomorphism returns an [ENDO.Endomorphism] that transforms a form
Endomorphism = ENDO.Endomorphism[url.Values]
)

var (
Expand All @@ -38,8 +38,8 @@ var (

noField = O.None[string]()

// FormMonoid is the [M.Monoid] for the [FormEndomorphism]
FormMonoid = ENDO.Monoid[url.Values]()
// FormMonoid is the [M.Monoid] for the [Endomorphism]
Monoid = ENDO.Monoid[url.Values]()

// AtValues is a [L.Lens] that focusses on the values of a form field
AtValues = LRG.AtRecord[url.Values, []string]
Expand All @@ -57,7 +57,7 @@ var (
)

// WithValue creates a [FormBuilder] for a certain field
func WithValue(name string) func(value string) FormEndomorphism {
func WithValue(name string) func(value string) Endomorphism {
return F.Flow3(
O.Of[string],
AtValue(name).Set,
Expand All @@ -66,6 +66,6 @@ func WithValue(name string) func(value string) FormEndomorphism {
}

// WithoutValue creates a [FormBuilder] that removes a field
func WithoutValue(name string) FormEndomorphism {
func WithoutValue(name string) Endomorphism {
return AtValue(name).Set(noField)
}
16 changes: 8 additions & 8 deletions ioeither/http/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ type (
body O.Option[IOE.IOEither[error, []byte]]
}

// BuilderEndomorphism returns an [ENDO.Endomorphism] that transforms a builder
BuilderEndomorphism = ENDO.Endomorphism[*Builder]
// Endomorphism returns an [ENDO.Endomorphism] that transforms a builder
Endomorphism = ENDO.Endomorphism[*Builder]
)

var (
Expand All @@ -50,8 +50,8 @@ var (

defaultMethod = F.Constant(http.MethodGet)

// BuilderMonoid is the [M.Monoid] for the [BuilderEndomorphism]
BuilderMonoid = ENDO.Monoid[*Builder]()
// Monoid is the [M.Monoid] for the [Endomorphism]
Monoid = ENDO.Monoid[*Builder]()

// Url is a [L.Lens] for the URL
Url = L.MakeLensRef((*Builder).GetUrl, (*Builder).SetUrl)
Expand Down Expand Up @@ -226,7 +226,7 @@ func Header(name string) L.Lens[*Builder, O.Option[string]] {
}

// WithHeader creates a [BuilderBuilder] for a certain header
func WithHeader(name string) func(value string) BuilderEndomorphism {
func WithHeader(name string) func(value string) Endomorphism {
return F.Flow3(
O.Of[string],
Header(name).Set,
Expand All @@ -235,12 +235,12 @@ func WithHeader(name string) func(value string) BuilderEndomorphism {
}

// WithoutHeader creates a [BuilderBuilder] to remove a certain header
func WithoutHeader(name string) BuilderEndomorphism {
func WithoutHeader(name string) Endomorphism {
return Header(name).Set(noHeader)
}

// WithFormData creates a [BuilderBuilder] to send form data payload
func WithFormData(value url.Values) BuilderEndomorphism {
func WithFormData(value url.Values) Endomorphism {
return F.Flow2(
F.Pipe4(
value,
Expand All @@ -254,7 +254,7 @@ func WithFormData(value url.Values) BuilderEndomorphism {
}

// WithJson creates a [BuilderBuilder] to send JSON payload
func WithJson[T any](data T) BuilderEndomorphism {
func WithJson[T any](data T) Endomorphism {
return F.Flow2(
F.Pipe3(
data,
Expand Down

0 comments on commit 1d02f21

Please sign in to comment.