First, wash the lentils in the sink in a big bowl, filling it with water and washing the lentils with your hands about three times, until the water is less dusty and clear-ish.
In a large saucepan, gently fry the onion, carrot, garlic and ginger in a little oil for about 10 minutes, until soft and sweet. Add the spices and fry for a couple of minutes, stirring all the time.
Next, add the lentils, stock and coconut milk to the pan and bring to a simmer, then turn the heat down and leave to bubble away for about an hour (you could cook it in less, but the lentils will be really soft and buttery if you give them longer).
Grate the veg for the pickle and finely slice the onion. Put the onion in a bowl with the salt, sugar and vinegar and use your hands to scrunch the onion, then stir in the rest of the grated veg.
Warm the butter or ghee in a small pan, add the spices and put on a low heat until the mustard seeds begin to pop and release their aroma. Serve the dal in deep bowls with the pickle on top and the spiced butter for spooning over.