Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Type ¶
func NewType ¶
Example ¶
package main
import (
"fmt"
"github.com/calebcase/base/data/monoid/endo"
)
func main() {
t := endo.NewType[string]()
prefix := func(x string) string {
return "Hello, " + x
}
postfix := func(x string) string {
return x + "!"
}
computation := t.MAppend(prefix, postfix)
fmt.Println(t.Apply(computation, "Haskell"))
}
Output: Hello, Haskell!
Click to show internal directories.
Click to hide internal directories.