github.com/l3x/learn-fp-go@v0.0.0-20171228022418-7639825d0b71/4-purely-functional/ch09-functor-monoid/08_compose_fog/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 19 func Compose(g Fbs, f Fss) Fbs { 20 return func(x bool) string { 21 return f(g(x)) 22 } 23 } 24 25 var EmphasizeHumanizeFoG = Compose(Emphasize, Humanize) 26