In a small saucepan, Heat milk to boiling point and remove from the heat.
In a heatproof mixing bowl, beat egg yolks until smooth. Gradually add the granulated sugar and continue beating until pale yellow. Beat in the flour.
Pour the hot milk into the egg yolk mixture in a steady stream, beating constantly. When all the milk has been added, place the bowl over (not in) a pan of boiling water, or pour the mixture into the top of a double boiler. Heat, stirring constantly, until thickened. Cook 2 minutes more, then remove from the heat. Stir in the butter and vanilla. Cover with plastic wrap and allow to cool.