25:
105:
The row-polymorphic record type defines a list of fields with their corresponding types, a list of missing fields, and a variable indicating the absence or presence of arbitrary additional fields. Both lists are optional, and the variable may be constrained. Specifically, the variable may be 'empty',
1096:
1232:
545:
442:
Row-polymorphic record types allow us to write programs that operate only on a section of a record. For example, one may define a function that performs some two-dimensional transformation that accepts a record with two or more coordinates, and returns an identical type:
245:
945:
705:
951:
1102:
448:
112:
840:
617:
390:
331:
437:
272:
847:
779:
637:
410:
358:
299:
814:
745:
725:
595:
575:
43:
642:
1091:{\displaystyle \mathrm {add_{\ell }} =\lambda r.\lambda e.r\;:\;\{\mathrm {absent} (\ell ),\rho \}\rightarrow T\rightarrow \{\ell :T,\rho \}}
1227:{\displaystyle \mathrm {remove_{\ell }} =\lambda r.r\backslash \ell \;:\;\{\ell :T,\rho \}\rightarrow \{\mathrm {absent} (\ell ),\rho \}}
557:
coordinate (or any other coordinates) intact. In a more general sense, the function can perform on any record that contains the fields
1336:
540:{\displaystyle {\text{transform2d}}:\{x:{\text{Number}},y:{\text{Number}},\rho \}\to \{x:{\text{Number}},y:{\text{Number}},\rho \}}
549:
Thanks to row polymorphism, the function may perform two-dimensional transformation on a three-dimensional (in fact,
240:{\displaystyle \{\ell _{1}:T_{1},\dots ,\ell _{n}:T_{n},{\text{absent}}(f_{1}),\dots ,{\text{absent}}(f_{m}),\rho \}}
61:
86:
819:
93:
and polymorphic variants. A row-polymorphic type system and proof of type inference was introduced by
600:
90:
619:. There is no loss of information: the type ensures that all the fields represented by the variable
1273:
Wand, Mitchell (June 1989). "Type inference for record concatenation and multiple inheritance".
940:{\displaystyle \mathrm {select_{\ell }} =\lambda r.(r.\ell )\;:\;\{\ell :T,\rho \}\rightarrow T}
363:
304:
415:
250:
758:
1296:
Wand, Mitchell (1991). "Type inference for record concatenation and multiple inheritance".
622:
395:
336:
277:
75:
39:
8:
784:
730:
710:
580:
560:
1313:
1309:
1305:
1278:
1249:
1330:
1317:
94:
89:
that allows one to write programs that are polymorphic on row types such as
1282:
1304:(Selections from 1989 IEEE Symposium on Logic in Computer Science): 1–15.
747:
fields and nothing else. In this case, a classic record type is obtained.
78:
700:{\displaystyle \{x:{\text{Number}},y:{\text{Number}},\mathbf {empty} \}}
106:
indicating that no additional fields may be present for the record.
34:
provides insufficient context for those unfamiliar with the subject
1275:
Proceedings. Fourth Annual
Symposium on Logic in Computer Science
639:
are present in the return type. In contrast, the type definition
707:
expresses the fact that a record of that type has exactly the
412:
expresses the fact the record may contain other fields than
100:
1148:
826:
1105:
954:
850:
822:
787:
761:
733:
713:
645:
625:
603:
583:
563:
451:
418:
398:
366:
339:
307:
280:
253:
115:
1226:
1090:
939:
834:
808:
773:
739:
719:
699:
631:
611:
589:
569:
539:
431:
404:
384:
352:
325:
293:
266:
239:
1328:
750:
247:. This indicates a record type that has fields
1221:
1183:
1177:
1159:
1085:
1067:
1055:
1017:
928:
910:
694:
646:
534:
500:
494:
460:
234:
116:
755:The record operations of selecting a field
1158:
1154:
1016:
1012:
909:
905:
62:Learn how and when to remove this message
333:), and does not have any of the fields
1329:
101:Row-polymorphic record type definition
44:providing more context for the reader
1295:
1272:
842:can be given row-polymorphic types.
18:
13:
1202:
1199:
1196:
1193:
1190:
1187:
1123:
1119:
1116:
1113:
1110:
1107:
1036:
1033:
1030:
1027:
1024:
1021:
963:
959:
956:
868:
864:
861:
858:
855:
852:
14:
1348:
835:{\displaystyle r\backslash \ell }
553:-dimensional) point, leaving the
690:
687:
684:
681:
678:
23:
1337:Polymorphism (computer science)
612:{\displaystyle {\text{Number}}}
1289:
1266:
1250:"OCaml - Polymorphic variants"
1242:
1212:
1206:
1180:
1064:
1058:
1046:
1040:
1009:
997:
931:
902:
890:
803:
791:
497:
225:
212:
195:
182:
1:
1310:10.1016/0890-5401(91)90050-C
751:Typing operations on records
7:
1298:Information and Computation
10:
1353:
385:{\displaystyle j=1\dots m}
326:{\displaystyle i=1\dots n}
432:{\displaystyle \ell _{i}}
274:with respective types of
267:{\displaystyle \ell _{i}}
1236:
1283:10.1109/LICS.1989.39162
816:, and removing a field
774:{\displaystyle r.\ell }
1228:
1092:
941:
836:
810:
775:
741:
721:
701:
633:
613:
591:
571:
541:
433:
406:
386:
354:
327:
295:
268:
241:
1229:
1093:
942:
837:
811:
776:
742:
722:
702:
634:
632:{\displaystyle \rho }
614:
592:
572:
542:
434:
407:
405:{\displaystyle \rho }
387:
355:
353:{\displaystyle f_{j}}
328:
296:
294:{\displaystyle T_{i}}
269:
242:
109:It may be written as
1103:
952:
848:
820:
785:
759:
731:
711:
643:
623:
601:
581:
561:
449:
416:
396:
364:
337:
305:
278:
251:
113:
76:programming language
16:Kind of polymorphism
40:improve the article
1277:. pp. 92–97.
1224:
1088:
937:
832:
806:
771:
737:
717:
697:
629:
609:
587:
567:
537:
429:
402:
382:
350:
323:
291:
264:
237:
809:{\displaystyle r}
781:, adding a field
740:{\displaystyle y}
720:{\displaystyle x}
672:
658:
607:
590:{\displaystyle y}
570:{\displaystyle x}
526:
512:
486:
472:
455:
210:
180:
72:
71:
64:
1344:
1322:
1321:
1293:
1287:
1286:
1270:
1264:
1263:
1261:
1260:
1246:
1233:
1231:
1230:
1225:
1205:
1132:
1131:
1130:
1097:
1095:
1094:
1089:
1039:
972:
971:
970:
946:
944:
943:
938:
877:
876:
875:
841:
839:
838:
833:
815:
813:
812:
807:
780:
778:
777:
772:
746:
744:
743:
738:
726:
724:
723:
718:
706:
704:
703:
698:
693:
673:
670:
659:
656:
638:
636:
635:
630:
618:
616:
615:
610:
608:
605:
596:
594:
593:
588:
576:
574:
573:
568:
546:
544:
543:
538:
527:
524:
513:
510:
487:
484:
473:
470:
456:
453:
438:
436:
435:
430:
428:
427:
411:
409:
408:
403:
391:
389:
388:
383:
359:
357:
356:
351:
349:
348:
332:
330:
329:
324:
300:
298:
297:
292:
290:
289:
273:
271:
270:
265:
263:
262:
246:
244:
243:
238:
224:
223:
211:
208:
194:
193:
181:
178:
173:
172:
160:
159:
141:
140:
128:
127:
83:row polymorphism
67:
60:
56:
53:
47:
27:
26:
19:
1352:
1351:
1347:
1346:
1345:
1343:
1342:
1341:
1327:
1326:
1325:
1294:
1290:
1271:
1267:
1258:
1256:
1248:
1247:
1243:
1239:
1186:
1126:
1122:
1106:
1104:
1101:
1100:
1020:
966:
962:
955:
953:
950:
949:
871:
867:
851:
849:
846:
845:
821:
818:
817:
786:
783:
782:
760:
757:
756:
753:
732:
729:
728:
712:
709:
708:
677:
669:
655:
644:
641:
640:
624:
621:
620:
604:
602:
599:
598:
582:
579:
578:
562:
559:
558:
547:
523:
509:
483:
469:
452:
450:
447:
446:
423:
419:
417:
414:
413:
397:
394:
393:
365:
362:
361:
344:
340:
338:
335:
334:
306:
303:
302:
285:
281:
279:
276:
275:
258:
254:
252:
249:
248:
219:
215:
207:
189:
185:
177:
168:
164:
155:
151:
136:
132:
123:
119:
114:
111:
110:
103:
68:
57:
51:
48:
37:
28:
24:
17:
12:
11:
5:
1350:
1340:
1339:
1324:
1323:
1288:
1265:
1240:
1238:
1235:
1223:
1220:
1217:
1214:
1211:
1208:
1204:
1201:
1198:
1195:
1192:
1189:
1185:
1182:
1179:
1176:
1173:
1170:
1167:
1164:
1161:
1157:
1153:
1150:
1147:
1144:
1141:
1138:
1135:
1129:
1125:
1121:
1118:
1115:
1112:
1109:
1087:
1084:
1081:
1078:
1075:
1072:
1069:
1066:
1063:
1060:
1057:
1054:
1051:
1048:
1045:
1042:
1038:
1035:
1032:
1029:
1026:
1023:
1019:
1015:
1011:
1008:
1005:
1002:
999:
996:
993:
990:
987:
984:
981:
978:
975:
969:
965:
961:
958:
936:
933:
930:
927:
924:
921:
918:
915:
912:
908:
904:
901:
898:
895:
892:
889:
886:
883:
880:
874:
870:
866:
863:
860:
857:
854:
831:
828:
825:
805:
802:
799:
796:
793:
790:
770:
767:
764:
752:
749:
736:
716:
696:
692:
689:
686:
683:
680:
676:
668:
665:
662:
654:
651:
648:
628:
586:
566:
536:
533:
530:
522:
519:
516:
508:
505:
502:
499:
496:
493:
490:
482:
479:
476:
468:
465:
462:
459:
445:
426:
422:
401:
381:
378:
375:
372:
369:
347:
343:
322:
319:
316:
313:
310:
288:
284:
261:
257:
236:
233:
230:
227:
222:
218:
214:
206:
203:
200:
197:
192:
188:
184:
176:
171:
167:
163:
158:
154:
150:
147:
144:
139:
135:
131:
126:
122:
118:
102:
99:
85:is a kind of
70:
69:
31:
29:
22:
15:
9:
6:
4:
3:
2:
1349:
1338:
1335:
1334:
1332:
1319:
1315:
1311:
1307:
1303:
1299:
1292:
1284:
1280:
1276:
1269:
1255:
1251:
1245:
1241:
1234:
1218:
1215:
1209:
1174:
1171:
1168:
1165:
1162:
1155:
1151:
1145:
1142:
1139:
1136:
1133:
1127:
1098:
1082:
1079:
1076:
1073:
1070:
1061:
1052:
1049:
1043:
1013:
1006:
1003:
1000:
994:
991:
988:
985:
982:
979:
976:
973:
967:
947:
934:
925:
922:
919:
916:
913:
906:
899:
896:
893:
887:
884:
881:
878:
872:
843:
829:
823:
800:
797:
794:
788:
768:
765:
762:
748:
734:
714:
674:
666:
663:
660:
652:
649:
626:
584:
564:
556:
552:
531:
528:
520:
517:
514:
506:
503:
491:
488:
480:
477:
474:
466:
463:
457:
444:
440:
424:
420:
399:
379:
376:
373:
370:
367:
345:
341:
320:
317:
314:
311:
308:
286:
282:
259:
255:
231:
228:
220:
216:
204:
201:
198:
190:
186:
174:
169:
165:
161:
156:
152:
148:
145:
142:
137:
133:
129:
124:
120:
107:
98:
96:
95:Mitchell Wand
92:
88:
84:
80:
77:
66:
63:
55:
45:
41:
35:
32:This article
30:
21:
20:
1301:
1297:
1291:
1274:
1268:
1257:. Retrieved
1254:v2.ocaml.org
1253:
1244:
1099:
948:
844:
754:
554:
550:
548:
441:
108:
104:
91:record types
87:polymorphism
82:
73:
58:
52:October 2018
49:
38:Please help
33:
454:transform2d
79:type theory
1259:2022-12-03
597:with type
1318:0890-5401
1219:ρ
1210:ℓ
1181:→
1175:ρ
1163:ℓ
1152:ℓ
1149:∖
1137:λ
1128:ℓ
1083:ρ
1071:ℓ
1065:→
1059:→
1053:ρ
1044:ℓ
1001:ℓ
986:λ
977:λ
968:ℓ
932:→
926:ρ
914:ℓ
900:ℓ
882:λ
873:ℓ
830:ℓ
827:∖
795:ℓ
769:ℓ
627:ρ
532:ρ
498:→
492:ρ
421:ℓ
400:ρ
392:), while
377:…
318:…
256:ℓ
232:ρ
202:…
153:ℓ
146:…
121:ℓ
1331:Category
1316:
671:Number
657:Number
606:Number
525:Number
511:Number
485:Number
471:Number
209:absent
179:absent
1237:Notes
360:(for
301:(for
1314:ISSN
727:and
577:and
1306:doi
1279:doi
439:.
74:In
42:by
1333::
1312:.
1302:93
1300:.
1252:.
1004::=
798::=
97:.
81:,
1320:.
1308::
1285:.
1281::
1262:.
1222:}
1216:,
1213:)
1207:(
1203:t
1200:n
1197:e
1194:s
1191:b
1188:a
1184:{
1178:}
1172:,
1169:T
1166::
1160:{
1156::
1146:r
1143:.
1140:r
1134:=
1124:e
1120:v
1117:o
1114:m
1111:e
1108:r
1086:}
1080:,
1077:T
1074::
1068:{
1062:T
1056:}
1050:,
1047:)
1041:(
1037:t
1034:n
1031:e
1028:s
1025:b
1022:a
1018:{
1014::
1010:]
1007:e
998:[
995:r
992:.
989:e
983:.
980:r
974:=
964:d
960:d
957:a
935:T
929:}
923:,
920:T
917::
911:{
907::
903:)
897:.
894:r
891:(
888:.
885:r
879:=
869:t
865:c
862:e
859:l
856:e
853:s
824:r
804:]
801:e
792:[
789:r
766:.
763:r
735:y
715:x
695:}
691:y
688:t
685:p
682:m
679:e
675:,
667::
664:y
661:,
653::
650:x
647:{
585:y
565:x
555:z
551:n
535:}
529:,
521::
518:y
515:,
507::
504:x
501:{
495:}
489:,
481::
478:y
475:,
467::
464:x
461:{
458::
425:i
380:m
374:1
371:=
368:j
346:j
342:f
321:n
315:1
312:=
309:i
287:i
283:T
260:i
235:}
229:,
226:)
221:m
217:f
213:(
205:,
199:,
196:)
191:1
187:f
183:(
175:,
170:n
166:T
162::
157:n
149:,
143:,
138:1
134:T
130::
125:1
117:{
65:)
59:(
54:)
50:(
46:.
36:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.