For the ice cream, heat the milk, coconut milk and two-thirds of the sugar in a heavy-based saucepan and slowly bring to the boil.
Meanwhile, whisk the egg yolks and remaining sugar together in a heatproof bowl. Continue to whisk until the mixture becomes pale and has a light ribbon consistency.
Pour the boiling milk onto the egg yolks, whisking continuously, then pour the mixture back into the saucepan.
Cook over a low heat, stirring with a wooden spatula or spoon; do not let it boil or it will curdle. The custard is ready when it has thickened slightly – just enough to lightly coat the back of the spatula. When you run your finger through, it should leave a clear trace. Immediately take off the heat and pour into a bowl.
Stir in the desiccated coconut and double cream.
Leave to cool, stirring occasionally to prevent a skin forming. Stir in the rum.
Pour the cool mixture through a fine sieve before churning in an ice-cream maker for about 20 minutes, until the ice cream is firm but still creamy.
Transfer the ice cream to a chilled freezerproof container and keep it in the freezer until ready to serve.
For the syrup, place all of the ingredients into a saucepan. Slowly bring to the boil over a gentle heat, stirring occasionally. Simmer over a medium heat to reduce by three-quarters, until it makes a thick syrup. Set aside.
Preheat the oven to180C/350F/Gas 4.
Using a serrated knife, cut a 3cm/1in slice from the top of the pineapple, removing the leaves, and a 2cm/¾in slice from the base to enable the pineapple to stand upright. Now working from top to bottom and following the curve of the fruit, remove the peel.
To remove the little black ‘eyes’, and create an attractive finish, cut a spiral groove, 5mm/¼in deep, around the entire fruit.
Stud the flesh evenly all over with the cloves.
Heat the oil in an oval pan (or one that will take the whole fruit) until very hot, then add the pineapple and lightly colour all over.
Transfer the pineapple to a roasting dish, standing it upright.
Baste the pineapple with the reduced syrup and roast in the oven for 35-40 minutes, depending on the ripeness of the fruit. Baste every five minutes or so with the syrup.
Leave the roasted pineapple to stand for 10-15 minutes before serving, basting from time to time with the syrup.
To serve, slice the pineapple into 1cm/½in slices.
Arrange in a serving dish, retaining the star anise for decoration, and serve the ice cream alongside.