Add a Goals newtype

  This makes it easier to get the behavior of the TVars instance under control,
as we can choose to only apply the substitution to the values of the map after
first applying it to the keys, and thus possibly removing redundant goals.