It looks like the text/template type checker is supposed to figure this out? Or at
least not panic?
http://play.golang.org/p/ArLMq7u57U
package main
import (
"log"
"os"
"text/template"
)
type T string
func main() {
m := template.FuncMap{
"f": func() T { return "hello" },
"g": func(s string) string { return s },
}
t := template.Must(template.New("main").Funcs(m).Parse(`{{f|g}}`))
log.Fatal(t.Execute(os.Stdout, nil))
}