code: func simplifyImpliedValueType(ty cty.Type) cty.Type {
  	switch {
  	case ty.IsTupleType():
  		// If all of the element types are the same then we'll make this
  		// a list instead. This is very likely to be true, since prior versions
  		// of Terraform did not officially support mixed-type collections.
  
  		if ty.Equals(cty.EmptyTuple) {
  			// Don't know what the element type would be, then.
  			return ty
  		}
  
  		etys := ty.TupleElementTypes()
  		ety := etys[0]
  		for _, other := range etys[1:] {
  			if !other.Equals(ety) {
  				// inconsistent types
  				return ty
  			}
  		}
  		ety = simplifyImpliedValueType(ety)
  		return cty.List(ety)
  
  	case ty.IsObjectType():
  		// If all of the attribute types are the same then we'll make this
  		// a map instead. This is very likely to be true, since prior versions
  		// of Terraform did not officially support mixed-type collections.
  
  		if ty.Equals(cty.EmptyObject) {
  			// Don't know what the element type would be, then.
  			return ty
  		}
  
  		atys := ty.AttributeTypes()
  		var ety cty.Type
  		for _, other := range atys {
  			if ety == cty.NilType {
  				ety = other
  				continue
  			}
  			if !other.Equals(ety) {
  				// inconsistent types
  				return ty
  			}
  		}
  		ety = simplifyImpliedValueType(ety)
  		return cty.Map(ety)
  
  	default:
  		// No other normalizations are possible
  		return ty
  	}
  }
docs: // simplifyImpliedValueType attempts to heuristically simplify a value type
  // derived from a legacy stored output value into something simpler that
  // is closer to what would've fitted into the pre-v0.12 value type system.