github.com/l3x/learn-fp-go@v0.0.0-20171228022418-7639825d0b71/4-purely-functional/ch09-functor-monoid/07_compose_gof/src/compose/compose.go (about) 1 package compose 2 3 func Humanize(b bool) string { 4 if b { return "yes" } else { return "no" } 5 } 6 7 func Emphasize(s string) string { 8 return s + "!!" 9 } 10 11 func EmphasizeHumanize(b bool) string { 12 return Emphasize(Humanize(b)) 13 } 14 15 type Fbs func(bool) string 16 type Fss func(string) string 17 18 func Compose(g Fss, f Fbs) Fbs { 19 return func(x bool) string { 20 return g(f(x)) 21 } 22 } 23 24 var Emphasize_Humanize = Compose(Emphasize, Humanize)