Is there a name for the following concept? Can you point me to any references on it?<br><br>Suppose I have the following two functions ...<br><br>&gt; swap1 :: (Int, Char) -&gt; (Char, Int)<br>&gt; swap2 :: (Char, Int) -&gt; (Int, Char)<br>


<br>... and, for some reason, I think I can unify these into a single function. I think, hmm, given that the structure is that same, let&#39;s do a first pass:<br><br>&gt; swap? :: (a, b) -&gt; (c, d)<br><br>But then I go back to the input types to confirm that this will work, and, alas, it will not, because there are similarities that I missed. This is way too general. I need to ensure that what&#39;s an Int stays an Int and likewise for Char.<br>


<br>&gt; swap! :: (a, b) -&gt; (b, a)<br><br>And now I have found a type that is more general than swap1 and swap2 and yet not so general that the shared constraints are left out. This seems somewhat analogous to the least common multiple.<br>

<br>Another example is the following:<br><br>&gt; showFloat :: Float -&gt; String<br>&gt; showBool :: Bool -&gt; String<br><br>We could say the more general type is ...<br><br>&gt; show? :: a -&gt; String<br><br>... but then we lose the implied constraint that we must know something about &#39;a&#39; to produce a string. So, we add back such some such constraint:<br>

<br>&gt; show! :: (Show a) =&gt; a -&gt; String<br><br>Of course, with all of this, it may not be clear what to do about the definitions of the functions, but I&#39;m curious if there&#39;s a name for the concept from a type perspective.<br>

<br>Thanks,<br>Sean<br>