MCPcopy Index your code
hub / github.com/Effect-TS/effect / reverse

Function reverse

packages/typeclass/src/Semigroup.ts:72–81  ·  view source on GitHub ↗
(S: Semigroup<A>)

Source from the content-addressed store, hash-verified

70 * @since 0.24.0
71 */
72export const reverse = <A>(S: Semigroup<A>): Semigroup<A> =>
73 make(
74 (self, that) => S.combine(that, self),
75 (self, collection) => {
76 const reversed = Array.from(collection).reverse()
77 return reversed.length > 0 ?
78 S.combine(S.combineMany(reversed[0], reversed.slice(1)), self) :
79 self
80 }
81 )
82
83/**
84 * The `intercalate` API returns a function that takes a `Semigroup` instance and a separator value, and returns a new

Callers

nothing calls this directly

Calls 2

makeFunction · 0.70
combineMethod · 0.65

Tested by

no test coverage detected