Combine milk, egg yolks, and sugar in a heavy saucepan. Whisk till thoroughly blended. Add butter.
Cook and stir over medium heat till thick; about 12 minutes.
Remove from the heat and stir in vanilla. Let cool for at least 20 minutes.
Stir in coconut, and pecans. Cool to room temperature before frosting cake or brownies.
Notes
To toast pecans: Place pecans in a single layer on a baking sheet. Bake at 350° for about 10 minutes or till lightly browned and fragrant, stirring occasionally.