Preheat your oven to 350°F (175°C).
Peel and boil the sweet potatoes until soft.
Drain the potatoes and mash them until smooth.
In a large mixing bowl, combine the mashed sweet potatoes, coconut milk, brown sugar, vanilla extract, cinnamon, nutmeg, and melted butter.
Sift in the all-purpose flour and mix until just combined.
Fold in the raisins (if using).
Pour the mixture into a greased baking dish.
Bake in the preheated oven for about 45 to 60 minutes, or until the top is set and a toothpick comes out clean.
Allow the pudding to cool slightly before serving.