Cut the ham into small cubes.
Peel the potatoes and dice them into bite-sized pieces.
Chop the carrots, celery, and onion; mince the garlic.
Shred the cheddar cheese and Gruyère cheese, if using.
In a large pot, warm the butter or olive oil over medium heat.
Add the onion, carrots, celery, and garlic; sauté for 5–7 minutes, until softened and fragrant.
Put the diced potatoes into the pot with the sautéed vegetables.
Pour in the chicken broth and add the bay leaves. Bring to a simmer and cook for 15–20 minutes, until the potatoes are tender, stirring occasionally to prevent sticking.
Once the potatoes are tender, add the diced ham and stir.
Gradually add the shredded cheddar and Gruyère, stirring constantly to melt smoothly. For a creamier texture, add a bit of milk or heavy cream at this point.
Simmer for another 5–7 minutes to let the flavors meld.
Taste and season with salt and pepper to your liking.
Remove the bay leaves before serving.
Ladle into bowls and optionally garnish with freshly chopped parsley.