Melt the butter with the oil in a wide pan over medium heat. Add the shallots and cook 3–4 minutes until soft and fragrant. Add the curry leaves and habanero and cook 30–45 seconds until aromatic.
Stir in the flour and cook 1–2 minutes, stirring constantly, until lightly toasted and nutty.
Slowly whisk in the heavy cream, stirring constantly to keep it smooth. Cook 2–3 minutes until thick and glossy, then remove from the heat and cool slightly.
Stir in all of the corn kernels. Whisk in the eggs, salt, pepper, turmeric and sugar if using.
Add the cheddar and Parmesan and fold until fully incorporated.
Preheat the oven to 375°F (190°C). Pour into a generously buttered baking dish or cast-iron skillet and bake 35–40 minutes, until the center is set and the top is golden and bubbling.
Rest 10 minutes before serving. Finish with lime zest, flaky salt and crispy curry leaves if desired.