Skip to content

Commit

Permalink
fix: generic order on ContramapCache
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 Feb 8, 2024
1 parent 3f1bde2 commit 0afedbd
Show file tree
Hide file tree
Showing 2 changed files with 725 additions and 616 deletions.
4 changes: 2 additions & 2 deletions function/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func Memoize[K comparable, T any](f func(K) T) func(K) T {
}

// ContramapMemoize converts a unary function into a unary function that caches the value depending on the parameter
func ContramapMemoize[A any, K comparable, T any](kf func(A) K) func(func(A) T) func(A) T {
func ContramapMemoize[T, A any, K comparable](kf func(A) K) func(func(A) T) func(A) T {
return G.ContramapMemoize[func(A) T](kf)
}

// CacheCallback converts a unary function into a unary function that caches the value depending on the parameter
func CacheCallback[
A any, K comparable, T any](kf func(A) K, getOrCreate func(K, func() func() T) func() T) func(func(A) T) func(A) T {
T, A any, K comparable](kf func(A) K, getOrCreate func(K, func() func() T) func() T) func(func(A) T) func(A) T {
return G.CacheCallback[func(func(A) T) func(A) T](kf, getOrCreate)
}

Expand Down

0 comments on commit 0afedbd

Please sign in to comment.