mirror of
https://github.com/IBM/fp-go.git
synced 2025-08-10 22:31:32 +02:00
Add presentation to sample section (#76)
* doc: add presentation Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * fix: add some more examples Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * doc: update presentation Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * fix: update presentation Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * fix: add presentation and samples Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * fix: benchmarks Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * fix: upload presentation Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> * doc: add presentation Signed-off-by: Carsten Leue <carsten.leue@de.ibm.com> * doc: add link to video Signed-off-by: Carsten Leue <carsten.leue@de.ibm.com> --------- Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com> Signed-off-by: Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -22,30 +22,28 @@ import (
|
||||
)
|
||||
|
||||
type Const[E, A any] struct {
|
||||
Value E
|
||||
value E
|
||||
}
|
||||
|
||||
func Make[E, A any](e E) Const[E, A] {
|
||||
return Const[E, A]{Value: e}
|
||||
return Const[E, A]{value: e}
|
||||
}
|
||||
|
||||
func Unwrap[E, A any](c Const[E, A]) E {
|
||||
return c.Value
|
||||
return c.value
|
||||
}
|
||||
|
||||
func Of[E, A any](m M.Monoid[E]) func(A) Const[E, A] {
|
||||
return func(a A) Const[E, A] {
|
||||
return Make[E, A](m.Empty())
|
||||
}
|
||||
return F.Constant1[A](Make[E, A](m.Empty()))
|
||||
}
|
||||
|
||||
func MonadMap[E, A, B any](fa Const[E, A], f func(A) B) Const[E, B] {
|
||||
return Make[E, B](fa.Value)
|
||||
return Make[E, B](fa.value)
|
||||
}
|
||||
|
||||
func MonadAp[E, A, B any](s S.Semigroup[E]) func(fab Const[E, func(A) B], fa Const[E, A]) Const[E, B] {
|
||||
return func(fab Const[E, func(A) B], fa Const[E, A]) Const[E, B] {
|
||||
return Make[E, B](s.Concat(fab.Value, fa.Value))
|
||||
return Make[E, B](s.Concat(fab.value, fa.value))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user