Cook the sugar and water together to form a syrup at the thread stage. Add the coconut, then stir in the egg yolks. Add the cinnamon and sherry and cook over low heat, stirring constantly with a wooden spoon, until the mixture is thick.
Pour into a flame-proof serving dish. Put under the grill to brown the top. Serve with plain or whipped cream.