In a large pot, combine beans, apples and coconut milk. Add enough water to cover. Bring to a boil over high heat, then turn heat down to medium-low so mixture bubbles steadily but not violently. Cook, stirring occasionally and adding salt as beans become tender, until beans are quite soft, 45 to 60 minutes; add water as needed to keep everything moist.
When liquid has thickened, put butter or vegetable oil in a skillet over medium heat until it melts and is foamy (or shimmering if using oil). Add coconut, ginger and garlic and cook. Stir frequently and adjust heat to prevent burning, until mixture (called a tarka) crisps and turns golden, 5 to 10 minutes.
Add turmeric if using it, then stir in scallions, mint and lime juice. Cook for a minute or two more, then stir butter mixture into pot of beans. Taste, adjust seasoning and serve.