github.com/l3x/learn-fp-go@v0.0.0-20171228022418-7639825d0b71/4-purely-functional/ch09-functor-monoid/03_generics_nums/src/num/int8_slice.go (about) 1 // Generated by: gen 2 // TypeWriter: slice 3 // Directive: +gen on Int8 4 5 package num 6 7 // Int8Slice is a slice of type Int8. Use it where you would use []Int8. 8 type Int8Slice []Int8 9 10 // SumInt8 sums Int8 over elements in Int8Slice. See: http://clipperhouse.github.io/gen/#Sum 11 func (rcv Int8Slice) SumInt8(fn func(Int8) Int8) (result Int8) { 12 for _, v := range rcv { 13 result += fn(v) 14 } 15 return 16 }