Knowledge (XXG)

Type class

Source 📝

702:, multi-parameter type classes support calling different implementations of a method depending on the types of multiple arguments, and indeed return types. Multi-parameter type classes do not require searching for the method to call on every call at runtime; rather the method to call is first compiled and stored in the dictionary of the type class instance, just as with single-parameter type classes. 1331:
which can be implemented with existing language features such as implicit parameters, not a separate language feature per se. Because of the way they are implemented in Scala, it is possible to explicitly specify which type class instance to use for a type at a particular place in the code, in case
896:
type classes are just ordinary values in the language, rather than a completely separate kind of entity. While these instances are by default supplied by finding appropriate instances in scope to be used as the implicit actual parameters for explicitly-declared implicit formal parameters, the fact
857:
property, which requires that there should only be one unique choice of instance for any given type. The coherence property makes type classes somewhat antimodular, which is why orphan instances (instances that are defined in a module that neither contains the class nor the type of interest) are
1339:
has also supported type classes in recent versions. Unlike in ordinary programming languages, in Coq, any laws of a type class (such as the monad laws) that are stated within the type class definition, must be mathematically proved of each type class instance before using them.
1119:, but all equality operators are derived automatically by the compiler. The programmer's control of the process is limited to designating which type components in a structure are equality types and which type variables in a polymorphic type range over equality types. 881:, which defines a comparison operator on the elements. However, there can be numerous ways to impose a total order. Since set algorithms are generally intolerant of changes in the ordering once a set has been constructed, passing an incompatible instance of 897:
that they are ordinary values means that they can be supplied explicitly, to resolve ambiguity. As a result, Scala type classes do not satisfy the coherence property and are effectively a syntactic sugar for implicit parameters.
103:
Type classes are defined by specifying a set of function or constant names, together with their respective types, that must exist for every type that belongs to the class. In Haskell, types can be parameterized; a type class
858:
strongly discouraged. On the other hand, coherence adds an additional level of safety to the language, providing the programmer a guarantee that two disjoint parts of the same code will share the same instance.
91:
in a principled fashion. In contrast with the "eqtypes" of Standard ML, overloading the equality operator through the use of type classes in Haskell does not require extensive modification of the
1126:'s modules and functors can play a role similar to that of Haskell's type classes, the principal difference being the role of type inference, which makes type classes suitable for 721:. That is, the programmer can assert that a given assignment of some subset of the type parameters uniquely determines the remaining type parameters. For example, a general 705:
Haskell code that uses multi-parameter type classes is not portable, as this feature is not part of the Haskell 98 standard. The popular Haskell implementations, GHC and
525:
but can take one of any kind. These type classes with higher kinds are sometimes called constructor classes (the constructors referred to are type constructors such as
1585:
In GHC, the C Core uses Girard & Reynold's System F type signatures to identify a typed case for processing in the optimization phases. -- Simon Peyton-Jones "
245: 225: 774:
Type classes and implicit parameters are very similar in nature, although not quite the same. A polymorphic function with a type class constraint such as:
2098: 692: 2469: 2103: 2093: 2088: 717:
In Haskell, type classes have been refined to allow the programmer to declare functional dependencies between type parameters—a concept
1815: 2076: 1977: 19:
This article is about polymorphic type systems in computer science. For the mathematical class of order-types of a given cardinality, see
1847: 1762: 1738: 1630: 1531: 2520: 2227: 1349: 1713:
Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA '10)
2344: 2149: 2081: 2043: 1455: 1367: 1355: 1317: 722: 534: 193:
defines the function signatures for 2 functions (the equality and inequality functions), which each take 2 arguments of type
76: 671:
Type classes permit multiple type parameters, and so type classes can be seen as relations on types. For example, in the
2244: 2174: 2022: 1324: 1311: 1301: 893: 27: 2499: 1383: 1307: 2254: 2122: 2432: 2384: 2296: 2274: 2269: 2197: 2063: 2306: 1970: 1556: 1332:
of ambiguity. However, this is not necessarily a benefit as ambiguous type class instances can be error-prone.
1143: 885:
to functions that operate on the set may lead to incorrect results (or crashes). Thus, enforcing coherence of
862: 757: 672: 480: 252: 1788: 1546: 1831:
Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '07)
1665: 2459: 2374: 1099:(version 8.2 onwards) also supports type classes by inferring the appropriate instances. Recent versions of 50: 2202: 2058: 2017: 2012: 1909: 1795: 1716: 1608: 1509: 20: 1886: 1504:
Appel, A.W.; MacQueen, D.B. (1991). "Standard ML of New Jersey". In Maluszyński, J.; Wirsing, M. (eds.).
2192: 2167: 1901: 1100: 718: 1440:
Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '89)
842:. (This is in fact how type classes are implemented under the hood by the Glasgow Haskell Compiler.) 2525: 1994: 1914: 1361: 88: 1800: 1721: 2530: 2464: 2442: 2369: 2222: 2214: 2134: 1963: 1613: 1514: 68:
can only be instantiated to a type whose members support the overloaded operations associated with
46: 2447: 2427: 2379: 2354: 2139: 2108: 1853: 1744: 1690: 1461: 766:
has objected to the introduction of functional dependencies in Haskell on grounds of complexity.
763: 706: 519: 205: 498:
Type classes are closely related to parametric polymorphism. For example, note that the type of
1943: 2334: 2264: 2239: 2053: 2048: 1843: 1734: 1626: 1527: 1451: 1328: 1161:. As an illustration, the above mentioned Haskell example of typeclass Eq would be written as 92: 1377: 1158: 2479: 2364: 2162: 1835: 1726: 1618: 1519: 1484: 1443: 1413: 34: 2484: 2349: 2301: 2234: 1479:
Kaes, Stefan (March 1988). "Parametric overloading in polymorphic programming languages".
1115:, the mechanism of "equality types" corresponds roughly to Haskell's built-in type class 1828:
Dreyer, Derek; Harper, Robert; Chakravarty, Manuel M.T. (2007). "Modular Type Classes".
679:
expresses a general immutable array interface. In this class, the type class constraint
2437: 2259: 2249: 2157: 1871: 1705: 1336: 1096: 753: 230: 210: 1404: 297:, of the appropriate types, defined on it". A programmer could then define a function 108:
intended to contain types that admit equality would be declared in the following way:
2514: 2359: 1748: 80: 58: 1465: 2316: 2291: 1942:
Advanced Functional Programming course at Utrecht University, 74 lecture slides on
1857: 1435: 465:
in whatever way they see fit. Once they have done this, they may use the function
1949: 1650: 1607:. Lecture Notes in Computer Science. Vol. 1782. Springer. pp. 230–244. 1600: 1572: 1134:
is yet another approach which is somewhat comparable to the one of type classes.
2494: 2489: 2339: 2286: 2113: 1645: 1567: 1147: 1112: 870: 802:
can be intuitively treated as a function that implicitly accepts an instance of
699: 84: 42: 1931: 2399: 2311: 2279: 2184: 2127: 1684: 1586: 1775: 1622: 1523: 1508:. Lecture Notes in Computer Science. Vol. 528. Springer. pp. 1–13. 2474: 2452: 2409: 2404: 2071: 2027: 1986: 1839: 1730: 1489: 1829: 1304:
typeclasses are similar to Haskell, but have a slightly different syntax.
2389: 624:
The fact that m is applied to a type variable indicates that it has kind
1763:"The Neophyte's Guide to Scala Part 12: Type classes - Daniel Westheide" 1447: 1320:
has typeclasses, although they are not exactly the same as in Haskell.
1417: 1506:
Programming Language Implementation and Logic Programming. PLILP 1991
845:
However, there is a crucial difference: implicit parameters are more
944:// A polymorphic function that works only when there is an implicit 301:(which determines if an element is in a list) in the following way: 1154: 1412:(PhD). Department of Computer Science, Portland State University. 1131: 1123: 838:
is essentially a record that contains the instance definition of
2007: 1704:
Oliveira, Bruno C.d.S.; Moors, Adriaan; Odersky, Martin (2010).
502:
as specified above would be the parametrically polymorphic type
1959: 1103:
2 also provide a similar feature, called "instance arguments".
877:) in order to function. This can be evidenced by a constraint 2002: 49:. This is achieved by adding constraints to type variables in 1955: 1789:"A Gentle Introduction to Type Classes and Relations in Coq" 1900:
Peyton Jones, Simon; Jones, Mark; Meijer, Erik (May 1997).
1314:, which are a limited form of type classes with coherence. 1715:. Association for Computing Machinery. pp. 341–360. 1587:
Into the Core - Squeezing Haskell into Nine Constructors"
1067:// The parameter stringShow was inserted by the compiler. 691:. (This restriction on polymorphism is used to implement 483:
in object-oriented programming languages. In particular,
453:. For instance, if a programmer defines a new data type 87:, and were originally conceived as a way of implementing 53:
types. Such a constraint typically involves a type class
1358:(the language in which type classes were first designed) 1142:
An analogous notion for overloaded data (implemented in
1442:. Association for Computing Machinery. pp. 60–76. 1406:
Type Classes and Instance Chains: A Relational Approach
900:
This is an example taken from the Cats documentation:
736:. In this constraint, there is a functional dependency 628:, i.e. it takes a type and returns a type, the kind of 461:
by providing an equality function over values of type
1481:
Proc. 2nd European Symposium on Programming Languages
1157:
notably C++20 has support for type classes using the
233: 213: 2418: 2327: 2213: 2183: 2148: 2036: 1993: 853:. In contrast, type classes enforce the so-called 1902:"Type classes: an exploration of the design space" 752:is uniquely determined. This aids the compiler in 457:, they may then make this new type an instance of 239: 219: 83:and Stephen Blott as an extension to "eqtypes" in 905:// A type class to provide textual representation 687:is an array type that contains elements of type 281:The declaration may be read as stating a "type 1887:"Specialization, coherence, and API evolution" 1816:Modelling Type Classes With Instance Arguments 518:A type class need not take a type variable of 1971: 1436:"How to make ad-hoc polymorphism less ad hoc" 1429: 1427: 8: 1950:Implementing, and Understanding Type Classes 1605:Programming Languages and Systems. ESOP 2000 1130:polymorphism. The object oriented subset of 89:overloaded arithmetic and equality operators 1601:"Type Classes with Functional Dependencies" 506:were it not for the type class constraint " 487:is not a type: there is no such thing as a 75:Type classes were first implemented in the 1978: 1964: 1956: 479:Note that type classes are different from 1913: 1799: 1720: 1612: 1513: 1488: 232: 212: 1107:Other approaches to operator overloading 889:in this particular scenario is crucial. 728:which carries a state parameter of type 719:inspired from relational database theory 709:, support multi-parameter type classes. 529:, rather than data constructors such as 1706:"Type Classes as Objects and Implicits" 1395: 445:that defines implementations of all of 849:– you can pass different instances of 756:, as well as aiding the programmer in 472:, that is, lists of elements of type 430:can be called a 'class constraint'.) 7: 1589:Erlang User Conference, Sep 14, 2016 770:Type classes and implicit parameters 740:. This means that for a given monad 732:satisfies the type class constraint 1666:"MPTCs and functional dependencies" 449:'s methods for the particular type 410:, which constrains the types which 255:release), meaning that the kind of 1906:Proc. ACM SIGPLAN Haskell Workshop 185:is one instance of the type class 14: 1932:"5. Type Classes and Overloading" 1872:"GHC/Type families - HaskellWiki" 1787:Castéran, P.; Sozeau, M. (2014). 1364:(one application of type classes) 892:Instances (or "dictionaries") in 748:, the state type accessible from 1936:A Gentle Introduction to Haskell 1693:from the original on 2021-12-21. 1350:Polymorphism (computer science) 437:a member of a given type class 433:A programmer can make any type 95:or the underlying type system. 21:Glossary of set theory § T 16:Type system in computer science 1434:Wadler, P.; Blott, S. (1989). 1374:is an example of a type class) 1368:Monad (functional programming) 79:after first being proposed by 1: 2044:Arbitrary-precision or bignum 1834:. pp. 63–70. See p. 63. 1555:appeared in version 8 of the 1352:(other kinds of polymorphism) 947:// instance of Show available 289:if there are functions named 1664:Peyton-Jones, Simon (2006). 1356:Haskell programming language 675:standard library, the class 667:Multi-parameter type classes 77:Haskell programming language 28:class (computer programming) 1384:Rust (programming language) 695:array types, for example.) 2547: 1686:Type Classes vs. the World 1670:Haskell-prime mailing list 861:As an example, an ordered 514:Higher-kinded polymorphism 51:parametrically polymorphic 25: 18: 2385:Strongly typed identifier 1776:typelevel.org, Scala Cats 1689:. Boston Haskell Meetup. 1013:// An instance for String 873:on the elements (of type 758:type-directed programming 1938:. June 2000. Version 98. 1623:10.1007/3-540-46425-5_15 1557:Glasgow Haskell Compiler 1524:10.1007/3-540-54444-5_83 1403:Morris, John G. (2013). 1163: 902: 808: 776: 634: 541: 414:can range over to those 303: 261: 110: 45:construct that supports 26:Not to be confused with 2460:Parametric polymorphism 1840:10.1145/1190216.1190229 1731:10.1145/1869459.1869489 1603:. In Smolka, G. (ed.). 1599:Jones, Mark P. (2000). 1490:10.1007/3-540-19027-9_9 713:Functional dependencies 2521:Functional programming 1651:FunctionalDependencies 285:belongs to type class 241: 221: 197:and return a boolean. 1944:Advanced Type Classes 1885:Turon, Aaron (2017). 1573:MultiParamTypeClasses 1327:, type classes are a 533:). An example is the 242: 222: 1362:Operator overloading 1335:The proof assistant 1082:"a string" 443:instance declaration 418:which belong to the 231: 211: 2465:Primitive data type 2370:Recursive data type 2223:Algebraic data type 2099:Quadruple precision 1448:10.1145/75277.75283 504:a -> -> Bool 404:a -> -> Bool 47:ad hoc polymorphism 2428:Abstract data type 2109:Extended precision 2068:Reduced precision 764:Simon Peyton-Jones 237: 217: 200:The type variable 2508: 2507: 2240:Associative array 2104:Octuple precision 1418:10.15760/etd.1010 1329:programming idiom 406:with the context 247:is also known as 240:{\displaystyle *} 220:{\displaystyle *} 93:compiler frontend 64:, and means that 2538: 2480:Type constructor 2365:Opaque data type 2297:Record or Struct 2094:Double precision 2089:Single precision 1980: 1973: 1966: 1957: 1939: 1919: 1917: 1915:10.1.1.1085.8703 1891: 1890: 1882: 1876: 1875: 1868: 1862: 1861: 1825: 1819: 1812: 1806: 1805: 1803: 1793: 1784: 1778: 1773: 1767: 1766: 1759: 1753: 1752: 1724: 1710: 1701: 1695: 1694: 1680: 1674: 1673: 1661: 1655: 1643: 1637: 1636: 1616: 1596: 1590: 1583: 1577: 1565: 1559: 1554: 1549: 1544: 1538: 1537: 1517: 1501: 1495: 1494: 1492: 1476: 1470: 1469: 1431: 1422: 1421: 1411: 1400: 1373: 1296: 1293: 1290: 1287: 1284: 1281: 1278: 1275: 1272: 1269: 1266: 1263: 1260: 1257: 1254: 1251: 1248: 1245: 1242: 1239: 1236: 1233: 1230: 1227: 1224: 1221: 1218: 1215: 1212: 1209: 1206: 1203: 1200: 1197: 1194: 1191: 1188: 1185: 1182: 1179: 1176: 1173: 1170: 1167: 1118: 1092: 1089: 1086: 1083: 1080: 1077: 1074: 1071: 1068: 1065: 1062: 1059: 1056: 1053: 1050: 1047: 1044: 1041: 1038: 1035: 1032: 1029: 1026: 1023: 1020: 1017: 1014: 1011: 1008: 1005: 1002: 999: 996: 993: 990: 987: 984: 981: 978: 975: 972: 969: 966: 963: 960: 957: 954: 951: 948: 945: 942: 939: 936: 933: 930: 927: 924: 921: 918: 915: 912: 909: 906: 888: 884: 880: 876: 868: 852: 841: 837: 830: 827: 824: 821: 818: 815: 812: 805: 798: 795: 792: 789: 786: 783: 780: 751: 747: 743: 739: 735: 731: 727: 690: 686: 682: 678: 662: 659: 656: 653: 650: 647: 644: 641: 638: 631: 627: 620: 617: 614: 611: 608: 605: 602: 599: 596: 593: 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 537: 532: 528: 524: 509: 505: 501: 494: 486: 475: 471: 468: 464: 460: 456: 452: 448: 440: 436: 429: 421: 417: 413: 409: 405: 401: 394: 391: 388: 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 343: 340: 337: 334: 331: 328: 325: 322: 319: 316: 313: 310: 307: 300: 296: 292: 288: 284: 277: 274: 271: 268: 265: 258: 250: 246: 244: 243: 238: 226: 224: 223: 218: 203: 196: 192: 188: 184: 177: 174: 171: 168: 165: 162: 159: 156: 153: 150: 147: 144: 141: 138: 135: 132: 129: 126: 123: 120: 117: 114: 107: 71: 67: 63: 56: 35:computer science 2546: 2545: 2541: 2540: 2539: 2537: 2536: 2535: 2511: 2510: 2509: 2504: 2485:Type conversion 2420: 2414: 2350:Enumerated type 2323: 2209: 2203:null-terminated 2179: 2144: 2032: 1989: 1984: 1930: 1927: 1922: 1899: 1895: 1894: 1884: 1883: 1879: 1870: 1869: 1865: 1850: 1827: 1826: 1822: 1813: 1809: 1801:10.1.1.422.8091 1791: 1786: 1785: 1781: 1774: 1770: 1761: 1760: 1756: 1741: 1722:10.1.1.205.2737 1708: 1703: 1702: 1698: 1683:Kmett, Edward. 1682: 1681: 1677: 1663: 1662: 1658: 1644: 1640: 1633: 1598: 1597: 1593: 1584: 1580: 1566: 1562: 1552: 1547: 1545: 1541: 1534: 1503: 1502: 1498: 1478: 1477: 1473: 1458: 1433: 1432: 1425: 1409: 1402: 1401: 1397: 1392: 1371: 1346: 1298: 1297: 1294: 1291: 1288: 1285: 1282: 1279: 1276: 1273: 1270: 1267: 1264: 1261: 1258: 1255: 1252: 1249: 1246: 1243: 1240: 1237: 1234: 1231: 1228: 1225: 1222: 1219: 1216: 1213: 1210: 1207: 1204: 1201: 1198: 1195: 1192: 1189: 1186: 1183: 1180: 1177: 1174: 1171: 1168: 1165: 1140: 1138:Related notions 1116: 1109: 1094: 1093: 1090: 1087: 1084: 1081: 1078: 1075: 1072: 1069: 1066: 1063: 1060: 1057: 1054: 1051: 1048: 1045: 1042: 1039: 1036: 1033: 1030: 1027: 1024: 1021: 1018: 1015: 1012: 1009: 1006: 1003: 1000: 997: 994: 991: 988: 985: 982: 979: 976: 973: 970: 967: 964: 961: 958: 955: 952: 949: 946: 943: 940: 937: 934: 931: 928: 925: 922: 919: 916: 913: 910: 907: 904: 886: 882: 878: 874: 866: 850: 839: 835: 832: 831: 828: 825: 822: 819: 816: 813: 810: 803: 800: 799: 796: 793: 790: 787: 784: 781: 778: 772: 749: 745: 741: 737: 734:Monad.State s m 733: 729: 725: 715: 688: 684: 680: 676: 669: 664: 663: 660: 657: 654: 651: 648: 645: 642: 639: 636: 629: 626:Type -> Type 625: 622: 621: 618: 615: 612: 609: 606: 603: 600: 597: 594: 591: 588: 585: 582: 579: 576: 573: 570: 567: 564: 561: 558: 555: 552: 549: 546: 543: 535: 530: 526: 522: 516: 507: 503: 499: 492: 484: 473: 470: 466: 462: 458: 454: 450: 446: 438: 434: 427: 419: 415: 411: 407: 403: 399: 396: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 335: 332: 329: 326: 323: 320: 317: 314: 311: 308: 305: 298: 294: 290: 286: 282: 279: 278: 275: 272: 269: 266: 263: 256: 248: 229: 228: 209: 208: 201: 194: 190: 186: 182: 179: 178: 175: 172: 169: 166: 163: 160: 157: 154: 151: 148: 145: 142: 139: 136: 133: 130: 127: 124: 121: 118: 115: 112: 105: 101: 69: 65: 61: 54: 31: 24: 17: 12: 11: 5: 2544: 2542: 2534: 2533: 2528: 2523: 2513: 2512: 2506: 2505: 2503: 2502: 2497: 2492: 2487: 2482: 2477: 2472: 2467: 2462: 2457: 2456: 2455: 2445: 2440: 2438:Data structure 2435: 2430: 2424: 2422: 2416: 2415: 2413: 2412: 2407: 2402: 2397: 2392: 2387: 2382: 2377: 2372: 2367: 2362: 2357: 2352: 2347: 2342: 2337: 2331: 2329: 2325: 2324: 2322: 2321: 2320: 2319: 2309: 2304: 2299: 2294: 2289: 2284: 2283: 2282: 2272: 2267: 2262: 2257: 2252: 2247: 2242: 2237: 2232: 2231: 2230: 2219: 2217: 2211: 2210: 2208: 2207: 2206: 2205: 2195: 2189: 2187: 2181: 2180: 2178: 2177: 2172: 2171: 2170: 2165: 2154: 2152: 2146: 2145: 2143: 2142: 2137: 2132: 2131: 2130: 2120: 2119: 2118: 2117: 2116: 2106: 2101: 2096: 2091: 2086: 2085: 2084: 2079: 2077:Half precision 2074: 2064:Floating point 2061: 2056: 2051: 2046: 2040: 2038: 2034: 2033: 2031: 2030: 2025: 2020: 2015: 2010: 2005: 1999: 1997: 1991: 1990: 1985: 1983: 1982: 1975: 1968: 1960: 1954: 1953: 1947: 1940: 1926: 1925:External links 1923: 1921: 1920: 1896: 1893: 1892: 1877: 1863: 1849:978-1595935755 1848: 1820: 1807: 1779: 1768: 1754: 1739: 1696: 1675: 1656: 1638: 1631: 1614:10.1.1.26.7153 1591: 1578: 1560: 1539: 1532: 1515:10.1.1.55.9444 1496: 1471: 1456: 1423: 1394: 1393: 1391: 1388: 1387: 1386: 1381: 1378:Concepts (C++) 1375: 1365: 1359: 1353: 1345: 1342: 1280:convertible_to 1241:convertible_to 1164: 1159:Concepts (C++) 1139: 1136: 1108: 1105: 903: 871:total ordering 809: 777: 771: 768: 754:type inference 744:of type class 714: 711: 668: 665: 635: 542: 515: 512: 304: 262: 251:in the latest 236: 216: 111: 100: 97: 15: 13: 10: 9: 6: 4: 3: 2: 2543: 2532: 2529: 2527: 2524: 2522: 2519: 2518: 2516: 2501: 2498: 2496: 2493: 2491: 2488: 2486: 2483: 2481: 2478: 2476: 2473: 2471: 2468: 2466: 2463: 2461: 2458: 2454: 2451: 2450: 2449: 2446: 2444: 2441: 2439: 2436: 2434: 2431: 2429: 2426: 2425: 2423: 2417: 2411: 2408: 2406: 2403: 2401: 2398: 2396: 2393: 2391: 2388: 2386: 2383: 2381: 2378: 2376: 2373: 2371: 2368: 2366: 2363: 2361: 2360:Function type 2358: 2356: 2353: 2351: 2348: 2346: 2343: 2341: 2338: 2336: 2333: 2332: 2330: 2326: 2318: 2315: 2314: 2313: 2310: 2308: 2305: 2303: 2300: 2298: 2295: 2293: 2290: 2288: 2285: 2281: 2278: 2277: 2276: 2273: 2271: 2268: 2266: 2263: 2261: 2258: 2256: 2253: 2251: 2248: 2246: 2243: 2241: 2238: 2236: 2233: 2229: 2226: 2225: 2224: 2221: 2220: 2218: 2216: 2212: 2204: 2201: 2200: 2199: 2196: 2194: 2191: 2190: 2188: 2186: 2182: 2176: 2173: 2169: 2166: 2164: 2161: 2160: 2159: 2156: 2155: 2153: 2151: 2147: 2141: 2138: 2136: 2133: 2129: 2126: 2125: 2124: 2121: 2115: 2112: 2111: 2110: 2107: 2105: 2102: 2100: 2097: 2095: 2092: 2090: 2087: 2083: 2080: 2078: 2075: 2073: 2070: 2069: 2067: 2066: 2065: 2062: 2060: 2057: 2055: 2052: 2050: 2047: 2045: 2042: 2041: 2039: 2035: 2029: 2026: 2024: 2021: 2019: 2016: 2014: 2011: 2009: 2006: 2004: 2001: 2000: 1998: 1996: 1995:Uninterpreted 1992: 1988: 1981: 1976: 1974: 1969: 1967: 1962: 1961: 1958: 1952:. 2014-11-13. 1951: 1948: 1946:. 2005-06-07. 1945: 1941: 1937: 1933: 1929: 1928: 1924: 1916: 1911: 1907: 1903: 1898: 1897: 1888: 1881: 1878: 1873: 1867: 1864: 1860:. TR-2006-03. 1859: 1855: 1851: 1845: 1841: 1837: 1833: 1832: 1824: 1821: 1817: 1811: 1808: 1802: 1797: 1790: 1783: 1780: 1777: 1772: 1769: 1764: 1758: 1755: 1750: 1746: 1742: 1740:9781450302036 1736: 1732: 1728: 1723: 1718: 1714: 1707: 1700: 1697: 1692: 1688: 1687: 1679: 1676: 1671: 1667: 1660: 1657: 1653: 1652: 1647: 1642: 1639: 1634: 1632:3-540-46425-5 1628: 1624: 1620: 1615: 1610: 1606: 1602: 1595: 1592: 1588: 1582: 1579: 1575: 1574: 1569: 1564: 1561: 1558: 1550: 1543: 1540: 1535: 1533:3-540-54444-5 1529: 1525: 1521: 1516: 1511: 1507: 1500: 1497: 1491: 1486: 1482: 1475: 1472: 1467: 1463: 1459: 1453: 1449: 1445: 1441: 1437: 1430: 1428: 1424: 1419: 1415: 1408: 1407: 1399: 1396: 1389: 1385: 1382: 1380:(since C++20) 1379: 1376: 1369: 1366: 1363: 1360: 1357: 1354: 1351: 1348: 1347: 1343: 1341: 1338: 1333: 1330: 1326: 1321: 1319: 1315: 1313: 1309: 1305: 1303: 1162: 1160: 1156: 1151: 1149: 1146:) is that of 1145: 1137: 1135: 1133: 1129: 1125: 1120: 1114: 1106: 1104: 1102: 1098: 901: 898: 895: 890: 872: 869:) requires a 864: 859: 856: 848: 843: 834:The instance 807: 775: 769: 767: 765: 761: 759: 755: 724: 720: 712: 710: 708: 703: 701: 696: 694: 674: 666: 633: 540: 538: 521: 513: 511: 496: 490: 482: 477: 444: 431: 425: 422:type class. ( 402:has the type 398:The function 302: 260: 254: 234: 214: 207: 198: 109: 98: 96: 94: 90: 86: 82: 81:Philip Wadler 78: 73: 60: 59:type variable 52: 48: 44: 40: 36: 29: 22: 2394: 2265:Intersection 1935: 1905: 1880: 1866: 1830: 1823: 1810: 1782: 1771: 1757: 1712: 1699: 1685: 1678: 1669: 1659: 1649: 1641: 1604: 1594: 1581: 1571: 1563: 1542: 1505: 1499: 1480: 1474: 1439: 1405: 1398: 1334: 1322: 1316: 1306: 1299: 1152: 1141: 1127: 1121: 1110: 1095: 899: 891: 860: 854: 846: 844: 833: 801: 773: 762: 716: 704: 700:multimethods 697: 670: 623: 517: 497: 488: 478: 442: 441:by using an 432: 423: 397: 280: 199: 180: 102: 74: 38: 32: 2526:Type theory 2495:Type theory 2490:Type system 2340:Bottom type 2287:Option type 2228:generalized 2114:Long double 2059:Fixed point 1148:type family 1113:Standard ML 746:Monad.State 683:means that 85:Standard ML 43:type system 2531:Data types 2515:Categories 2400:Empty type 2395:Type class 2345:Collection 2302:Refinement 2280:metaobject 2128:signedness 1987:Data types 1457:0897912942 1390:References 1122:SML's and 1022:stringShow 681:IArray a e 661:Constraint 508:Eq a => 426:: Haskell 276:Constraint 39:type class 2475:Subtyping 2470:Interface 2453:metaclass 2405:Unit type 2375:Semaphore 2355:Exception 2260:Inductive 2250:Dependent 2215:Composite 2193:Character 2175:Reference 2072:Minifloat 2028:Bit array 1910:CiteSeerX 1796:CiteSeerX 1749:207183083 1717:CiteSeerX 1609:CiteSeerX 1553:Data.Kind 1510:CiteSeerX 1310:supports 865:(of type 855:coherence 738:m -> s 632:is thus: 577:>>= 235:∗ 215:∗ 2500:Variable 2390:Top type 2255:Equality 2163:physical 2140:Rational 2135:Interval 2082:bfloat16 1691:Archived 1646:Haskell' 1568:Haskell' 1466:15327197 1344:See also 1190:requires 1172:typename 1166:template 1016:implicit 971:implicit 847:flexible 491:of type 99:Overview 2443:Generic 2419:Related 2335:Boolean 2292:Product 2168:virtual 2158:Address 2150:Pointer 2123:Integer 2054:Decimal 2049:Complex 2037:Numeric 1858:1828213 1318:Mercury 1181:concept 989:println 851:Num Int 693:unboxed 539:class: 481:classes 2433:Boxing 2421:topics 2380:Stream 2317:tagged 2275:Object 2198:String 1912:  1856:  1846:  1798:  1747:  1737:  1719:  1629:  1611:  1530:  1512:  1464:  1454:  1312:traits 1128:ad hoc 1091:string 1052:String 938:String 836:Num_ a 677:IArray 556:return 428:=> 293:, and 189:, and 181:where 57:and a 2328:Other 2312:Union 2245:Class 2235:Array 2018:Tryte 1854:S2CID 1792:(PDF) 1745:S2CID 1709:(PDF) 1648:page 1570:page 1551:from 1462:S2CID 1410:(PDF) 1372:Monad 1325:Scala 1302:Clean 1271:-> 1232:-> 1184:Equal 1132:OCaml 1124:OCaml 1070:scala 908:trait 894:Scala 887:Ord a 883:Ord a 879:Ord a 867:Set a 840:Num a 826:-> 823:-> 794:-> 791:=> 723:monad 698:Like 658:-> 649:-> 637:Monad 630:Monad 613:-> 601:-> 592:-> 565:-> 553:where 547:Monad 544:class 536:Monad 527:Maybe 489:value 342:False 327:-> 324:-> 318:=> 273:-> 173:-> 167:-> 146:-> 140:-> 122:where 113:class 41:is a 2448:Kind 2410:Void 2270:List 2185:Text 2023:Word 2013:Trit 2008:Byte 1844:ISBN 1735:ISBN 1627:ISBN 1548:Type 1528:ISBN 1452:ISBN 1308:Rust 1289:> 1286:bool 1283:< 1250:> 1247:bool 1244:< 1178:> 1169:< 1101:Agda 1073:> 1040:show 1031:Show 1001:show 980:Show 920:show 911:Show 817:Num_ 811:sum_ 707:Hugs 652:Type 646:Type 531:Just 523:Type 520:kind 500:elem 467:elem 424:Note 408:Eq a 400:elem 387:elem 345:elem 333:elem 330:Bool 306:elem 299:elem 295:(/=) 291:(==) 270:Type 249:Type 206:kind 204:has 176:Bool 149:Bool 37:, a 2307:Set 2003:Bit 1836:doi 1727:doi 1619:doi 1520:doi 1485:doi 1444:doi 1414:doi 1337:Coq 1323:In 1300:In 1274:std 1235:std 1155:C++ 1153:In 1144:GHC 1111:In 1097:Coq 1076:log 1037:def 1028:new 1019:val 953:log 950:def 917:def 863:set 804:Num 785:Num 779:sum 673:GHC 510:". 469:on 259:is 253:GHC 33:In 2517:: 1934:. 1908:. 1904:. 1852:. 1842:. 1818:". 1794:. 1743:. 1733:. 1725:. 1711:. 1668:. 1625:. 1617:. 1526:. 1518:. 1483:. 1460:. 1450:. 1438:. 1426:^ 1295:}; 1277::: 1262:!= 1238::: 1223:== 1150:. 1117:Eq 1010:)) 968:)( 935:): 814::: 806:: 782::: 760:. 640::: 583::: 559::: 495:. 493:Eq 485:Eq 476:. 459:Eq 420:Eq 393:xs 384:|| 375:== 360:xs 312:Eq 309::: 287:Eq 267::: 264:Eq 257:Eq 187:Eq 161::: 155:/= 134::: 128:== 116:Eq 106:Eq 72:. 1979:e 1972:t 1965:v 1918:. 1889:. 1874:. 1838:: 1814:" 1804:. 1765:. 1751:. 1729:: 1672:. 1654:. 1635:. 1621:: 1576:. 1536:. 1522:: 1493:. 1487:: 1468:. 1446:: 1420:. 1416:: 1370:( 1292:; 1268:} 1265:b 1259:a 1256:{ 1253:; 1229:} 1226:b 1220:a 1217:{ 1214:{ 1211:) 1208:b 1205:T 1202:, 1199:a 1196:T 1193:( 1187:= 1175:T 1088:a 1085:) 1079:( 1064:} 1061:s 1058:= 1055:) 1049:: 1046:s 1043:( 1034:{ 1025:= 1007:a 1004:( 998:. 995:s 992:( 986:= 983:) 977:: 974:s 965:A 962:: 959:a 956:( 941:} 932:A 929:: 926:f 923:( 914:{ 875:a 829:a 820:a 797:a 788:a 750:m 742:m 730:s 726:m 689:e 685:a 655:) 643:( 619:b 616:m 610:) 607:b 604:m 598:a 595:( 589:a 586:m 580:) 574:( 571:a 568:m 562:a 550:m 474:t 463:t 455:t 451:t 447:C 439:C 435:t 416:a 412:a 390:y 381:) 378:y 372:x 369:( 366:= 363:) 357:: 354:x 351:( 348:y 339:= 336:y 321:a 315:a 283:a 227:( 202:a 195:a 191:a 183:a 170:a 164:a 158:) 152:( 143:a 137:a 131:) 125:( 119:a 70:T 66:a 62:a 55:T 30:. 23:.

Index

Glossary of set theory § T
class (computer programming)
computer science
type system
ad hoc polymorphism
parametrically polymorphic
type variable
Haskell programming language
Philip Wadler
Standard ML
overloaded arithmetic and equality operators
compiler frontend
kind
GHC
classes
kind
Monad
GHC
unboxed
multimethods
Hugs
inspired from relational database theory
monad
type inference
type-directed programming
Simon Peyton-Jones
set
total ordering
Scala
Coq

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