Knowledge (XXG)

Parametric polymorphism

Source đź“ť

1657: 1281: 1730:. This is very similar to what is called "ML-style" or "Let-polymorphism" (technically ML's Let-polymorphism has a few other syntactic restrictions). This restriction makes the distinction between polymorphic and non-polymorphic types very important; thus in predicative systems polymorphic types are sometimes referred to as 197:: they behave identically regardless of the type they are instantiated at. In contrast, ad hoc polymorphic definitions are given a distinct definition for each type. Thus, ad hoc polymorphism can generally only support a limited number of such distinct types, since a separate implementation has to be provided for each type. 1151: 2309:
if it is self-referential; in type theory, it refers to the ability for a type to be in the domain of a quantifier it contains. This allows the instantiation of any type variable with any type, including polymorphic types. An example of a system supporting full impredicativity is
2485: 2031:) performs type inference and supports impredicative polymorphism, but in some cases when impredicative polymorphism is used, the system's type inference is incomplete unless some explicit type annotations are provided by the programmer. 2711:
With one exception (that of the distinguished type variable in a class declaration (Section 4.3.1)), the type variables in a Haskell type expression are all assumed to be universally quantified; there is no explicit syntax for universal
2274: 2390:
on the type parameters. Many operations require some knowledge of the data types, but can otherwise work parametrically. For example, to check whether an item is included in a list, we need to compare the items for equality. In
2215: 2084: 1276:{\displaystyle {\begin{aligned}{\mathsf {fst}}&:\forall \alpha .\forall \beta .\alpha \times \beta \to \alpha \\{\mathsf {snd}}&:\forall \alpha .\forall \beta .\alpha \times \beta \to \beta \end{aligned}}} 1630:
have each introduced "generics" for parametric polymorphism. Some implementations of type polymorphism are superficially similar to parametric polymorphism while also introducing ad hoc aspects. One example is
499: 1865: 917: 410: 1348: 346: 1156: 2347: 294: 166:
allows a single piece of code to be given a "generic" type, using variables in place of actual types, and then instantiated with particular types as needed. Parametrically polymorphic
248: 2010: 1971: 1778: 1079: 989: 615: 568: 1451: 1545: 1511: 1481: 1398: 1139: 1109: 1040: 950: 437: 2422: 784: 695: 2834: 2769: 2156: 1908: 1368: 1013: 526: 1418: 1741:
A consequence of predicativity is that all types can be written in a form that places all quantifiers at the outermost (prenex) position. For example, consider the
2587: 1932: 1888: 830: 2125: 810: 2220: 2874:(1971). "Une Extension de l'Interpretation de Gödel à l'Analyse, et son Application à l'Élimination des Coupures dans l'Analyse et la Théorie des Types". 3224: 1550:
is implicit and may be omitted. Other languages require types to be instantiated explicitly at some or all of a parametrically polymorphic function's
3651: 1674: 2039:
Some type systems support an impredicative function type constructor even though other type constructors remain predicative. For example, the type
3595: 3229: 2968: 1520:
used to introduce parametric polymorphism varies significantly between programming languages. For example, in some programming languages, such as
3219: 3214: 2173: 2042: 141: 3072: 2946: 2567: 531:
The identity function is a particularly extreme example, but many other functions also benefit from parametric polymorphism. For example, an
3202: 3103: 456: 2926: 2891: 2487:
in Haskell. In most object-oriented programming languages that support parametric polymorphism, parameters can be constrained to be
1786: 1696: 838: 2012:
itself. Polymorphism in the language ML is predicative. This is because predicativity, together with other restrictions, makes the
3353: 33: 2766:
Kfoury, A. J.; Wells, J. B. (1 January 1999). "Principality and decidable type inference for finite-rank intersection types".
351: 3470: 3275: 3207: 3169: 2788: 2412: 1678: 1619: 1587: 1583: 1575: 1517: 1289: 1603: 299: 3646: 3370: 3300: 3148: 2523: 2317: 1599: 1595: 253: 1081:
are parameterized over a single type, but functions may be parameterized over arbitrarily many types. For example, the
3625: 1615: 3380: 3248: 1723: 1579: 134: 2695: 1667: 3558: 3510: 3422: 3400: 3395: 3323: 3189: 2028: 3432: 3096: 2960: 444: 2644: 3500: 2878:. Studies in Logic and the Foundations of Mathematics (in French). Vol. 63. Amsterdam. pp. 63–92. 1635: 1563: 3328: 3184: 3143: 3138: 3022: 2373: 1973:
can be applied to pairs of lists with elements of any type—even to lists of polymorphic functions such as
1722:
system), type variables may not be instantiated with polymorphic types. Predicative type theories include
250:
simply returns its argument unmodified. This naturally gives rise to a family of potential types, such as
167: 211: 3318: 3293: 3013: 2741: 2513: 2357: 1976: 1937: 1744: 1045: 955: 581: 534: 127: 205:
It is possible to write functions that do not depend on the types of their arguments. For example, the
2480:{\textstyle \mathrm {Eq} \,\alpha \,\Rightarrow \alpha \,\rightarrow \left\rightarrow \mathrm {Bool} } 1423: 3656: 3120: 2583: 2492: 1527: 1486: 1456: 1373: 1114: 1084: 440: 155: 54: 49: 1018: 928: 415: 3590: 3568: 3495: 3348: 3340: 3260: 3089: 3027: 2496: 190: 183: 77: 40: 2399:
are restricted so that the equality operation is available, thus the function would have the type
3573: 3553: 3505: 3480: 3265: 3234: 3060: 3048: 2985: 2851: 2794: 2726:, Morris, L., Newey, M. "A Logic for Computable Functions with reflexive and polymorphic types", 2625: 2553: 1547: 700: 620: 115: 3460: 3390: 3365: 3179: 3174: 3068: 3040: 2942: 2887: 2784: 2617: 2563: 2141: 1623: 206: 110: 2918: 1893: 1353: 998: 511: 3605: 3490: 3288: 3032: 2977: 2934: 2914: 2906:
Interprétation fonctionnelle et élimination des coupures de l'arithmétique d'ordre supérieur
2901: 2879: 2871: 2843: 2829: 2774: 2609: 1403: 100: 95: 72: 2863: 1910:
such that the resulting function type is consistent with the types of the arguments. In an
3610: 3475: 3427: 3360: 2859: 2306: 1711: 105: 3005: 2269:{\displaystyle ((\forall \alpha .\alpha \rightarrow \alpha )\rightarrow T)\rightarrow T} 2162:
or more arrows, when the type is drawn as a tree. A type system is said to support rank-
17: 3563: 3385: 3375: 3283: 2283: 2017: 1917: 1873: 815: 2883: 2089: 789: 578:
does not inspect the elements of the list, only the list structure itself. Therefore,
3640: 3485: 2997: 2981: 2508: 2379: 1627: 1591: 447: 2798: 2670: 2629: 3442: 3417: 3052: 3001: 2956: 2723: 2383: 2302: 1142: 2989: 1734:
to distinguish them from ordinary (monomorphic) types, which are sometimes called
2557: 3620: 3615: 3465: 3412: 3239: 2592:(Lecture notes), Copenhagen: International Summer School in Computer Programming 2392: 2361: 2353: 2013: 1656: 1567: 575: 159: 3525: 3520: 3437: 3405: 3310: 3253: 2938: 2613: 2518: 2416: 1934:
may be any type whatsoever, including a type that is itself polymorphic; thus
1607: 3044: 2621: 2086:
is permitted in a system that supports higher-rank polymorphism, even though
3600: 3578: 3535: 3530: 3197: 3153: 3112: 2488: 1551: 171: 86: 2286:
for rank-2 polymorphism is decidable, but for rank-3 and above, it is not.
2170:. For example, a type system that supports rank-2 polymorphism would allow 2779: 2597: 3515: 2311: 2210:{\displaystyle (\forall \alpha .\alpha \rightarrow \alpha )\rightarrow T} 2079:{\displaystyle (\forall \alpha .\alpha \rightarrow \alpha )\rightarrow T} 1562:
Parametric polymorphism was first introduced to programming languages in
2276:. A type system that admits types of arbitrary rank is said to be "rank- 2855: 2832:(1969), "The principal type scheme of an object in combinatory logic", 1681: in this section. Unsourced material may be challenged and removed. 1521: 3036: 1717: 571: 2847: 1870:
In order to apply this function to a pair of lists, a concrete type
1632: 1611: 2024: 1727: 1571: 494:{\displaystyle {\mathsf {id}}:\forall \alpha .\alpha \to \alpha } 3133: 2166:
polymorphism if it admits types with rank less than or equal to
3085: 3128: 1860:{\displaystyle {\mathsf {append}}:\forall \alpha .\times \to } 1650: 912:{\displaystyle {\mathsf {append}}:\forall \alpha .\times \to } 3081: 3006:"On Understanding Types, Data Abstraction, and Polymorphism" 1642:
Predicativity, impredicativity, and higher-rank polymorphism
2301:) is the most powerful form of parametric polymorphism. In 2773:. Association for Computing Machinery. pp. 161–174. 2415:, bounding is achieved by requiring types to belong to a 1780:
function described above, which has the following type:
1141:
functions that return the first and second elements of a
405:{\displaystyle {\mathsf {String}}\to {\mathsf {String}}} 2876:
Proceedings of the Second Scandinavian Logic Symposium
2696:"Haskell 2010 Language Report § 4.1.2 Syntax of Types" 2425: 2320: 2223: 2176: 2144: 2092: 2045: 1979: 1940: 1920: 1896: 1876: 1789: 1747: 1530: 1489: 1459: 1426: 1406: 1376: 1356: 1343:{\displaystyle {\mathsf {fst}}((3,{\mathsf {true}}))} 1292: 1154: 1117: 1087: 1048: 1021: 1001: 958: 931: 922:
which can be instantiated to any type in the family.
841: 818: 792: 703: 623: 584: 537: 514: 459: 418: 354: 302: 256: 214: 341:{\displaystyle {\mathsf {Bool}}\to {\mathsf {Bool}}} 3544: 3453: 3339: 3309: 3274: 3162: 3119: 2728:Proc. Conference on Proving and Improving Programs 2479: 2342:{\displaystyle \forall \alpha .\alpha \to \alpha } 2341: 2268: 2209: 2150: 2119: 2078: 2004: 1965: 1926: 1902: 1882: 1859: 1772: 1539: 1505: 1475: 1445: 1412: 1392: 1362: 1342: 1275: 1145:, respectively, can be given the following types: 1133: 1103: 1073: 1034: 1007: 983: 944: 911: 824: 804: 778: 689: 609: 562: 520: 493: 431: 404: 340: 289:{\displaystyle {\mathsf {Int}}\to {\mathsf {Int}}} 288: 242: 2835:Transactions of the American Mathematical Society 2742:"Kwang's Haskell Blog - Higher rank polymorphism" 2770:Symposium on Principles of Programming Languages 617:can be given a similar family of types, such as 2598:"Fundamental Concepts in Programming Languages" 528:, yielding the full family of potential types. 189:Parametric polymorphism may be contrasted with 2961:"A Theory of Type Polymorphism in Programming" 2908:(Ph.D. thesis) (in French), UniversitĂ© Paris 7 2811: 3097: 2589:Fundamental Concepts in Programming Languages 2411:can only be a type with defined equality. In 193:. Parametrically polymorphic definitions are 135: 8: 2356:, the most frequently studied impredicative 412:, and so on. Parametric polymorphism allows 2768:Proceedings of the 26th ACM SIGPLAN-SIGACT 1483:, so the type of the overall expression is 182:, respectively, and they form the basis of 3104: 3090: 3082: 925:Parametrically polymorphic functions like 142: 128: 29: 3026: 2778: 2463: 2445: 2438: 2434: 2426: 2424: 2319: 2222: 2175: 2143: 2091: 2044: 1981: 1980: 1978: 1942: 1941: 1939: 1919: 1895: 1875: 1791: 1790: 1788: 1749: 1748: 1746: 1697:Learn how and when to remove this message 1529: 1491: 1490: 1488: 1461: 1460: 1458: 1428: 1427: 1425: 1405: 1378: 1377: 1375: 1355: 1319: 1318: 1294: 1293: 1291: 1217: 1216: 1160: 1159: 1155: 1153: 1119: 1118: 1116: 1089: 1088: 1086: 1050: 1049: 1047: 1023: 1022: 1020: 1000: 960: 959: 957: 933: 932: 930: 843: 842: 840: 817: 791: 758: 757: 733: 732: 708: 707: 702: 672: 671: 650: 649: 628: 627: 622: 586: 585: 583: 539: 538: 536: 513: 461: 460: 458: 420: 419: 417: 381: 380: 356: 355: 353: 323: 322: 304: 303: 301: 274: 273: 258: 257: 255: 216: 215: 213: 2969:Journal of Computer and System Sciences 2534: 504:The polymorphic definition can then be 85: 62: 39: 32: 2596:Strachey, Christopher (1 April 2000). 2548: 2546: 2544: 2542: 2540: 2538: 2419:; thus the same function has the type 2386:recognized the advantages of allowing 1997: 1994: 1991: 1988: 1985: 1982: 1958: 1955: 1952: 1949: 1946: 1943: 1807: 1804: 1801: 1798: 1795: 1792: 1765: 1762: 1759: 1756: 1753: 1750: 1498: 1495: 1492: 1468: 1465: 1462: 1438: 1435: 1432: 1429: 1385: 1382: 1379: 1329: 1326: 1323: 1320: 1301: 1298: 1295: 1224: 1221: 1218: 1167: 1164: 1161: 1126: 1123: 1120: 1096: 1093: 1090: 1066: 1063: 1060: 1057: 1054: 1051: 1027: 1024: 976: 973: 970: 967: 964: 961: 937: 934: 859: 856: 853: 850: 847: 844: 768: 765: 762: 759: 743: 740: 737: 734: 718: 715: 712: 709: 679: 676: 673: 657: 654: 651: 635: 632: 629: 602: 599: 596: 593: 590: 587: 555: 552: 549: 546: 543: 540: 508:by substituting any concrete type for 465: 462: 424: 421: 397: 394: 391: 388: 385: 382: 372: 369: 366: 363: 360: 357: 333: 330: 327: 324: 314: 311: 308: 305: 281: 278: 275: 265: 262: 259: 220: 217: 2602:Higher-Order and Symbolic Computation 2519:Type class#Higher-kinded polymorphism 1890:must be substituted for the variable 832:. The most general type is therefore 7: 2919:"Towards a Theory of Type Structure" 2671:"Parametric Polymorphism - SML Help" 2645:"More polymorphism and type classes" 1679:adding citations to reliable sources 812:denotes a list of elements of type 243:{\displaystyle {\mathsf {id}}(x)=x} 2491:of a given type (see the articles 2473: 2470: 2467: 2464: 2430: 2427: 2321: 2230: 2180: 2145: 2096: 2049: 2005:{\displaystyle {\mathsf {append}}} 1966:{\displaystyle {\mathsf {append}}} 1815: 1773:{\displaystyle {\mathsf {append}}} 1531: 1245: 1236: 1188: 1179: 1074:{\displaystyle {\mathsf {append}}} 984:{\displaystyle {\mathsf {append}}} 867: 610:{\displaystyle {\mathsf {append}}} 563:{\displaystyle {\mathsf {append}}} 473: 25: 2927:Lecture Notes in Computer Science 2158:quantifier passes to the left of 1647:Rank-1 (predicative) polymorphism 2138:) if no path from its root to a 1655: 1446:{\displaystyle {\mathsf {Bool}}} 3652:Polymorphism (computer science) 3065:Types and Programming Languages 2559:Types and Programming Languages 2368:Bounded parametric polymorphism 2349:at any type, including itself. 1666:needs additional citations for 1540:{\displaystyle \forall \alpha } 1506:{\displaystyle {\mathsf {Int}}} 1476:{\displaystyle {\mathsf {fst}}} 1393:{\displaystyle {\mathsf {Int}}} 1134:{\displaystyle {\mathsf {snd}}} 1104:{\displaystyle {\mathsf {fst}}} 2460: 2446: 2439: 2395:, type parameters of the form 2333: 2260: 2257: 2251: 2248: 2242: 2227: 2224: 2201: 2198: 2192: 2177: 2114: 2108: 2093: 2070: 2067: 2061: 2046: 1854: 1848: 1845: 1842: 1836: 1830: 1824: 1337: 1334: 1309: 1306: 1263: 1206: 1035:{\displaystyle {\mathsf {id}}} 945:{\displaystyle {\mathsf {id}}} 906: 900: 897: 894: 888: 882: 876: 799: 793: 773: 754: 751: 748: 729: 723: 704: 684: 668: 665: 662: 646: 640: 624: 485: 432:{\displaystyle {\mathsf {id}}} 377: 319: 270: 231: 225: 1: 3170:Arbitrary-precision or bignum 2923:Colloque Sur la Programmation 2884:10.1016/S0049-237X(08)70843-7 2314:, which allows instantiating 2305:, a definition is said to be 2130:A type is said to be of rank 1715:type system (also known as a 2982:10.1016/0022-0000(78)90014-4 2524:Trait (computer programming) 2027:(a descendant or dialect of 1566:in 1975. Today it exists in 27:Basis of generic programming 779:{\displaystyle \times \to } 690:{\displaystyle \times \to } 101:Single and dynamic dispatch 3673: 2812:Cardelli & Wegner 1985 2371: 2360:are based on those of the 2295:Impredicative polymorphism 2290:Impredicative polymorphism 3511:Strongly typed identifier 2939:10.1007/3-540-06859-7_148 2299:first-class polymorphism 2151:{\displaystyle \forall } 2134:(for some fixed integer 2035:Higher-rank polymorphism 2023:As a practical example, 2016:simple enough that full 18:Predicative polymorphism 3586:Parametric polymorphism 2614:10.1023/A:1010000313106 2364:, especially System F. 1903:{\displaystyle \alpha } 1636:template specialization 1363:{\displaystyle \alpha } 1008:{\displaystyle \alpha } 521:{\displaystyle \alpha } 164:parametric polymorphism 64:Parametric polymorphism 2730:, Arc-et-Senans (1975) 2481: 2374:Bounded quantification 2343: 2270: 2211: 2152: 2121: 2080: 2006: 1967: 1928: 1904: 1884: 1861: 1774: 1724:Martin-Löf type theory 1541: 1507: 1477: 1447: 1414: 1413:{\displaystyle \beta } 1394: 1364: 1344: 1277: 1135: 1105: 1075: 1036: 1009: 985: 946: 913: 826: 806: 780: 691: 611: 564: 522: 495: 445:universally quantified 443:type by introducing a 439:to be given a single, 433: 406: 342: 290: 244: 3014:ACM Computing Surveys 2780:10.1145/292540.292556 2584:Strachey, Christopher 2514:Polymorphic recursion 2482: 2344: 2271: 2212: 2153: 2122: 2081: 2007: 1968: 1929: 1905: 1885: 1862: 1775: 1542: 1508: 1478: 1448: 1415: 1395: 1365: 1345: 1278: 1136: 1106: 1076: 1037: 1010: 986: 947: 914: 827: 807: 781: 692: 612: 565: 523: 496: 434: 407: 343: 291: 245: 174:are sometimes called 156:programming languages 2493:Subtype polymorphism 2423: 2318: 2221: 2174: 2142: 2090: 2043: 2020:is always possible. 1977: 1938: 1918: 1894: 1874: 1787: 1745: 1675:improve this article 1528: 1487: 1457: 1424: 1404: 1374: 1354: 1290: 1152: 1115: 1085: 1046: 1019: 999: 956: 929: 839: 816: 790: 701: 621: 582: 535: 512: 457: 416: 352: 300: 254: 212: 55:Operator overloading 50:Function overloading 3647:Generic programming 3591:Primitive data type 3496:Recursive data type 3349:Algebraic data type 3225:Quadruple precision 3061:Pierce, Benjamin C. 2497:Generic programming 1420:is instantiated to 1370:is instantiated to 786:, and so on, where 191:ad hoc polymorphism 184:generic programming 78:Generic programming 41:Ad hoc polymorphism 3554:Abstract data type 3235:Extended precision 3194:Reduced precision 2933:, Paris: 408–425, 2649:www.seas.upenn.edu 2594:. Republished in: 2554:Benjamin C. Pierce 2477: 2339: 2266: 2207: 2148: 2117: 2076: 2002: 1963: 1924: 1900: 1880: 1857: 1770: 1537: 1503: 1473: 1443: 1410: 1390: 1360: 1340: 1286:In the expression 1273: 1271: 1131: 1101: 1071: 1032: 1005: 995:an arbitrary type 993:parameterized over 981: 942: 909: 822: 802: 776: 687: 607: 560: 518: 491: 429: 402: 338: 286: 240: 116:Predicate dispatch 3634: 3633: 3366:Associative array 3230:Octuple precision 3074:978-0-262-16209-8 3037:10.1145/6041.6042 3004:(December 1985). 2948:978-3-540-06859-4 2915:Reynolds, John C. 2902:Girard, Jean-Yves 2872:Girard, Jean-Yves 2830:Hindley, J. Roger 2675:smlhelp.github.io 2569:978-0-262-16209-8 1927:{\displaystyle T} 1883:{\displaystyle T} 1707: 1706: 1699: 1624:Visual Basic .NET 825:{\displaystyle T} 207:identity function 180:generic datatypes 176:generic functions 152: 151: 111:Multiple dispatch 16:(Redirected from 3664: 3606:Type constructor 3491:Opaque data type 3423:Record or Struct 3220:Double precision 3215:Single precision 3106: 3099: 3092: 3083: 3078: 3056: 3030: 3010: 2993: 2965: 2951: 2909: 2897: 2866: 2815: 2809: 2803: 2802: 2782: 2763: 2757: 2756: 2754: 2752: 2737: 2731: 2721: 2715: 2714: 2708: 2706: 2692: 2686: 2685: 2683: 2681: 2666: 2660: 2659: 2657: 2655: 2640: 2634: 2633: 2593: 2580: 2574: 2573: 2550: 2486: 2484: 2483: 2478: 2476: 2459: 2433: 2407:list → bool and 2348: 2346: 2345: 2340: 2275: 2273: 2272: 2267: 2216: 2214: 2213: 2208: 2157: 2155: 2154: 2149: 2126: 2124: 2123: 2120:{\displaystyle } 2118: 2085: 2083: 2082: 2077: 2011: 2009: 2008: 2003: 2001: 2000: 1972: 1970: 1969: 1964: 1962: 1961: 1933: 1931: 1930: 1925: 1909: 1907: 1906: 1901: 1889: 1887: 1886: 1881: 1866: 1864: 1863: 1858: 1811: 1810: 1779: 1777: 1776: 1771: 1769: 1768: 1702: 1695: 1691: 1688: 1682: 1659: 1651: 1546: 1544: 1543: 1538: 1512: 1510: 1509: 1504: 1502: 1501: 1482: 1480: 1479: 1474: 1472: 1471: 1452: 1450: 1449: 1444: 1442: 1441: 1419: 1417: 1416: 1411: 1399: 1397: 1396: 1391: 1389: 1388: 1369: 1367: 1366: 1361: 1349: 1347: 1346: 1341: 1333: 1332: 1305: 1304: 1282: 1280: 1279: 1274: 1272: 1228: 1227: 1171: 1170: 1140: 1138: 1137: 1132: 1130: 1129: 1110: 1108: 1107: 1102: 1100: 1099: 1080: 1078: 1077: 1072: 1070: 1069: 1041: 1039: 1038: 1033: 1031: 1030: 1014: 1012: 1011: 1006: 990: 988: 987: 982: 980: 979: 951: 949: 948: 943: 941: 940: 918: 916: 915: 910: 863: 862: 831: 829: 828: 823: 811: 809: 808: 805:{\displaystyle } 803: 785: 783: 782: 777: 772: 771: 747: 746: 722: 721: 696: 694: 693: 688: 683: 682: 661: 660: 639: 638: 616: 614: 613: 608: 606: 605: 569: 567: 566: 561: 559: 558: 527: 525: 524: 519: 500: 498: 497: 492: 469: 468: 438: 436: 435: 430: 428: 427: 411: 409: 408: 403: 401: 400: 376: 375: 347: 345: 344: 339: 337: 336: 318: 317: 295: 293: 292: 287: 285: 284: 269: 268: 249: 247: 246: 241: 224: 223: 201:Basic definition 144: 137: 130: 96:Virtual function 73:Generic function 30: 21: 3672: 3671: 3667: 3666: 3665: 3663: 3662: 3661: 3637: 3636: 3635: 3630: 3611:Type conversion 3546: 3540: 3476:Enumerated type 3449: 3335: 3329:null-terminated 3305: 3270: 3158: 3115: 3110: 3075: 3059: 3008: 2996: 2963: 2955: 2949: 2913: 2900: 2894: 2870: 2848:10.2307/1995158 2828: 2823: 2818: 2810: 2806: 2791: 2765: 2764: 2760: 2750: 2748: 2740:Kwang Yul Seo. 2739: 2738: 2734: 2722: 2718: 2712:quantification. 2704: 2702: 2700:www.haskell.org 2694: 2693: 2689: 2679: 2677: 2668: 2667: 2663: 2653: 2651: 2643:Yorgey, Brent. 2642: 2641: 2637: 2595: 2582: 2581: 2577: 2570: 2552: 2551: 2536: 2532: 2505: 2449: 2421: 2420: 2376: 2370: 2358:typed λ-calculi 2316: 2315: 2292: 2219: 2218: 2172: 2171: 2140: 2139: 2088: 2087: 2041: 2040: 2037: 1975: 1974: 1936: 1935: 1916: 1915: 1892: 1891: 1872: 1871: 1785: 1784: 1743: 1742: 1703: 1692: 1686: 1683: 1672: 1660: 1649: 1644: 1560: 1526: 1525: 1485: 1484: 1455: 1454: 1453:in the call to 1422: 1421: 1402: 1401: 1372: 1371: 1352: 1351: 1288: 1287: 1270: 1269: 1229: 1213: 1212: 1172: 1150: 1149: 1113: 1112: 1083: 1082: 1044: 1043: 1017: 1016: 997: 996: 991:are said to be 954: 953: 927: 926: 837: 836: 814: 813: 788: 787: 699: 698: 619: 618: 580: 579: 533: 532: 510: 509: 455: 454: 414: 413: 350: 349: 298: 297: 252: 251: 210: 209: 203: 148: 106:Double dispatch 28: 23: 22: 15: 12: 11: 5: 3670: 3668: 3660: 3659: 3654: 3649: 3639: 3638: 3632: 3631: 3629: 3628: 3623: 3618: 3613: 3608: 3603: 3598: 3593: 3588: 3583: 3582: 3581: 3571: 3566: 3564:Data structure 3561: 3556: 3550: 3548: 3542: 3541: 3539: 3538: 3533: 3528: 3523: 3518: 3513: 3508: 3503: 3498: 3493: 3488: 3483: 3478: 3473: 3468: 3463: 3457: 3455: 3451: 3450: 3448: 3447: 3446: 3445: 3435: 3430: 3425: 3420: 3415: 3410: 3409: 3408: 3398: 3393: 3388: 3383: 3378: 3373: 3368: 3363: 3358: 3357: 3356: 3345: 3343: 3337: 3336: 3334: 3333: 3332: 3331: 3321: 3315: 3313: 3307: 3306: 3304: 3303: 3298: 3297: 3296: 3291: 3280: 3278: 3272: 3271: 3269: 3268: 3263: 3258: 3257: 3256: 3246: 3245: 3244: 3243: 3242: 3232: 3227: 3222: 3217: 3212: 3211: 3210: 3205: 3203:Half precision 3200: 3190:Floating point 3187: 3182: 3177: 3172: 3166: 3164: 3160: 3159: 3157: 3156: 3151: 3146: 3141: 3136: 3131: 3125: 3123: 3117: 3116: 3111: 3109: 3108: 3101: 3094: 3086: 3080: 3079: 3073: 3057: 3028:10.1.1.117.695 3021:(4): 471–523. 2998:Cardelli, Luca 2994: 2976:(3): 348–375. 2953: 2947: 2911: 2898: 2892: 2868: 2826: 2822: 2819: 2817: 2816: 2804: 2789: 2758: 2746:kseo.github.io 2732: 2716: 2687: 2661: 2635: 2575: 2568: 2533: 2531: 2528: 2527: 2526: 2521: 2516: 2511: 2504: 2501: 2475: 2472: 2469: 2466: 2462: 2458: 2455: 2452: 2448: 2444: 2441: 2437: 2432: 2429: 2372:Main article: 2369: 2366: 2338: 2335: 2332: 2329: 2326: 2323: 2291: 2288: 2284:Type inference 2280:polymorphic". 2265: 2262: 2259: 2256: 2253: 2250: 2247: 2244: 2241: 2238: 2235: 2232: 2229: 2226: 2206: 2203: 2200: 2197: 2194: 2191: 2188: 2185: 2182: 2179: 2147: 2116: 2113: 2110: 2107: 2104: 2101: 2098: 2095: 2075: 2072: 2069: 2066: 2063: 2060: 2057: 2054: 2051: 2048: 2036: 2033: 2018:type inference 1999: 1996: 1993: 1990: 1987: 1984: 1960: 1957: 1954: 1951: 1948: 1945: 1923: 1899: 1879: 1868: 1867: 1856: 1853: 1850: 1847: 1844: 1841: 1838: 1835: 1832: 1829: 1826: 1823: 1820: 1817: 1814: 1809: 1806: 1803: 1800: 1797: 1794: 1767: 1764: 1761: 1758: 1755: 1752: 1705: 1704: 1663: 1661: 1654: 1648: 1645: 1643: 1640: 1559: 1556: 1536: 1533: 1500: 1497: 1494: 1470: 1467: 1464: 1440: 1437: 1434: 1431: 1409: 1387: 1384: 1381: 1359: 1339: 1336: 1331: 1328: 1325: 1322: 1317: 1314: 1311: 1308: 1303: 1300: 1297: 1284: 1283: 1268: 1265: 1262: 1259: 1256: 1253: 1250: 1247: 1244: 1241: 1238: 1235: 1232: 1230: 1226: 1223: 1220: 1215: 1214: 1211: 1208: 1205: 1202: 1199: 1196: 1193: 1190: 1187: 1184: 1181: 1178: 1175: 1173: 1169: 1166: 1163: 1158: 1157: 1128: 1125: 1122: 1098: 1095: 1092: 1068: 1065: 1062: 1059: 1056: 1053: 1029: 1026: 1004: 978: 975: 972: 969: 966: 963: 939: 936: 920: 919: 908: 905: 902: 899: 896: 893: 890: 887: 884: 881: 878: 875: 872: 869: 866: 861: 858: 855: 852: 849: 846: 821: 801: 798: 795: 775: 770: 767: 764: 761: 756: 753: 750: 745: 742: 739: 736: 731: 728: 725: 720: 717: 714: 711: 706: 686: 681: 678: 675: 670: 667: 664: 659: 656: 653: 648: 645: 642: 637: 634: 631: 626: 604: 601: 598: 595: 592: 589: 570:function that 557: 554: 551: 548: 545: 542: 517: 502: 501: 490: 487: 484: 481: 478: 475: 472: 467: 464: 426: 423: 399: 396: 393: 390: 387: 384: 379: 374: 371: 368: 365: 362: 359: 335: 332: 329: 326: 321: 316: 313: 310: 307: 283: 280: 277: 272: 267: 264: 261: 239: 236: 233: 230: 227: 222: 219: 202: 199: 150: 149: 147: 146: 139: 132: 124: 121: 120: 119: 118: 113: 108: 103: 98: 90: 89: 83: 82: 81: 80: 75: 67: 66: 60: 59: 58: 57: 52: 44: 43: 37: 36: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 3669: 3658: 3655: 3653: 3650: 3648: 3645: 3644: 3642: 3627: 3624: 3622: 3619: 3617: 3614: 3612: 3609: 3607: 3604: 3602: 3599: 3597: 3594: 3592: 3589: 3587: 3584: 3580: 3577: 3576: 3575: 3572: 3570: 3567: 3565: 3562: 3560: 3557: 3555: 3552: 3551: 3549: 3543: 3537: 3534: 3532: 3529: 3527: 3524: 3522: 3519: 3517: 3514: 3512: 3509: 3507: 3504: 3502: 3499: 3497: 3494: 3492: 3489: 3487: 3486:Function type 3484: 3482: 3479: 3477: 3474: 3472: 3469: 3467: 3464: 3462: 3459: 3458: 3456: 3452: 3444: 3441: 3440: 3439: 3436: 3434: 3431: 3429: 3426: 3424: 3421: 3419: 3416: 3414: 3411: 3407: 3404: 3403: 3402: 3399: 3397: 3394: 3392: 3389: 3387: 3384: 3382: 3379: 3377: 3374: 3372: 3369: 3367: 3364: 3362: 3359: 3355: 3352: 3351: 3350: 3347: 3346: 3344: 3342: 3338: 3330: 3327: 3326: 3325: 3322: 3320: 3317: 3316: 3314: 3312: 3308: 3302: 3299: 3295: 3292: 3290: 3287: 3286: 3285: 3282: 3281: 3279: 3277: 3273: 3267: 3264: 3262: 3259: 3255: 3252: 3251: 3250: 3247: 3241: 3238: 3237: 3236: 3233: 3231: 3228: 3226: 3223: 3221: 3218: 3216: 3213: 3209: 3206: 3204: 3201: 3199: 3196: 3195: 3193: 3192: 3191: 3188: 3186: 3183: 3181: 3178: 3176: 3173: 3171: 3168: 3167: 3165: 3161: 3155: 3152: 3150: 3147: 3145: 3142: 3140: 3137: 3135: 3132: 3130: 3127: 3126: 3124: 3122: 3121:Uninterpreted 3118: 3114: 3107: 3102: 3100: 3095: 3093: 3088: 3087: 3084: 3076: 3070: 3067:. MIT Press. 3066: 3062: 3058: 3054: 3050: 3046: 3042: 3038: 3034: 3029: 3024: 3020: 3016: 3015: 3007: 3003: 3002:Wegner, Peter 2999: 2995: 2991: 2987: 2983: 2979: 2975: 2971: 2970: 2962: 2958: 2957:Milner, Robin 2954: 2950: 2944: 2940: 2936: 2932: 2928: 2924: 2920: 2916: 2912: 2907: 2903: 2899: 2895: 2893:9780720422597 2889: 2885: 2881: 2877: 2873: 2869: 2865: 2861: 2857: 2853: 2849: 2845: 2841: 2837: 2836: 2831: 2827: 2825: 2824: 2820: 2813: 2808: 2805: 2800: 2796: 2792: 2786: 2781: 2776: 2772: 2771: 2762: 2759: 2747: 2743: 2736: 2733: 2729: 2725: 2720: 2717: 2713: 2701: 2697: 2691: 2688: 2676: 2672: 2669:Wu, Brandon. 2665: 2662: 2650: 2646: 2639: 2636: 2631: 2627: 2623: 2619: 2615: 2611: 2607: 2603: 2599: 2591: 2590: 2585: 2579: 2576: 2571: 2565: 2562:. MIT Press. 2561: 2560: 2555: 2549: 2547: 2545: 2543: 2541: 2539: 2535: 2529: 2525: 2522: 2520: 2517: 2515: 2512: 2510: 2509:Parametricity 2507: 2506: 2502: 2500: 2498: 2494: 2490: 2456: 2453: 2450: 2442: 2435: 2418: 2414: 2410: 2406: 2402: 2398: 2394: 2389: 2385: 2381: 2380:Luca Cardelli 2375: 2367: 2365: 2363: 2359: 2355: 2350: 2336: 2330: 2327: 2324: 2313: 2308: 2307:impredicative 2304: 2300: 2297:(also called 2296: 2289: 2287: 2285: 2281: 2279: 2263: 2254: 2245: 2239: 2236: 2233: 2204: 2195: 2189: 2186: 2183: 2169: 2165: 2161: 2137: 2133: 2128: 2111: 2105: 2102: 2099: 2073: 2064: 2058: 2055: 2052: 2034: 2032: 2030: 2026: 2021: 2019: 2015: 1921: 1913: 1912:impredicative 1897: 1877: 1851: 1839: 1833: 1827: 1821: 1818: 1812: 1783: 1782: 1781: 1739: 1737: 1733: 1729: 1725: 1721: 1719: 1714: 1713: 1701: 1698: 1690: 1687:February 2019 1680: 1676: 1670: 1669: 1664:This section 1662: 1658: 1653: 1652: 1646: 1641: 1639: 1637: 1634: 1629: 1625: 1621: 1617: 1613: 1609: 1605: 1601: 1597: 1593: 1592:Visual Prolog 1589: 1585: 1581: 1577: 1573: 1569: 1565: 1557: 1555: 1553: 1549: 1534: 1523: 1519: 1514: 1407: 1357: 1315: 1312: 1266: 1260: 1257: 1254: 1251: 1248: 1242: 1239: 1233: 1231: 1209: 1203: 1200: 1197: 1194: 1191: 1185: 1182: 1176: 1174: 1148: 1147: 1146: 1144: 1002: 994: 923: 903: 891: 885: 879: 873: 870: 864: 835: 834: 833: 819: 796: 726: 643: 577: 573: 529: 515: 507: 488: 482: 479: 476: 470: 453: 452: 451: 449: 448:type variable 446: 442: 237: 234: 228: 208: 200: 198: 196: 192: 187: 185: 181: 177: 173: 169: 165: 161: 157: 145: 140: 138: 133: 131: 126: 125: 123: 122: 117: 114: 112: 109: 107: 104: 102: 99: 97: 94: 93: 92: 91: 88: 84: 79: 76: 74: 71: 70: 69: 68: 65: 61: 56: 53: 51: 48: 47: 46: 45: 42: 38: 35: 31: 19: 3585: 3391:Intersection 3064: 3018: 3012: 2973: 2967: 2930: 2922: 2905: 2875: 2839: 2833: 2807: 2767: 2761: 2751:30 September 2749:. Retrieved 2745: 2735: 2727: 2719: 2710: 2703:. Retrieved 2699: 2690: 2678:. Retrieved 2674: 2664: 2652:. Retrieved 2648: 2638: 2608:(1): 11–49. 2605: 2601: 2588: 2578: 2558: 2408: 2404: 2400: 2396: 2387: 2384:Peter Wegner 2377: 2351: 2303:formal logic 2298: 2294: 2293: 2282: 2277: 2167: 2163: 2159: 2135: 2131: 2129: 2127:may not be. 2038: 2022: 1911: 1869: 1740: 1735: 1732:type schemas 1731: 1716: 1710: 1708: 1693: 1684: 1673:Please help 1668:verification 1665: 1614:and others. 1561: 1515: 1285: 992: 924: 921: 572:concatenates 530: 506:instantiated 505: 503: 441:most general 204: 194: 188: 179: 175: 163: 153: 63: 34:Polymorphism 3657:Type theory 3621:Type theory 3616:Type system 3466:Bottom type 3413:Option type 3354:generalized 3240:Long double 3185:Fixed point 2393:Standard ML 2362:lambda cube 2354:type theory 2014:type system 1720:polymorphic 1712:predicative 1568:Standard ML 160:type theory 3641:Categories 3526:Empty type 3521:Type class 3471:Collection 3428:Refinement 3406:metaobject 3254:signedness 3113:Data types 2821:References 2790:1581130953 2724:Milner, R. 2417:type class 1608:TypeScript 1552:call sites 1548:quantifier 172:data types 3601:Subtyping 3596:Interface 3579:metaclass 3531:Unit type 3501:Semaphore 3481:Exception 3386:Inductive 3376:Dependent 3341:Composite 3319:Character 3301:Reference 3198:Minifloat 3154:Bit array 3045:0360-0300 3023:CiteSeerX 2842:: 29–60, 2705:1 October 2680:1 October 2654:1 October 2622:1573-0557 2461:→ 2454:α 2447:→ 2443:α 2440:⇒ 2436:α 2378:In 1985, 2337:α 2334:→ 2331:α 2325:α 2322:∀ 2261:→ 2252:→ 2246:α 2243:→ 2240:α 2234:α 2231:∀ 2202:→ 2196:α 2193:→ 2190:α 2184:α 2181:∀ 2146:∀ 2112:α 2109:→ 2106:α 2100:α 2097:∀ 2071:→ 2065:α 2062:→ 2059:α 2053:α 2050:∀ 1898:α 1852:α 1846:→ 1840:α 1834:× 1828:α 1819:α 1816:∀ 1736:monotypes 1535:α 1532:∀ 1408:β 1358:α 1267:β 1264:→ 1261:β 1258:× 1255:α 1249:β 1246:∀ 1240:α 1237:∀ 1210:α 1207:→ 1204:β 1201:× 1198:α 1192:β 1189:∀ 1183:α 1180:∀ 1003:α 904:α 898:→ 892:α 886:× 880:α 871:α 868:∀ 752:→ 727:× 666:→ 644:× 516:α 489:α 486:→ 483:α 477:α 474:∀ 378:→ 320:→ 271:→ 168:functions 87:Subtyping 3626:Variable 3516:Top type 3381:Equality 3289:physical 3266:Rational 3261:Interval 3208:bfloat16 3063:(2002). 2959:(1978). 2917:(1974), 2904:(1972), 2799:14183560 2630:14124601 2586:(1967), 2556:(2002). 2503:See also 2489:subtypes 2312:System F 2217:but not 1914:system, 3569:Generic 3545:Related 3461:Boolean 3418:Product 3294:virtual 3284:Address 3276:Pointer 3249:Integer 3180:Decimal 3175:Complex 3163:Numeric 3053:2921816 2864:0253905 2856:1995158 2413:Haskell 1588:Mercury 1584:Haskell 1558:History 1522:Haskell 1015:. Both 195:uniform 3559:Boxing 3547:topics 3506:Stream 3443:tagged 3401:Object 3324:String 3071:  3051:  3043:  3025:  2990:388583 2988:  2945:  2890:  2862:  2854:  2797:  2787:  2628:  2620:  2566:  2388:bounds 1718:prenex 1628:Delphi 1604:Python 1524:, the 1518:syntax 3454:Other 3438:Union 3371:Class 3361:Array 3144:Tryte 3049:S2CID 3009:(PDF) 2986:S2CID 2964:(PDF) 2852:JSTOR 2795:S2CID 2626:S2CID 2530:Notes 2025:OCaml 1728:Nuprl 1709:In a 1600:Julia 1596:Scala 1572:OCaml 576:lists 3574:Kind 3536:Void 3396:List 3311:Text 3149:Word 3139:Trit 3134:Byte 3069:ISBN 3041:ISSN 2943:ISBN 2888:ISBN 2785:ISBN 2753:2022 2707:2022 2682:2022 2656:2022 2618:ISSN 2564:ISBN 2495:and 2382:and 1726:and 1626:and 1616:Java 1516:The 1400:and 1143:pair 1111:and 1042:and 952:and 574:two 178:and 170:and 158:and 3433:Set 3129:Bit 3033:doi 2978:doi 2935:doi 2880:doi 2844:doi 2840:146 2775:doi 2610:doi 2499:). 2409:’’a 2405:’’a 2401:’’a 2397:’’a 2352:In 1677:by 1633:C++ 1612:C++ 1580:Ada 154:In 3643:: 3047:. 3039:. 3031:. 3019:17 3017:. 3011:. 3000:; 2984:. 2974:17 2972:. 2966:. 2941:, 2931:19 2929:, 2925:, 2921:, 2886:. 2860:MR 2858:, 2850:, 2838:, 2793:. 2783:. 2744:. 2709:. 2698:. 2673:. 2647:. 2624:. 2616:. 2606:13 2604:. 2600:. 2537:^ 2403:Ă— 2029:ML 1738:. 1638:. 1622:, 1620:C# 1618:, 1610:, 1606:, 1602:, 1598:, 1594:, 1590:, 1586:, 1582:, 1578:, 1576:F# 1574:, 1570:, 1564:ML 1554:. 1513:. 1350:, 697:, 450:: 348:, 296:, 186:. 162:, 3105:e 3098:t 3091:v 3077:. 3055:. 3035:: 2992:. 2980:: 2952:. 2937:: 2910:. 2896:. 2882:: 2867:. 2846:: 2814:. 2801:. 2777:: 2755:. 2684:. 2658:. 2632:. 2612:: 2572:. 2474:l 2471:o 2468:o 2465:B 2457:] 2451:[ 2431:q 2428:E 2328:. 2278:n 2264:T 2258:) 2255:T 2249:) 2237:. 2228:( 2225:( 2205:T 2199:) 2187:. 2178:( 2168:k 2164:k 2160:k 2136:k 2132:k 2115:] 2103:. 2094:[ 2074:T 2068:) 2056:. 2047:( 1998:d 1995:n 1992:e 1989:p 1986:p 1983:a 1959:d 1956:n 1953:e 1950:p 1947:p 1944:a 1922:T 1878:T 1855:] 1849:[ 1843:] 1837:[ 1831:] 1825:[ 1822:. 1813:: 1808:d 1805:n 1802:e 1799:p 1796:p 1793:a 1766:d 1763:n 1760:e 1757:p 1754:p 1751:a 1700:) 1694:( 1689:) 1685:( 1671:. 1499:t 1496:n 1493:I 1469:t 1466:s 1463:f 1439:l 1436:o 1433:o 1430:B 1386:t 1383:n 1380:I 1338:) 1335:) 1330:e 1327:u 1324:r 1321:t 1316:, 1313:3 1310:( 1307:( 1302:t 1299:s 1296:f 1252:. 1243:. 1234:: 1225:d 1222:n 1219:s 1195:. 1186:. 1177:: 1168:t 1165:s 1162:f 1127:d 1124:n 1121:s 1097:t 1094:s 1091:f 1067:d 1064:n 1061:e 1058:p 1055:p 1052:a 1028:d 1025:i 977:d 974:n 971:e 968:p 965:p 962:a 938:d 935:i 907:] 901:[ 895:] 889:[ 883:] 877:[ 874:. 865:: 860:d 857:n 854:e 851:p 848:p 845:a 820:T 800:] 797:T 794:[ 774:] 769:l 766:o 763:o 760:B 755:[ 749:] 744:l 741:o 738:o 735:B 730:[ 724:] 719:l 716:o 713:o 710:B 705:[ 685:] 680:t 677:n 674:I 669:[ 663:] 658:t 655:n 652:I 647:[ 641:] 636:t 633:n 630:I 625:[ 603:d 600:n 597:e 594:p 591:p 588:a 556:d 553:n 550:e 547:p 544:p 541:a 480:. 471:: 466:d 463:i 425:d 422:i 398:g 395:n 392:i 389:r 386:t 383:S 373:g 370:n 367:i 364:r 361:t 358:S 334:l 331:o 328:o 325:B 315:l 312:o 309:o 306:B 282:t 279:n 276:I 266:t 263:n 260:I 238:x 235:= 232:) 229:x 226:( 221:d 218:i 143:e 136:t 129:v 20:)

Index

Predicative polymorphism
Polymorphism
Ad hoc polymorphism
Function overloading
Operator overloading
Parametric polymorphism
Generic function
Generic programming
Subtyping
Virtual function
Single and dynamic dispatch
Double dispatch
Multiple dispatch
Predicate dispatch
v
t
e
programming languages
type theory
functions
data types
generic programming
ad hoc polymorphism
identity function
most general
universally quantified
type variable
concatenates
lists
pair

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑