Put the lentils into a deep saucepan and wash under cold water until the water runs clear, then cover with four times the amount of water and bring to the boil. Simmer for around 35 mins or until soft, straining off any foam from the lentils if it arises.
While the dal is boiling, heat one tablespoon of oil in a wide lidded frying pan and add the chillies, coriander, fenugreek and cumin. Stir-fry for a minute or until the coriander seeds start turn golden, then add the coconut for a minute last minute, then take off the heat and grind to a paste.
Wipe the frying pan clean and heat three tablespoons of oil over a medium to high heat. When hot, add the mustard seeds and curry leaves, followed closely by the shallots. Cook until translucent and browning (around 15 minutes) then add the diced squash, cover for 5 minutes then add the aubergine and stir fry for 5 minutes on a high heat.
Now add the tomatoes, a little water (say 50ml), the spice paste you made earlier, salt, sugar and tamarind paste. Cover with a lid and leave to cook for around 5 minutes.
When the tomatoes are soft and have broken down and the lentils cooked, transfer the vegetable mixture to the lentils, add the beans and heat together for another 5 minutes. Taste and adjust the salt, sugar and tamarind as you wish. Serve with steaming basmati rice.