package tezos-protocol-environment
Interface layer between the protocols and the shell
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-16.0.tar.gz
sha256=ad9e08819871c75ba6f4530b125f7d157799398e4d77a1e6bfea9d91ff37ff55
sha512=c5dc4d40cc09bc6980fbbdb5c2e105bf4252cf9cfcb2b49660b0ebe4dc789f6709ec3b3bf2f87d81580d3eed9521eeb1c960f24d9b14eb0285aaba1f84d10a9b
doc/src/tezos-protocol-environment.sigs/v3.ml.html
Source file v3.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407
(* This file was automatically generated, do not edit.*) (* Edit file v3.in.ml instead. *) # 1 "v3.in.ml" module type T = sig module CamlinternalFormatBasics : module type of struct include Tezos_protocol_environment_sigs_internals.CamlinternalFormatBasics end module Pervasives : sig # 1 "v3/pervasives.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** The OCaml Standard library. This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by [Stdlib]. It particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the {{!modules}standard library modules}. *) (** {1 Exceptions} *) external raise : exn -> 'a = "%raise" (** Raise the given exception value *) external raise_notrace : exn -> 'a = "%raise_notrace" (** A faster version [raise] which does not record the backtrace. @since 4.02.0 *) val invalid_arg : string -> 'a (** Raise exception [Invalid_argument] with the given string. *) val failwith : string -> 'a (** Raise exception [Failure] with the given string. *) exception Exit (** The [Exit] exception is not raised by any library function. It is provided for use in your programs. *) (** {1 Boolean operations} *) external not : bool -> bool = "%boolnot" (** The boolean negation. *) external ( && ) : bool -> bool -> bool = "%sequand" (** The boolean 'and'. Evaluation is sequential, left-to-right: in [e1 && e2], [e1] is evaluated first, and if it returns [false], [e2] is not evaluated at all. Right-associative operator, see {!Ocaml_operators} for more information. *) external ( || ) : bool -> bool -> bool = "%sequor" (** The boolean 'or'. Evaluation is sequential, left-to-right: in [e1 || e2], [e1] is evaluated first, and if it returns [true], [e2] is not evaluated at all. Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 Debugging} *) external __LOC__ : string = "%loc_LOC" (** [__LOC__] returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d". @since 4.02.0 *) external __FILE__ : string = "%loc_FILE" (** [__FILE__] returns the name of the file currently being parsed by the compiler. @since 4.02.0 *) external __LINE__ : int = "%loc_LINE" (** [__LINE__] returns the line number at which this expression appears in the file currently being parsed by the compiler. @since 4.02.0 *) external __MODULE__ : string = "%loc_MODULE" (** [__MODULE__] returns the module name of the file being parsed by the compiler. @since 4.02.0 *) external __POS__ : string * int * int * int = "%loc_POS" (** [__POS__] returns a tuple [(file,lnum,cnum,enum)], corresponding to the location at which this expression appears in the file currently being parsed by the compiler. [file] is the current filename, [lnum] the line number, [cnum] the character position in the line and [enum] the last character position in the line. @since 4.02.0 *) external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC" (** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the location of [expr] in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d". @since 4.02.0 *) external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE" (** [__LINE_OF__ expr] returns a pair [(line, expr)], where [line] is the line number at which the expression [expr] appears in the file currently being parsed by the compiler. @since 4.02.0 *) external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS" (** [__POS_OF__ expr] returns a pair [(loc,expr)], where [loc] is a tuple [(file,lnum,cnum,enum)] corresponding to the location at which the expression [expr] appears in the file currently being parsed by the compiler. [file] is the current filename, [lnum] the line number, [cnum] the character position in the line and [enum] the last character position in the line. @since 4.02.0 *) (** {1 Composition operators} *) external ( |> ) : 'a -> ('a -> 'b) -> 'b = "%revapply" (** Reverse-application operator: [x |> f |> g] is exactly equivalent to [g (f (x))]. Left-associative operator, see {!Ocaml_operators} for more information. @since 4.01 *) external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply" (** Application operator: [g @@ f @@ x] is exactly equivalent to [g (f (x))]. Right-associative operator, see {!Ocaml_operators} for more information. @since 4.01 *) (** {1 Integer arithmetic} *) (** Integers are [Sys.int_size] bits wide. All operations are taken modulo 2{^[Sys.int_size]}. They do not fail on overflow. *) external ( ~- ) : int -> int = "%negint" (** Unary negation. You can also write [- e] instead of [~- e]. Unary operator, see {!Ocaml_operators} for more information. *) external ( ~+ ) : int -> int = "%identity" (** Unary addition. You can also write [+ e] instead of [~+ e]. Unary operator, see {!Ocaml_operators} for more information. @since 3.12.0 *) external succ : int -> int = "%succint" (** [succ x] is [x + 1]. *) external pred : int -> int = "%predint" (** [pred x] is [x - 1]. *) external ( + ) : int -> int -> int = "%addint" (** Integer addition. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( - ) : int -> int -> int = "%subint" (** Integer subtraction. Left-associative operator, , see {!Ocaml_operators} for more information. *) external ( * ) : int -> int -> int = "%mulint" (** Integer multiplication. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( / ) : int -> int -> int = "%divint" (** Integer division. Raise [Division_by_zero] if the second argument is 0. Integer division rounds the real quotient of its arguments towards zero. More precisely, if [x >= 0] and [y > 0], [x / y] is the greatest integer less than or equal to the real quotient of [x] by [y]. Moreover, [(- x) / y = x / (- y) = - (x / y)]. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( mod ) : int -> int -> int = "%modint" (** Integer remainder. If [y] is not zero, the result of [x mod y] satisfies the following properties: [x = (x / y) * y + x mod y] and [abs(x mod y) <= abs(y) - 1]. If [y = 0], [x mod y] raises [Division_by_zero]. Note that [x mod y] is negative only if [x < 0]. Raise [Division_by_zero] if [y] is zero. Left-associative operator, see {!Ocaml_operators} for more information. *) val abs : int -> int (** Return the absolute value of the argument. Note that this may be negative if the argument is [min_int]. *) val max_int : int (** The greatest representable integer. *) val min_int : int (** The smallest representable integer. *) (** {2 Bitwise operations} *) external ( land ) : int -> int -> int = "%andint" (** Bitwise logical and. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( lor ) : int -> int -> int = "%orint" (** Bitwise logical or. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( lxor ) : int -> int -> int = "%xorint" (** Bitwise logical exclusive or. Left-associative operator, see {!Ocaml_operators} for more information. *) val lnot : int -> int (** Bitwise logical negation. *) external ( lsl ) : int -> int -> int = "%lslint" (** [n lsl m] shifts [n] to the left by [m] bits. The result is unspecified if [m < 0] or [m > Sys.int_size]. Right-associative operator, see {!Ocaml_operators} for more information. *) external ( lsr ) : int -> int -> int = "%lsrint" (** [n lsr m] shifts [n] to the right by [m] bits. This is a logical shift: zeroes are inserted regardless of the sign of [n]. The result is unspecified if [m < 0] or [m > Sys.int_size]. Right-associative operator, see {!Ocaml_operators} for more information. *) external ( asr ) : int -> int -> int = "%asrint" (** [n asr m] shifts [n] to the right by [m] bits. This is an arithmetic shift: the sign bit of [n] is replicated. The result is unspecified if [m < 0] or [m > Sys.int_size]. Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 String operations} More string operations are provided in module {!String}. *) val ( ^ ) : string -> string -> string (** String concatenation. Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 Character operations} More character operations are provided in module {!Char}. *) external int_of_char : char -> int = "%identity" (** Return the ASCII code of the argument. *) val char_of_int : int -> char (** Return the character with the given ASCII code. Raise [Invalid_argument "char_of_int"] if the argument is outside the range 0--255. *) (** {1 Unit operations} *) external ignore : 'a -> unit = "%ignore" (** Discard the value of its argument and return [()]. For instance, [ignore(f x)] discards the result of the side-effecting function [f]. It is equivalent to [f x; ()], except that the latter may generate a compiler warning; writing [ignore(f x)] instead avoids the warning. *) (** {1 String conversion functions} *) val string_of_bool : bool -> string (** Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly. *) val bool_of_string_opt: string -> bool option (** Convert the given string to a boolean. Return [None] if the string is not ["true"] or ["false"]. @since 4.05 *) val string_of_int : int -> string (** Return the string representation of an integer, in decimal. *) val int_of_string_opt: string -> int option (** Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with [0u]), in hexadecimal (if it begins with [0x] or [0X]), in octal (if it begins with [0o] or [0O]), or in binary (if it begins with [0b] or [0B]). The [0u] prefix reads the input as an unsigned integer in the range [[0, 2*max_int+1]]. If the input exceeds {!max_int} it is converted to the signed integer [min_int + input - max_int - 1]. The [_] (underscore) character can appear anywhere in the string and is ignored. Return [None] if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type [int]. @since 4.05 *) (** {1 Pair operations} *) external fst : 'a * 'b -> 'a = "%field0" (** Return the first component of a pair. *) external snd : 'a * 'b -> 'b = "%field1" (** Return the second component of a pair. *) (** {1 List operations} More list operations are provided in module {!List}. *) val ( @ ) : 'a list -> 'a list -> 'a list (** List concatenation. Not tail-recursive (length of the first argument). Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 References} *) type 'a ref = { mutable contents : 'a } (** The type of references (mutable indirection cells) containing a value of type ['a]. *) external ref : 'a -> 'a ref = "%makemutable" (** Return a fresh reference containing the given value. *) external ( ! ) : 'a ref -> 'a = "%field0" (** [!r] returns the current contents of reference [r]. Equivalent to [fun r -> r.contents]. Unary operator, see {!Ocaml_operators} for more information. *) external ( := ) : 'a ref -> 'a -> unit = "%setfield0" (** [r := a] stores the value of [a] in reference [r]. Equivalent to [fun r v -> r.contents <- v]. Right-associative operator, see {!Ocaml_operators} for more information. *) external incr : int ref -> unit = "%incr" (** Increment the integer contained in the given reference. Equivalent to [fun r -> r := succ !r]. *) external decr : int ref -> unit = "%decr" (** Decrement the integer contained in the given reference. Equivalent to [fun r -> r := pred !r]. *) (** {1 Result type} *) (** @since 4.03.0 *) type ('a,'b) result = Ok of 'a | Error of 'b (** {1 Operations on format strings} *) (** Format strings are character strings with special lexical conventions that defines the functionality of formatted input/output functions. Format strings are used to read data with formatted input functions from module {!Scanf} and to print data with formatted output functions from modules {!Printf} and {!Format}. Format strings are made of three kinds of entities: - {e conversions specifications}, introduced by the special character ['%'] followed by one or more characters specifying what kind of argument to read or print, - {e formatting indications}, introduced by the special character ['@'] followed by one or more characters specifying how to read or print the argument, - {e plain characters} that are regular characters with usual lexical conventions. Plain characters specify string literals to be read in the input or printed in the output. There is an additional lexical rule to escape the special characters ['%'] and ['@'] in format strings: if a special character follows a ['%'] character, it is treated as a plain character. In other words, ["%%"] is considered as a plain ['%'] and ["%@"] as a plain ['@']. For more information about conversion specifications and formatting indications available, read the documentation of modules {!Scanf}, {!Printf} and {!Format}. *) (** Format strings have a general and highly polymorphic type [('a, 'b, 'c, 'd, 'e, 'f) format6]. The two simplified types, [format] and [format4] below are included for backward compatibility with earlier releases of OCaml. The meaning of format string type parameters is as follows: - ['a] is the type of the parameters of the format for formatted output functions ([printf]-style functions); ['a] is the type of the values read by the format for formatted input functions ([scanf]-style functions). - ['b] is the type of input source for formatted input functions and the type of output target for formatted output functions. For [printf]-style functions from module {!Printf}, ['b] is typically [out_channel]; for [printf]-style functions from module {!Format}, ['b] is typically {!Format.formatter}; for [scanf]-style functions from module {!Scanf}, ['b] is typically {!Scanf.Scanning.in_channel}. Type argument ['b] is also the type of the first argument given to user's defined printing functions for [%a] and [%t] conversions, and user's defined reading functions for [%r] conversion. - ['c] is the type of the result of the [%a] and [%t] printing functions, and also the type of the argument transmitted to the first argument of [kprintf]-style functions or to the [kscanf]-style functions. - ['d] is the type of parameters for the [scanf]-style functions. - ['e] is the type of the receiver function for the [scanf]-style functions. - ['f] is the final result type of a formatted input/output function invocation: for the [printf]-style functions, it is typically [unit]; for the [scanf]-style functions, it is typically the result type of the receiver function. *) type ('a, 'b, 'c, 'd, 'e, 'f) format6 = ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6 type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4 val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string (** Converts a format string into a string. *) external format_of_string : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 = "%identity" (** [format_of_string s] returns a format string read from the string literal [s]. Note: [format_of_string] can not convert a string argument that is not a literal. If you need this functionality, use the more general {!Scanf.format_from_string} function. *) val ( ^^ ) : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6 (** [f1 ^^ f2] catenates format strings [f1] and [f2]. The result is a format string that behaves as the concatenation of format strings [f1] and [f2]: in case of formatted output, it accepts arguments from [f1], then arguments from [f2]; in case of formatted input, it returns results from [f1], then results from [f2]. Right-associative operator, see {!Ocaml_operators} for more information. *) end # 6 "v3.in.ml" open Pervasives module String : sig # 1 "v3/string.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** String operations. A string is an immutable data structure that contains a fixed-length sequence of (single-byte) characters. Each character can be accessed in constant time through its index. Given a string [s] of length [l], we can access each of the [l] characters of [s] via its index in the sequence. Indexes start at [0], and we will call an index valid in [s] if it falls within the range [[0...l-1]] (inclusive). A position is the point between two characters or at the beginning or end of the string. We call a position valid in [s] if it falls within the range [[0...l]] (inclusive). Note that the character at index [n] is between positions [n] and [n+1]. Two parameters [start] and [len] are said to designate a valid substring of [s] if [len >= 0] and [start] and [start+len] are valid positions in [s]. Note: OCaml strings used to be modifiable in place, for instance via the {!String.set} and {!String.blit} functions described below. This usage is only possible when the compiler is put in "unsafe-string" mode by giving the [-unsafe-string] command-line option. This compatibility mode makes the types [string] and [bytes] (see module {!Bytes}) interchangeable so that functions expecting byte sequences can also accept strings as arguments and modify them. The distinction between [bytes] and [string] was introduced in OCaml 4.02, and the "unsafe-string" compatibility mode was the default until OCaml 4.05. Starting with 4.06, the compatibility mode is opt-in; we intend to remove the option in the future. *) external length : string -> int = "%string_length" (** Return the length (number of characters) of the given string. *) external get : string -> int -> char = "%string_safe_get" (** [String.get s n] returns the character at index [n] in string [s]. You can also write [s.[n]] instead of [String.get s n]. Raise [Invalid_argument] if [n] not a valid index in [s]. *) val make : int -> char -> string (** [String.make n c] returns a fresh string of length [n], filled with the character [c]. Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *) val init : int -> (int -> char) -> string (** [String.init n f] returns a string of length [n], with character [i] initialized to the result of [f i] (called in increasing index order). Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. @since 4.02.0 *) val sub : string -> int -> int -> string (** [String.sub s start len] returns a fresh string of length [len], containing the substring of [s] that starts at position [start] and has length [len]. Raise [Invalid_argument] if [start] and [len] do not designate a valid substring of [s]. *) val blit : string -> int -> bytes -> int -> int -> unit (** Same as {!Bytes.blit_string}. *) val concat : string -> string list -> string (** [String.concat sep sl] concatenates the list of strings [sl], inserting the separator string [sep] between each. Raise [Invalid_argument] if the result is longer than {!Sys.max_string_length} bytes. *) val iter : (char -> unit) -> string -> unit (** [String.iter f s] applies function [f] in turn to all the characters of [s]. It is equivalent to [f s.[0]; f s.[1]; ...; f s.[String.length s - 1]; ()]. *) val iteri : (int -> char -> unit) -> string -> unit (** Same as {!String.iter}, but the function is applied to the index of the element as first argument (counting from 0), and the character itself as second argument. @since 4.00.0 *) val map : (char -> char) -> string -> string (** [String.map f s] applies function [f] in turn to all the characters of [s] (in increasing index order) and stores the results in a new string that is returned. @since 4.00.0 *) val mapi : (int -> char -> char) -> string -> string (** [String.mapi f s] calls [f] with each character of [s] and its index (in increasing index order) and stores the results in a new string that is returned. @since 4.02.0 *) val trim : string -> string (** Return a copy of the argument, without leading and trailing whitespace. The characters regarded as whitespace are: [' '], ['\012'], ['\n'], ['\r'], and ['\t']. If there is neither leading nor trailing whitespace character in the argument, return the original string itself, not a copy. @since 4.00.0 *) val escaped : string -> string (** Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote. If there is no special character in the argument that needs escaping, return the original string itself, not a copy. Raise [Invalid_argument] if the result is longer than {!Sys.max_string_length} bytes. The function {!Scanf.unescaped} is a left inverse of [escaped], i.e. [Scanf.unescaped (escaped s) = s] for any string [s] (unless [escape s] fails). *) val index_opt: string -> char -> int option (** [String.index_opt s c] returns the index of the first occurrence of character [c] in string [s], or [None] if [c] does not occur in [s]. @since 4.05 *) val rindex_opt: string -> char -> int option (** [String.rindex_opt s c] returns the index of the last occurrence of character [c] in string [s], or [None] if [c] does not occur in [s]. @since 4.05 *) val index_from_opt: string -> int -> char -> int option (** [String.index_from_opt s i c] returns the index of the first occurrence of character [c] in string [s] after position [i] or [None] if [c] does not occur in [s] after position [i]. [String.index_opt s c] is equivalent to [String.index_from_opt s 0 c]. Raise [Invalid_argument] if [i] is not a valid position in [s]. @since 4.05 *) val rindex_from_opt: string -> int -> char -> int option (** [String.rindex_from_opt s i c] returns the index of the last occurrence of character [c] in string [s] before position [i+1] or [None] if [c] does not occur in [s] before position [i+1]. [String.rindex_opt s c] is equivalent to [String.rindex_from_opt s (String.length s - 1) c]. Raise [Invalid_argument] if [i+1] is not a valid position in [s]. @since 4.05 *) val contains : string -> char -> bool (** [String.contains s c] tests if character [c] appears in the string [s]. *) val contains_from : string -> int -> char -> bool (** [String.contains_from s start c] tests if character [c] appears in [s] after position [start]. [String.contains s c] is equivalent to [String.contains_from s 0 c]. Raise [Invalid_argument] if [start] is not a valid position in [s]. *) val rcontains_from : string -> int -> char -> bool (** [String.rcontains_from s stop c] tests if character [c] appears in [s] before position [stop+1]. Raise [Invalid_argument] if [stop < 0] or [stop+1] is not a valid position in [s]. *) val uppercase_ascii : string -> string (** Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set. @since 4.03.0 *) val lowercase_ascii : string -> string (** Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set. @since 4.03.0 *) val capitalize_ascii : string -> string (** Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set. @since 4.03.0 *) val uncapitalize_ascii : string -> string (** Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set. @since 4.03.0 *) type t = string (** An alias for the type of strings. *) val compare: t -> t -> int (** The comparison function for strings, with the same specification as {!Stdlib.compare}. Along with the type [t], this function [compare] allows the module [String] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) val equal: t -> t -> bool (** The equal function for strings. @since 4.03.0 *) val split_on_char: char -> string -> string list (** [String.split_on_char sep s] returns the list of all (possibly empty) substrings of [s] that are delimited by the [sep] character. The function's output is specified by the following invariants: - The list is not empty. - Concatenating its elements using [sep] as a separator returns a string equal to the input ([String.concat (String.make 1 sep) (String.split_on_char sep s) = s]). - No string in the result contains the [sep] character. @since 4.04.0 *) end # 10 "v3.in.ml" module Char : sig # 1 "v3/char.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** Character operations. *) external code : char -> int = "%identity" (** Return the ASCII code of the argument. *) val chr : int -> char (** Return the character with the given ASCII code. Raise [Invalid_argument "Char.chr"] if the argument is outside the range 0--255. *) val escaped : char -> string (** Return a string representing the given character, with special characters escaped following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash, double-quote, and single-quote. *) val lowercase_ascii : char -> char (** Convert the given character to its equivalent lowercase character, using the US-ASCII character set. @since 4.03.0 *) val uppercase_ascii : char -> char (** Convert the given character to its equivalent uppercase character, using the US-ASCII character set. @since 4.03.0 *) type t = char (** An alias for the type of characters. *) val compare: t -> t -> int (** The comparison function for characters, with the same specification as {!Stdlib.compare}. Along with the type [t], this function [compare] allows the module [Char] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) val equal: t -> t -> bool (** The equal function for chars. @since 4.03.0 *) end # 12 "v3.in.ml" module Bytes : sig # 1 "v3/bytes.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** Byte sequence operations. A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing. Given a byte sequence [s] of length [l], we can access each of the [l] bytes of [s] via its index in the sequence. Indexes start at [0], and we will call an index valid in [s] if it falls within the range [[0...l-1]] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in [s] if it falls within the range [[0...l]] (inclusive). Note that the byte at index [n] is between positions [n] and [n+1]. Two parameters [start] and [len] are said to designate a valid range of [s] if [len >= 0] and [start] and [start+len] are valid positions in [s]. Byte sequences can be modified in place, for instance via the [set] and [blit] functions described below. See also strings (module {!String}), which are almost the same data structure, but cannot be modified in place. Bytes are represented by the OCaml type [char]. @since 4.02.0 *) external length : bytes -> int = "%bytes_length" (** Return the length (number of bytes) of the argument. *) external get : bytes -> int -> char = "%bytes_safe_get" (** [get s n] returns the byte at index [n] in argument [s]. Raise [Invalid_argument] if [n] is not a valid index in [s]. *) external set : bytes -> int -> char -> unit = "%bytes_safe_set" (** [set s n c] modifies [s] in place, replacing the byte at index [n] with [c]. Raise [Invalid_argument] if [n] is not a valid index in [s]. *) val make : int -> char -> bytes (** [make n c] returns a new byte sequence of length [n], filled with the byte [c]. Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *) val init : int -> (int -> char) -> bytes (** [Bytes.init n f] returns a fresh byte sequence of length [n], with character [i] initialized to the result of [f i] (in increasing index order). Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *) val empty : bytes (** A byte sequence of size 0. *) val copy : bytes -> bytes (** Return a new byte sequence that contains the same bytes as the argument. *) val of_string : string -> bytes (** Return a new byte sequence that contains the same bytes as the given string. *) val to_string : bytes -> string (** Return a new string that contains the same bytes as the given byte sequence. *) val sub : bytes -> int -> int -> bytes (** [sub s start len] returns a new byte sequence of length [len], containing the subsequence of [s] that starts at position [start] and has length [len]. Raise [Invalid_argument] if [start] and [len] do not designate a valid range of [s]. *) val sub_string : bytes -> int -> int -> string (** Same as [sub] but return a string instead of a byte sequence. *) val extend : bytes -> int -> int -> bytes (** [extend s left right] returns a new byte sequence that contains the bytes of [s], with [left] uninitialized bytes prepended and [right] uninitialized bytes appended to it. If [left] or [right] is negative, then bytes are removed (instead of appended) from the corresponding side of [s]. Raise [Invalid_argument] if the result length is negative or longer than {!Sys.max_string_length} bytes. *) val fill : bytes -> int -> int -> char -> unit (** [fill s start len c] modifies [s] in place, replacing [len] characters with [c], starting at [start]. Raise [Invalid_argument] if [start] and [len] do not designate a valid range of [s]. *) val blit : bytes -> int -> bytes -> int -> int -> unit (** [blit src srcoff dst dstoff len] copies [len] bytes from sequence [src], starting at index [srcoff], to sequence [dst], starting at index [dstoff]. It works correctly even if [src] and [dst] are the same byte sequence, and the source and destination intervals overlap. Raise [Invalid_argument] if [srcoff] and [len] do not designate a valid range of [src], or if [dstoff] and [len] do not designate a valid range of [dst]. *) val blit_string : string -> int -> bytes -> int -> int -> unit (** [blit src srcoff dst dstoff len] copies [len] bytes from string [src], starting at index [srcoff], to byte sequence [dst], starting at index [dstoff]. Raise [Invalid_argument] if [srcoff] and [len] do not designate a valid range of [src], or if [dstoff] and [len] do not designate a valid range of [dst]. *) val concat : bytes -> bytes list -> bytes (** [concat sep sl] concatenates the list of byte sequences [sl], inserting the separator byte sequence [sep] between each, and returns the result as a new byte sequence. Raise [Invalid_argument] if the result is longer than {!Sys.max_string_length} bytes. *) val cat : bytes -> bytes -> bytes (** [cat s1 s2] concatenates [s1] and [s2] and returns the result as new byte sequence. Raise [Invalid_argument] if the result is longer than {!Sys.max_string_length} bytes. *) val iter : (char -> unit) -> bytes -> unit (** [iter f s] applies function [f] in turn to all the bytes of [s]. It is equivalent to [f (get s 0); f (get s 1); ...; f (get s (length s - 1)); ()]. *) val iteri : (int -> char -> unit) -> bytes -> unit (** Same as {!Bytes.iter}, but the function is applied to the index of the byte as first argument and the byte itself as second argument. *) val map : (char -> char) -> bytes -> bytes (** [map f s] applies function [f] in turn to all the bytes of [s] (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result. *) val mapi : (int -> char -> char) -> bytes -> bytes (** [mapi f s] calls [f] with each character of [s] and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result. *) val trim : bytes -> bytes (** Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters [' '], ['\012'], ['\n'], ['\r'], and ['\t']. *) val escaped : bytes -> bytes (** Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote. Raise [Invalid_argument] if the result is longer than {!Sys.max_string_length} bytes. *) val index_opt: bytes -> char -> int option (** [index_opt s c] returns the index of the first occurrence of byte [c] in [s] or [None] if [c] does not occur in [s]. @since 4.05 *) val rindex_opt: bytes -> char -> int option (** [rindex_opt s c] returns the index of the last occurrence of byte [c] in [s] or [None] if [c] does not occur in [s]. @since 4.05 *) val index_from_opt: bytes -> int -> char -> int option (** [index_from _opts i c] returns the index of the first occurrence of byte [c] in [s] after position [i] or [None] if [c] does not occur in [s] after position [i]. [Bytes.index_opt s c] is equivalent to [Bytes.index_from_opt s 0 c]. Raise [Invalid_argument] if [i] is not a valid position in [s]. @since 4.05 *) val rindex_from_opt: bytes -> int -> char -> int option (** [rindex_from_opt s i c] returns the index of the last occurrence of byte [c] in [s] before position [i+1] or [None] if [c] does not occur in [s] before position [i+1]. [rindex_opt s c] is equivalent to [rindex_from s (Bytes.length s - 1) c]. Raise [Invalid_argument] if [i+1] is not a valid position in [s]. @since 4.05 *) val contains : bytes -> char -> bool (** [contains s c] tests if byte [c] appears in [s]. *) val contains_from : bytes -> int -> char -> bool (** [contains_from s start c] tests if byte [c] appears in [s] after position [start]. [contains s c] is equivalent to [contains_from s 0 c]. Raise [Invalid_argument] if [start] is not a valid position in [s]. *) val rcontains_from : bytes -> int -> char -> bool (** [rcontains_from s stop c] tests if byte [c] appears in [s] before position [stop+1]. Raise [Invalid_argument] if [stop < 0] or [stop+1] is not a valid position in [s]. *) val uppercase_ascii : bytes -> bytes (** Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set. @since 4.03.0 *) val lowercase_ascii : bytes -> bytes (** Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set. @since 4.03.0 *) val capitalize_ascii : bytes -> bytes (** Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set. @since 4.03.0 *) val uncapitalize_ascii : bytes -> bytes (** Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set. @since 4.03.0 *) type t = bytes (** An alias for the type of byte sequences. *) val compare: t -> t -> int (** The comparison function for byte sequences, with the same specification as {!Stdlib.compare}. Along with the type [t], this function [compare] allows the module [Bytes] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) val equal: t -> t -> bool (** The equality function for byte sequences. @since 4.03.0 *) end # 14 "v3.in.ml" module Int32 : sig # 1 "v3/int32.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** 32-bit integers. This module provides operations on the type [int32] of signed 32-bit integers. Unlike the built-in [int] type, the type [int32] is guaranteed to be exactly 32-bit wide on all platforms. All arithmetic operations over [int32] are taken modulo 2{^32}. Performance notice: values of type [int32] occupy more memory space than values of type [int], and arithmetic operations on [int32] are generally slower than those on [int]. Use [int32] only when the application requires exact 32-bit arithmetic. Literals for 32-bit integers are suffixed by l: {[ let zero: int32 = 0l let one: int32 = 1l let m_one: int32 = -1l ]} *) val zero : int32 (** The 32-bit integer 0. *) val one : int32 (** The 32-bit integer 1. *) val minus_one : int32 (** The 32-bit integer -1. *) external neg : int32 -> int32 = "%int32_neg" (** Unary negation. *) external add : int32 -> int32 -> int32 = "%int32_add" (** Addition. *) external sub : int32 -> int32 -> int32 = "%int32_sub" (** Subtraction. *) external mul : int32 -> int32 -> int32 = "%int32_mul" (** Multiplication. *) external div : int32 -> int32 -> int32 = "%int32_div" (** Integer division. Raise [Division_by_zero] if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for {!Stdlib.(/)}. *) external rem : int32 -> int32 -> int32 = "%int32_mod" (** Integer remainder. If [y] is not zero, the result of [Int32.rem x y] satisfies the following property: [x = Int32.add (Int32.mul (Int32.div x y) y) (Int32.rem x y)]. If [y = 0], [Int32.rem x y] raises [Division_by_zero]. *) val succ : int32 -> int32 (** Successor. [Int32.succ x] is [Int32.add x Int32.one]. *) val pred : int32 -> int32 (** Predecessor. [Int32.pred x] is [Int32.sub x Int32.one]. *) val abs : int32 -> int32 (** Return the absolute value of its argument. *) val max_int : int32 (** The greatest representable 32-bit integer, 2{^31} - 1. *) val min_int : int32 (** The smallest representable 32-bit integer, -2{^31}. *) external logand : int32 -> int32 -> int32 = "%int32_and" (** Bitwise logical and. *) external logor : int32 -> int32 -> int32 = "%int32_or" (** Bitwise logical or. *) external logxor : int32 -> int32 -> int32 = "%int32_xor" (** Bitwise logical exclusive or. *) val lognot : int32 -> int32 (** Bitwise logical negation. *) external shift_left : int32 -> int -> int32 = "%int32_lsl" (** [Int32.shift_left x y] shifts [x] to the left by [y] bits. The result is unspecified if [y < 0] or [y >= 32]. *) external shift_right : int32 -> int -> int32 = "%int32_asr" (** [Int32.shift_right x y] shifts [x] to the right by [y] bits. This is an arithmetic shift: the sign bit of [x] is replicated and inserted in the vacated bits. The result is unspecified if [y < 0] or [y >= 32]. *) external shift_right_logical : int32 -> int -> int32 = "%int32_lsr" (** [Int32.shift_right_logical x y] shifts [x] to the right by [y] bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of [x]. The result is unspecified if [y < 0] or [y >= 32]. *) external of_int : int -> int32 = "%int32_of_int" (** Convert the given integer (type [int]) to a 32-bit integer (type [int32]). On 64-bit platforms, the argument is taken modulo 2{^32}. *) external to_int : int32 -> int = "%int32_to_int" (** Convert the given 32-bit integer (type [int32]) to an integer (type [int]). On 32-bit platforms, the 32-bit integer is taken modulo 2{^31}, i.e. the high-order bit is lost during the conversion. On 64-bit platforms, the conversion is exact. *) val of_string_opt: string -> int32 option (** Same as [of_string], but return [None] instead of raising. @since 4.05 *) val to_string : int32 -> string (** Return the string representation of its argument, in signed decimal. *) type t = int32 (** An alias for the type of 32-bit integers. *) val compare: t -> t -> int (** The comparison function for 32-bit integers, with the same specification as {!Stdlib.compare}. Along with the type [t], this function [compare] allows the module [Int32] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) val equal: t -> t -> bool (** The equal function for int32s. @since 4.03.0 *) end # 16 "v3.in.ml" module Int64 : sig # 1 "v3/int64.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** 64-bit integers. This module provides operations on the type [int64] of signed 64-bit integers. Unlike the built-in [int] type, the type [int64] is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over [int64] are taken modulo 2{^64} Performance notice: values of type [int64] occupy more memory space than values of type [int], and arithmetic operations on [int64] are generally slower than those on [int]. Use [int64] only when the application requires exact 64-bit arithmetic. Literals for 64-bit integers are suffixed by L: {[ let zero: int64 = 0L let one: int64 = 1L let m_one: int64 = -1L ]} *) val zero : int64 (** The 64-bit integer 0. *) val one : int64 (** The 64-bit integer 1. *) val minus_one : int64 (** The 64-bit integer -1. *) external neg : int64 -> int64 = "%int64_neg" (** Unary negation. *) external add : int64 -> int64 -> int64 = "%int64_add" (** Addition. *) external sub : int64 -> int64 -> int64 = "%int64_sub" (** Subtraction. *) external mul : int64 -> int64 -> int64 = "%int64_mul" (** Multiplication. *) external div : int64 -> int64 -> int64 = "%int64_div" (** Integer division. Raise [Division_by_zero] if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for {!Stdlib.(/)}. *) external rem : int64 -> int64 -> int64 = "%int64_mod" (** Integer remainder. If [y] is not zero, the result of [Int64.rem x y] satisfies the following property: [x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y)]. If [y = 0], [Int64.rem x y] raises [Division_by_zero]. *) val succ : int64 -> int64 (** Successor. [Int64.succ x] is [Int64.add x Int64.one]. *) val pred : int64 -> int64 (** Predecessor. [Int64.pred x] is [Int64.sub x Int64.one]. *) val abs : int64 -> int64 (** Return the absolute value of its argument. *) val max_int : int64 (** The greatest representable 64-bit integer, 2{^63} - 1. *) val min_int : int64 (** The smallest representable 64-bit integer, -2{^63}. *) external logand : int64 -> int64 -> int64 = "%int64_and" (** Bitwise logical and. *) external logor : int64 -> int64 -> int64 = "%int64_or" (** Bitwise logical or. *) external logxor : int64 -> int64 -> int64 = "%int64_xor" (** Bitwise logical exclusive or. *) val lognot : int64 -> int64 (** Bitwise logical negation. *) external shift_left : int64 -> int -> int64 = "%int64_lsl" (** [Int64.shift_left x y] shifts [x] to the left by [y] bits. The result is unspecified if [y < 0] or [y >= 64]. *) external shift_right : int64 -> int -> int64 = "%int64_asr" (** [Int64.shift_right x y] shifts [x] to the right by [y] bits. This is an arithmetic shift: the sign bit of [x] is replicated and inserted in the vacated bits. The result is unspecified if [y < 0] or [y >= 64]. *) external shift_right_logical : int64 -> int -> int64 = "%int64_lsr" (** [Int64.shift_right_logical x y] shifts [x] to the right by [y] bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of [x]. The result is unspecified if [y < 0] or [y >= 64]. *) external of_int : int -> int64 = "%int64_of_int" (** Convert the given integer (type [int]) to a 64-bit integer (type [int64]). *) external to_int : int64 -> int = "%int64_to_int" (** Convert the given 64-bit integer (type [int64]) to an integer (type [int]). On 64-bit platforms, the 64-bit integer is taken modulo 2{^63}, i.e. the high-order bit is lost during the conversion. On 32-bit platforms, the 64-bit integer is taken modulo 2{^31}, i.e. the top 33 bits are lost during the conversion. *) external of_int32 : int32 -> int64 = "%int64_of_int32" (** Convert the given 32-bit integer (type [int32]) to a 64-bit integer (type [int64]). *) external to_int32 : int64 -> int32 = "%int64_to_int32" (** Convert the given 64-bit integer (type [int64]) to a 32-bit integer (type [int32]). The 64-bit integer is taken modulo 2{^32}, i.e. the top 32 bits are lost during the conversion. *) val of_string_opt: string -> int64 option (** Same as [of_string], but return [None] instead of raising. @since 4.05 *) val to_string : int64 -> string (** Return the string representation of its argument, in decimal. *) type t = int64 (** An alias for the type of 64-bit integers. *) val compare: t -> t -> int (** The comparison function for 64-bit integers, with the same specification as {!Stdlib.compare}. Along with the type [t], this function [compare] allows the module [Int64] to be passed as argument to the functors {!Set.Make} and {!Map.Make}. *) val equal: t -> t -> bool (** The equal function for int64s. @since 4.03.0 *) end # 18 "v3.in.ml" module Format : sig # 1 "v3/format.mli" (**************************************************************************) (* *) (* OCaml *) (* *) (* Pierre Weis, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (** Pretty-printing. This module implements a pretty-printing facility to format values within {{!boxes}'pretty-printing boxes'} and {{!tags}'semantic tags'} combined with a set of {{!fpp}printf-like functions}. The pretty-printer splits lines at specified {{!breaks}break hints}, and indents lines according to the box structure. Similarly, {{!tags}semantic tags} can be used to decouple text presentation from its contents. This pretty-printing facility is implemented as an overlay on top of abstract {{!section:formatter}formatters} which provide basic output functions. Some formatters are predefined, notably: - {!std_formatter} outputs to {{!Stdlib.stdout}stdout} - {!err_formatter} outputs to {{!Stdlib.stderr}stderr} Most functions in the {!Format} module come in two variants: a short version that operates on {!std_formatter} and the generic version prefixed by [pp_] that takes a formatter as its first argument. More formatters can be created with {!formatter_of_out_channel}, {!formatter_of_buffer}, {!formatter_of_symbolic_output_buffer} or using {{!section:formatter}custom formatters}. *) (** {1 Introduction} For a gentle introduction to the basics of pretty-printing using [Format], read {{:http://caml.inria.fr/resources/doc/guides/format.en.html} http://caml.inria.fr/resources/doc/guides/format.en.html}. You may consider this module as providing an extension to the [printf] facility to provide automatic line splitting. The addition of pretty-printing annotations to your regular [printf] format strings gives you fancy indentation and line breaks. Pretty-printing annotations are described below in the documentation of the function {!Format.fprintf}. You may also use the explicit pretty-printing box management and printing functions provided by this module. This style is more basic but more verbose than the concise [fprintf] format strings. For instance, the sequence [open_box 0; print_string "x ="; print_space (); print_int 1; close_box (); print_newline ()] that prints [x = 1] within a pretty-printing box, can be abbreviated as [printf "@[%s@ %i@]@." "x =" 1], or even shorter [printf "@[x =@ %i@]@." 1]. Rule of thumb for casual users of this library: - use simple pretty-printing boxes (as obtained by [open_box 0]); - use simple break hints as obtained by [print_cut ()] that outputs a simple break hint, or by [print_space ()] that outputs a space indicating a break hint; - once a pretty-printing box is open, display its material with basic printing functions (e. g. [print_int] and [print_string]); - when the material for a pretty-printing box has been printed, call [close_box ()] to close the box; - at the end of pretty-printing, flush the pretty-printer to display all the remaining material, e.g. evaluate [print_newline ()]. The behavior of pretty-printing commands is unspecified if there is no open pretty-printing box. Each box opened by one of the [open_] functions below must be closed using [close_box] for proper formatting. Otherwise, some of the material printed in the boxes may not be output, or may be formatted incorrectly. In case of interactive use, each phrase is executed in the initial state of the standard pretty-printer: after each phrase execution, the interactive system closes all open pretty-printing boxes, flushes all pending text, and resets the standard pretty-printer. Warning: mixing calls to pretty-printing functions of this module with calls to {!Stdlib} low level output functions is error prone. The pretty-printing functions output material that is delayed in the pretty-printer queue and stacks in order to compute proper line splitting. In contrast, basic I/O output functions write directly in their output device. As a consequence, the output of a basic I/O function may appear before the output of a pretty-printing function that has been called before. For instance, [ Stdlib.print_string "<"; Format.print_string "PRETTY"; Stdlib.print_string ">"; Format.print_string "TEXT"; ] leads to output [<>PRETTYTEXT]. *) type formatter (** Abstract data corresponding to a pretty-printer (also called a formatter) and all its machinery. See also {!section:formatter}. *) (** {1:boxes Pretty-printing boxes} *) (** The pretty-printing engine uses the concepts of pretty-printing box and break hint to drive indentation and line splitting behavior of the pretty-printer. Each different pretty-printing box kind introduces a specific line splitting policy: - within an {e horizontal} box, break hints never split the line (but the line may be split in a box nested deeper), - within a {e vertical} box, break hints always split the line, - within an {e horizontal/vertical} box, if the box fits on the current line then break hints never split the line, otherwise break hint always split the line, - within a {e compacting} box, a break hint never splits the line, unless there is no more room on the current line. Note that line splitting policy is box specific: the policy of a box does not rule the policy of inner boxes. For instance, if a vertical box is nested in an horizontal box, all break hints within the vertical box will split the line. *) val pp_open_box : formatter -> int -> unit (** [pp_open_box ppf d] opens a new compacting pretty-printing box with offset [d] in the formatter [ppf]. Within this box, the pretty-printer prints as much as possible material on every line. A break hint splits the line if there is no more room on the line to print the remainder of the box. Within this box, the pretty-printer emphasizes the box structure: a break hint also splits the line if the splitting ``moves to the left'' (i.e. the new line gets an indentation smaller than the one of the current line). This box is the general purpose pretty-printing box. If the pretty-printer splits the line in the box, offset [d] is added to the current indentation. *) val pp_close_box : formatter -> unit -> unit (** Closes the most recently open pretty-printing box. *) val pp_open_hbox : formatter -> unit -> unit (** [pp_open_hbox ppf ()] opens a new 'horizontal' pretty-printing box. This box prints material on a single line. Break hints in a horizontal box never split the line. (Line splitting may still occur inside boxes nested deeper). *) val pp_open_vbox : formatter -> int -> unit (** [pp_open_vbox ppf d] opens a new 'vertical' pretty-printing box with offset [d]. This box prints material on as many lines as break hints in the box. Every break hint in a vertical box splits the line. If the pretty-printer splits the line in the box, [d] is added to the current indentation. *) val pp_open_hvbox : formatter -> int -> unit (** [pp_open_hvbox ppf d] opens a new 'horizontal/vertical' pretty-printing box with offset [d]. This box behaves as an horizontal box if it fits on a single line, otherwise it behaves as a vertical box. If the pretty-printer splits the line in the box, [d] is added to the current indentation. *) val pp_open_hovbox : formatter -> int -> unit (** [pp_open_hovbox ppf d] opens a new 'horizontal-or-vertical' pretty-printing box with offset [d]. This box prints material as much as possible on every line. A break hint splits the line if there is no more room on the line to print the remainder of the box. If the pretty-printer splits the line in the box, [d] is added to the current indentation. *) (** {1 Formatting functions} *) val pp_print_string : formatter -> string -> unit (** [pp_print_string ppf s] prints [s] in the current pretty-printing box. *) val pp_print_as : formatter -> int -> string -> unit (** [pp_print_as ppf len s] prints [s] in the current pretty-printing box. The pretty-printer formats [s] as if it were of length [len]. *) val pp_print_int : formatter -> int -> unit (** Print an integer in the current pretty-printing box. *) val pp_print_char : formatter -> char -> unit (** Print a character in the current pretty-printing box. *) val pp_print_bool : formatter -> bool -> unit (** Print a boolean in the current pretty-printing box. *) (** {1:breaks Break hints} *) (** A 'break hint' tells the pretty-printer to output some space or split the line whichever way is more appropriate to the current pretty-printing box splitting rules. Break hints are used to separate printing items and are mandatory to let the pretty-printer correctly split lines and indent items. Simple break hints are: - the 'space': output a space or split the line if appropriate, - the 'cut': split the line if appropriate. Note: the notions of space and line splitting are abstract for the pretty-printing engine, since those notions can be completely redefined by the programmer. However, in the pretty-printer default setting, ``output a space'' simply means printing a space character (ASCII code 32) and ``split the line'' means printing a newline character (ASCII code 10). *) val pp_print_space : formatter -> unit -> unit (** [pp_print_space ppf ()] emits a 'space' break hint: the pretty-printer may split the line at this point, otherwise it prints one space. [pp_print_space ppf ()] is equivalent to [pp_print_break ppf 1 0]. *) val pp_print_cut : formatter -> unit -> unit (** [pp_print_cut ppf ()] emits a 'cut' break hint: the pretty-printer may split the line at this point, otherwise it prints nothing. [pp_print_cut ppf ()] is equivalent to [pp_print_break ppf 0 0]. *) val pp_print_break : formatter -> int -> int -> unit (** [pp_print_break ppf nspaces offset] emits a 'full' break hint: the pretty-printer may split the line at this point, otherwise it prints [nspaces] spaces. If the pretty-printer splits the line, [offset] is added to the current indentation. *) val pp_print_custom_break : formatter -> fits:(string * int * string) -> breaks:(string * int * string) -> unit (** [pp_print_custom_break ppf ~fits:(s1, n, s2) ~breaks:(s3, m, s4)] emits a custom break hint: the pretty-printer may split the line at this point. If it does not split the line, then the [s1] is emitted, then [n] spaces, then [s2]. If it splits the line, then it emits the [s3] string, then an indent (according to the box rules), then an offset of [m] spaces, then the [s4] string. While [n] and [m] are handled by [formatter_out_functions.out_indent], the strings will be handled by [formatter_out_functions.out_string]. This allows for a custom formatter that handles indentation distinctly, for example, outputs [<br/>] tags or [ ] entities. The custom break is useful if you want to change which visible (non-whitespace) characters are printed in case of break or no break. For example, when printing a list [ [a; b; c] ], you might want to add a trailing semicolon when it is printed vertically: {[ [ a; b; c; ] ]} You can do this as follows: {[ printf "@[<v 0>[@;<0 2>@[<v 0>a;@,b;@,c@]%t]@]@\n" (pp_print_custom_break ~fits:("", 0, "") ~breaks:(";", 0, "")) ]} @since 4.08.0 *) val pp_force_newline : formatter -> unit -> unit (** Force a new line in the current pretty-printing box. The pretty-printer must split the line at this point, Not the normal way of pretty-printing, since imperative line splitting may interfere with current line counters and box size calculation. Using break hints within an enclosing vertical box is a better alternative. *) val pp_print_if_newline : formatter -> unit -> unit (** Execute the next formatting command if the preceding line has just been split. Otherwise, ignore the next formatting command. *) (** {1 Pretty-printing termination} *) val pp_print_flush : formatter -> unit -> unit (** End of pretty-printing: resets the pretty-printer to initial state. All open pretty-printing boxes are closed, all pending text is printed. In addition, the pretty-printer low level output device is flushed to ensure that all pending text is really displayed. Note: never use [print_flush] in the normal course of a pretty-printing routine, since the pretty-printer uses a complex buffering machinery to properly indent the output; manually flushing those buffers at random would conflict with the pretty-printer strategy and result to poor rendering. Only consider using [print_flush] when displaying all pending material is mandatory (for instance in case of interactive use when you want the user to read some text) and when resetting the pretty-printer state will not disturb further pretty-printing. Warning: If the output device of the pretty-printer is an output channel, repeated calls to [print_flush] means repeated calls to {!Stdlib.flush} to flush the out channel; these explicit flush calls could foil the buffering strategy of output channels and could dramatically impact efficiency. *) val pp_print_newline : formatter -> unit -> unit (** End of pretty-printing: resets the pretty-printer to initial state. All open pretty-printing boxes are closed, all pending text is printed. Equivalent to {!print_flush} followed by a new line. See corresponding words of caution for {!print_flush}. Note: this is not the normal way to output a new line; the preferred method is using break hints within a vertical pretty-printing box. *) (** {1 Margin} *) val pp_set_margin : formatter -> int -> unit (** [pp_set_margin ppf d] sets the right margin to [d] (in characters): the pretty-printer splits lines that overflow the right margin according to the break hints given. Nothing happens if [d] is smaller than 2. If [d] is too large, the right margin is set to the maximum admissible value (which is greater than [10 ^ 9]). If [d] is less than the current maximum indentation limit, the maximum indentation limit is decreased while trying to preserve a minimal ratio [max_indent/margin>=50%] and if possible the current difference [margin - max_indent]. See also {!pp_set_geometry}. *) val pp_get_margin : formatter -> unit -> int (** Returns the position of the right margin. *) (** {1 Maximum indentation limit} *) val pp_set_max_indent : formatter -> int -> unit (** [pp_set_max_indent ppf d] sets the maximum indentation limit of lines to [d] (in characters): once this limit is reached, new pretty-printing boxes are rejected to the left, unless the enclosing box fully fits on the current line. As an illustration, {[ set_margin 10; set_max_indent 5; printf "@[123456@[7@]89A@]@." ]} yields {[ 123456 789A ]} because the nested box ["@[7@]"] is opened after the maximum indentation limit ([7>5]) and its parent box does not fit on the current line. Either decreasing the length of the parent box to make it fit on a line: {[ printf "@[123456@[7@]89@]@." ]} or opening an intermediary box before the maximum indentation limit which fits on the current line {[ printf "@[123@[456@[7@]89@]A@]@." ]} avoids the rejection to the left of the inner boxes and print respectively ["123456789"] and ["123456789A"] . Note also that vertical boxes never fit on a line whereas horizontal boxes always fully fit on the current line. Nothing happens if [d] is smaller than 2. If [d] is too large, the limit is set to the maximum admissible value (which is greater than [10 ^ 9]). If [d] is greater or equal than the current margin, it is ignored, and the current maximum indentation limit is kept. See also {!pp_set_geometry}. *) val pp_get_max_indent : formatter -> unit -> int (** Return the maximum indentation limit (in characters). *) (** {1 Maximum formatting depth} *) (** The maximum formatting depth is the maximum number of pretty-printing boxes simultaneously open. Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by {!get_ellipsis_text} [()]). *) val pp_set_max_boxes : formatter -> int -> unit (** [pp_set_max_boxes ppf max] sets the maximum number of pretty-printing boxes simultaneously open. Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by {!get_ellipsis_text} [()]). Nothing happens if [max] is smaller than 2. *) val pp_get_max_boxes : formatter -> unit -> int (** Returns the maximum number of pretty-printing boxes allowed before ellipsis. *) val pp_over_max_boxes : formatter -> unit -> bool (** Tests if the maximum number of pretty-printing boxes allowed have already been opened. *) (** {1 Tabulation boxes} *) (** A {e tabulation box} prints material on lines divided into cells of fixed length. A tabulation box provides a simple way to display vertical columns of left adjusted text. This box features command [set_tab] to define cell boundaries, and command [print_tab] to move from cell to cell and split the line when there is no more cells to print on the line. Note: printing within tabulation box is line directed, so arbitrary line splitting inside a tabulation box leads to poor rendering. Yet, controlled use of tabulation boxes allows simple printing of columns within module {!Format}. *) val pp_open_tbox : formatter -> unit -> unit (** [open_tbox ()] opens a new tabulation box. This box prints lines separated into cells of fixed width. Inside a tabulation box, special {e tabulation markers} defines points of interest on the line (for instance to delimit cell boundaries). Function {!Format.set_tab} sets a tabulation marker at insertion point. A tabulation box features specific {e tabulation breaks} to move to next tabulation marker or split the line. Function {!Format.print_tbreak} prints a tabulation break. *) val pp_close_tbox : formatter -> unit -> unit (** Closes the most recently opened tabulation box. *) val pp_set_tab : formatter -> unit -> unit (** Sets a tabulation marker at current insertion point. *) val pp_print_tab : formatter -> unit -> unit (** [print_tab ()] emits a 'next' tabulation break hint: if not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right, or the pretty-printer splits the line and insertion point moves to the leftmost tabulation marker. It is equivalent to [print_tbreak 0 0]. *) val pp_print_tbreak : formatter -> int -> int -> unit (** [print_tbreak nspaces offset] emits a 'full' tabulation break hint. If not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right and the pretty-printer prints [nspaces] spaces. If there is no next tabulation marker on the right, the pretty-printer splits the line at this point, then insertion point moves to the leftmost tabulation marker of the box. If the pretty-printer splits the line, [offset] is added to the current indentation. *) (** {1 Ellipsis} *) val pp_set_ellipsis_text : formatter -> string -> unit (** Set the text of the ellipsis printed when too many pretty-printing boxes are open (a single dot, [.], by default). *) val pp_get_ellipsis_text : formatter -> unit -> string (** Return the text of the ellipsis. *) (** {1 Convenience formatting functions.} *) val pp_print_list: ?pp_sep:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> (formatter -> 'a list -> unit) (** [pp_print_list ?pp_sep pp_v ppf l] prints items of list [l], using [pp_v] to print each item, and calling [pp_sep] between items ([pp_sep] defaults to {!pp_print_cut}. Does nothing on empty lists. @since 4.02.0 *) val pp_print_text : formatter -> string -> unit (** [pp_print_text ppf s] prints [s] with spaces and newlines respectively printed using {!pp_print_space} and {!pp_force_newline}. @since 4.02.0 *) val pp_print_option : ?none:(formatter -> unit -> unit) -> (formatter -> 'a -> unit) -> (formatter -> 'a option -> unit) (** [pp_print_option ?none pp_v ppf o] prints [o] on [ppf] using [pp_v] if [o] is [Some v] and [none] if it is [None]. [none] prints nothing by default. @since 4.08 *) val pp_print_result : ok:(formatter -> 'a -> unit) -> error:(formatter -> 'e -> unit) -> formatter -> ('a, 'e) result -> unit (** [pp_print_result ~ok ~error ppf r] prints [r] on [ppf] using [ok] if [r] is [Ok _] and [error] if [r] is [Error _]. @since 4.08 *) (** {1:fpp Formatted pretty-printing} *) (** Module [Format] provides a complete set of [printf] like functions for pretty-printing using format string specifications. Specific annotations may be added in the format strings to give pretty-printing commands to the pretty-printing engine. Those annotations are introduced in the format strings using the [@] character. For instance, [@ ] means a space break, [@,] means a cut, [@\[] opens a new box, and [@\]] closes the last open box. *) val fprintf : formatter -> ('a, formatter, unit) format -> 'a (** [fprintf ff fmt arg1 ... argN] formats the arguments [arg1] to [argN] according to the format string [fmt], and outputs the resulting string on the formatter [ff]. The format string [fmt] is a character string which contains three types of objects: plain characters and conversion specifications as specified in the {!Printf} module, and pretty-printing indications specific to the [Format] module. The pretty-printing indication characters are introduced by a [@] character, and their meanings are: - [@\[]: open a pretty-printing box. The type and offset of the box may be optionally specified with the following syntax: the [<] character, followed by an optional box type indication, then an optional integer offset, and the closing [>] character. Pretty-printing box type is one of [h], [v], [hv], [b], or [hov]. '[h]' stands for an 'horizontal' pretty-printing box, '[v]' stands for a 'vertical' pretty-printing box, '[hv]' stands for an 'horizontal/vertical' pretty-printing box, '[b]' stands for an 'horizontal-or-vertical' pretty-printing box demonstrating indentation, '[hov]' stands a simple 'horizontal-or-vertical' pretty-printing box. For instance, [@\[<hov 2>] opens an 'horizontal-or-vertical' pretty-printing box with indentation 2 as obtained with [open_hovbox 2]. For more details about pretty-printing boxes, see the various box opening functions [open_*box]. - [@\]]: close the most recently opened pretty-printing box. - [@,]: output a 'cut' break hint, as with [print_cut ()]. - [@ ]: output a 'space' break hint, as with [print_space ()]. - [@;]: output a 'full' break hint as with [print_break]. The [nspaces] and [offset] parameters of the break hint may be optionally specified with the following syntax: the [<] character, followed by an integer [nspaces] value, then an integer [offset], and a closing [>] character. If no parameters are provided, the good break defaults to a 'space' break hint. - [@.]: flush the pretty-printer and split the line, as with [print_newline ()]. - [@<n>]: print the following item as if it were of length [n]. Hence, [printf "@<0>%s" arg] prints [arg] as a zero length string. If [@<n>] is not followed by a conversion specification, then the following character of the format is printed as if it were of length [n]. - [@\{]: open a semantic tag. The name of the tag may be optionally specified with the following syntax: the [<] character, followed by an optional string specification, and the closing [>] character. The string specification is any character string that does not contain the closing character ['>']. If omitted, the tag name defaults to the empty string. For more details about semantic tags, see the functions {!open_stag} and {!close_stag}. - [@\}]: close the most recently opened semantic tag. - [@?]: flush the pretty-printer as with [print_flush ()]. This is equivalent to the conversion [%!]. - [@\n]: force a newline, as with [force_newline ()], not the normal way of pretty-printing, you should prefer using break hints inside a vertical pretty-printing box. Note: To prevent the interpretation of a [@] character as a pretty-printing indication, escape it with a [%] character. Old quotation mode [@@] is deprecated since it is not compatible with formatted input interpretation of character ['@']. Example: [printf "@[%s@ %d@]@." "x =" 1] is equivalent to [open_box (); print_string "x ="; print_space (); print_int 1; close_box (); print_newline ()]. It prints [x = 1] within a pretty-printing 'horizontal-or-vertical' box. *) val sprintf : ('a, unit, string) format -> 'a (** Same as [printf] above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. Note that the pretty-printer queue is flushed at the end of {e each call} to [sprintf]. In case of multiple and related calls to [sprintf] to output material on a single string, you should consider using [fprintf] with the predefined formatter [str_formatter] and call [flush_str_formatter ()] to get the final result. Alternatively, you can use [Format.fprintf] with a formatter writing to a buffer of your own: flushing the formatter and the buffer at the end of pretty-printing returns the desired string. *) val asprintf : ('a, formatter, unit, string) format4 -> 'a (** Same as [printf] above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. The type of [asprintf] is general enough to interact nicely with [%a] conversions. @since 4.01.0 *) val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a (** Same as {!fprintf}, except the formatter is the last argument. [dprintf "..." a b c] is a function of type [formatter -> unit] which can be given to a format specifier [%t]. This can be used as a replacement for {!asprintf} to delay formatting decisions. Using the string returned by {!asprintf} in a formatting context forces formatting decisions to be taken in isolation, and the final string may be created prematurely. {!dprintf} allows delay of formatting decisions until the final formatting context is known. For example: {[ let t = Format.dprintf "%i@ %i@ %i" 1 2 3 in ... Format.printf "@[<v>%t@]" t ]} @since 4.08.0 *) val ifprintf : formatter -> ('a, formatter, unit) format -> 'a (** Same as [fprintf] above, but does not print anything. Useful to ignore some material when conditionally printing. @since 3.10.0 *) (** Formatted Pretty-Printing with continuations. *) val kfprintf : (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b (** Same as [fprintf] above, but instead of returning immediately, passes the formatter to its first argument at the end of printing. *) val kdprintf : ((formatter -> unit) -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b (** Same as {!dprintf} above, but instead of returning immediately, passes the suspended printer to its first argument at the end of printing. @since 4.08.0 *) val ikfprintf : (formatter -> 'a) -> formatter -> ('b, formatter, unit, 'a) format4 -> 'b (** Same as [kfprintf] above, but does not print anything. Useful to ignore some material when conditionally printing. @since 3.12.0 *) val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b (** Same as [sprintf] above, but instead of returning the string, passes it to the first argument. *) val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b (** Same as [asprintf] above, but instead of returning the string, passes it to the first argument. @since 4.03 *) end # 20 "v3.in.ml" module Logging : sig # 1 "v3/logging.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Logging levels. See [docs/developer/guidelines.rst] for their meaning *) type level = Debug | Info | Notice | Warning | Error | Fatal (** Logs a message. It is the shell's responsibility to manage the actual logging. Even though logging may involve system calls, formatting, or other work, the shell guarantees that calling this function doesn't transfer control over another promise. Consequently, the performance of this function can be considered predictable from the point of view of gas-consumption. Note that the function call has predictable performance, but that it is the caller's responsibility to ensure that argument evaluation has predictable performance too. E.g., [log Notice "%s" (Format.asprint …)] may spend time formatting the argument string. *) val log : level -> ('a, Format.formatter, unit, unit) format4 -> 'a (** Same as [log] but more efficient with a simpler interface. *) val log_string : level -> string -> unit end # 22 "v3.in.ml" module Hex : sig # 1 "v3/hex.mli" (* * Copyright (c) 2015 Trevor Summers Smith <trevorsummerssmith@gmail.com> * Copyright (c) 2014 Thomas Gazagnaire <thomas@gazagnaire.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) (** Hexadecimal encoding. [Hex] defines hexadecimal encodings for {{!char}characters}, {{!string}strings} and {{!cstruct}Cstruct.t} buffers. *) type t = [`Hex of string] (** The type var hexadecimal values. *) (** {1:char Characters} *) val of_char: char -> char * char (** [of_char c] is the the hexadecimal encoding of the character [c]. *) val to_char: char -> char -> char (** [to_char x y] is the character corresponding to the [xy] hexadecimal encoding. *) (** {1:string Strings} *) val of_string: ?ignore:char list -> string -> t (** [of_string s] is the hexadecimal representation of the binary string [s]. If [ignore] is set, skip the characters in the list when converting. Eg [of_string ~ignore:[' '] "a f"]. The default value of [ignore] is [[]]). *) val to_string: t -> string (** [to_string t] is the binary string [s] such that [of_string s] is [t]. *) (** {1:byte Bytes} *) val of_bytes: ?ignore:char list -> bytes -> t (** [of_bytes s] is the hexadecimal representation of the binary string [s]. If [ignore] is set, skip the characters in the list when converting. Eg [of_bytes ~ignore:[' '] "a f"]. The default value of [ignore] is [[]]). *) val to_bytes: t -> bytes (** [to_bytes t] is the binary string [s] such that [of_bytes s] is [t]. *) (** {1 Debugging} *) val hexdump_s: ?print_row_numbers:bool -> ?print_chars:bool -> t -> string (** Same as [hexdump] except returns a string. *) (** {1 Pretty printing} *) val pp : Format.formatter -> t -> unit [@@ocaml.toplevel_printer] (** [pp fmt t] will output a human-readable hex representation of [t] to the formatter [fmt]. *) val show : t -> string (** [show t] will return a human-readable hex representation of [t] as a string. *) end # 24 "v3.in.ml" module Z : sig # 1 "v3/z.mli" (* This file was automatically generated by z_pp.pl from z.mlip *) (** Integers. This modules provides arbitrary-precision integers. Small integers internally use a regular OCaml [int]. When numbers grow too large, we switch transparently to GMP numbers ([mpn] numbers fully allocated on the OCaml heap). This interface is rather similar to that of [Int32] and [Int64], with some additional functions provided natively by GMP (GCD, square root, pop-count, etc.). This file is part of the Zarith library http://forge.ocamlcore.org/projects/zarith . It is distributed under LGPL 2 licensing, with static linking exception. See the LICENSE file included in the distribution. Copyright (c) 2010-2011 Antoine Miné, Abstraction project. Abstraction is part of the LIENS (Laboratoire d'Informatique de l'ENS), a joint laboratory by: CNRS (Centre national de la recherche scientifique, France), ENS (École normale supérieure, Paris, France), INRIA Rocquencourt (Institut national de recherche en informatique, France). *) (** {1 Toplevel} *) (** For an optimal experience with the [ocaml] interactive toplevel, the magic commands are: {[ #load "zarith.cma";; #install_printer Z.pp_print;; ]} Alternatively, using the new [Zarith_top] toplevel module, simply: {[ #require "zarith.top";; ]} *) (** {1 Types} *) type t (** Type of integers of arbitrary length. *) exception Overflow (** Raised by conversion functions when the value cannot be represented in the destination type. *) (** {1 Construction} *) val zero: t (** The number 0. *) val one: t (** The number 1. *) val minus_one: t (** The number -1. *) external of_int: int -> t = "%identity" (** Converts from a base integer. *) external of_int32: int32 -> t = "ml_z_of_int32" (** Converts from a 32-bit integer. *) external of_int64: int64 -> t = "ml_z_of_int64" (** Converts from a 64-bit integer. *) val of_string: string -> t (** Converts a string to an integer. An optional [-] prefix indicates a negative number, while a [+] prefix is ignored. An optional prefix [0x], [0o], or [0b] (following the optional [-] or [+] prefix) indicates that the number is, represented, in hexadecimal, octal, or binary, respectively. Otherwise, base 10 is assumed. (Unlike C, a lone [0] prefix does not denote octal.) Raises an [Invalid_argument] exception if the string is not a syntactically correct representation of an integer. *) val of_substring : string -> pos:int -> len:int -> t (** [of_substring s ~pos ~len] is the same as [of_string (String.sub s pos len)] *) val of_string_base: int -> string -> t (** Parses a number represented as a string in the specified base, with optional [-] or [+] prefix. The base must be between 2 and 16. *) external of_substring_base : int -> string -> pos:int -> len:int -> t = "ml_z_of_substring_base" (** [of_substring_base base s ~pos ~len] is the same as [of_string_base base (String.sub s pos len)] *) (** {1 Basic arithmetic operations} *) val succ: t -> t (** Returns its argument plus one. *) val pred: t -> t (** Returns its argument minus one. *) val abs: t -> t (** Absolute value. *) val neg: t -> t (** Unary negation. *) val add: t -> t -> t (** Addition. *) val sub: t -> t -> t (** Subtraction. *) val mul: t -> t -> t (** Multiplication. *) val div: t -> t -> t (** Integer division. The result is truncated towards zero and obeys the rule of signs. Raises [Division_by_zero] if the divisor (second argument) is 0. *) val rem: t -> t -> t (** Integer remainder. Can raise a [Division_by_zero]. The result of [rem a b] has the sign of [a], and its absolute value is strictly smaller than the absolute value of [b]. The result satisfies the equality [a = b * div a b + rem a b]. *) external div_rem: t -> t -> (t * t) = "ml_z_div_rem" (** Computes both the integer quotient and the remainder. [div_rem a b] is equal to [(div a b, rem a b)]. Raises [Division_by_zero] if [b = 0]. *) external cdiv: t -> t -> t = "ml_z_cdiv" (** Integer division with rounding towards +oo (ceiling). Can raise a [Division_by_zero]. *) external fdiv: t -> t -> t = "ml_z_fdiv" (** Integer division with rounding towards -oo (floor). Can raise a [Division_by_zero]. *) val ediv_rem: t -> t -> (t * t) (** Euclidean division and remainder. [ediv_rem a b] returns a pair [(q, r)] such that [a = b * q + r] and [0 <= r < |b|]. Raises [Division_by_zero] if [b = 0]. *) val ediv: t -> t -> t (** Euclidean division. [ediv a b] is equal to [fst (ediv_rem a b)]. The result satisfies [0 <= a - b * ediv a b < |b|]. Raises [Division_by_zero] if [b = 0]. *) val erem: t -> t -> t (** Euclidean remainder. [erem a b] is equal to [snd (ediv_rem a b)]. The result satisfies [0 <= erem a b < |b|] and [a = b * ediv a b + erem a b]. Raises [Division_by_zero] if [b = 0]. *) val divexact: t -> t -> t (** [divexact a b] divides [a] by [b], only producing correct result when the division is exact, i.e., when [b] evenly divides [a]. It should be faster than general division. Can raise a [Division_by_zero]. *) external divisible: t -> t -> bool = "ml_z_divisible" (** [divisible a b] returns [true] if [a] is exactly divisible by [b]. Unlike the other division functions, [b = 0] is accepted (only 0 is considered divisible by 0). *) external congruent: t -> t -> t -> bool = "ml_z_congruent" (** [congruent a b c] returns [true] if [a] is congruent to [b] modulo [c]. Unlike the other division functions, [c = 0] is accepted (only equal numbers are considered equal congruent 0). *) (** {1 Bit-level operations} *) (** For all bit-level operations, negative numbers are considered in 2's complement representation, starting with a virtual infinite number of 1s. *) val logand: t -> t -> t (** Bitwise logical and. *) val logor: t -> t -> t (** Bitwise logical or. *) val logxor: t -> t -> t (** Bitwise logical exclusive or. *) val lognot: t -> t (** Bitwise logical negation. The identity [lognot a]=[-a-1] always hold. *) val shift_left: t -> int -> t (** Shifts to the left. Equivalent to a multiplication by a power of 2. The second argument must be nonnegative. *) val shift_right: t -> int -> t (** Shifts to the right. This is an arithmetic shift, equivalent to a division by a power of 2 with rounding towards -oo. The second argument must be nonnegative. *) val shift_right_trunc: t -> int -> t (** Shifts to the right, rounding towards 0. This is equivalent to a division by a power of 2, with truncation. The second argument must be nonnegative. *) external numbits: t -> int = "ml_z_numbits" [@@noalloc] (** Returns the number of significant bits in the given number. If [x] is zero, [numbits x] returns 0. Otherwise, [numbits x] returns a positive integer [n] such that [2^{n-1} <= |x| < 2^n]. Note that [numbits] is defined for negative arguments, and that [numbits (-x) = numbits x]. *) external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] (** Returns the number of trailing 0 bits in the given number. If [x] is zero, [trailing_zeros x] returns [max_int]. Otherwise, [trailing_zeros x] returns a nonnegative integer [n] which is the largest [n] such that [2^n] divides [x] evenly. Note that [trailing_zeros] is defined for negative arguments, and that [trailing_zeros (-x) = trailing_zeros x]. *) val testbit: t -> int -> bool (** [testbit x n] return the value of bit number [n] in [x]: [true] if the bit is 1, [false] if the bit is 0. Bits are numbered from 0. Raise [Invalid_argument] if [n] is negative. *) external popcount: t -> int = "ml_z_popcount" (** Counts the number of bits set. Raises [Overflow] for negative arguments, as those have an infinite number of bits set. *) external hamdist: t -> t -> int = "ml_z_hamdist" (** Counts the number of different bits. Raises [Overflow] if the arguments have different signs (in which case the distance is infinite). *) (** {1 Conversions} *) (** Note that, when converting to an integer type that cannot represent the converted value, an [Overflow] exception is raised. *) val to_int: t -> int (** Converts to a base integer. May raise [Overflow]. *) external to_int32: t -> int32 = "ml_z_to_int32" (** Converts to a 32-bit integer. May raise [Overflow]. *) external to_int64: t -> int64 = "ml_z_to_int64" (** Converts to a 64-bit integer. May raise [Overflow]. *) val to_string: t -> string (** Gives a human-readable, decimal string representation of the argument. *) external format: string -> t -> string = "ml_z_format" (** Gives a string representation of the argument in the specified printf-like format. The general specification has the following form: [% \[flags\] \[width\] type] Where the type actually indicates the base: - [i], [d], [u]: decimal - [b]: binary - [o]: octal - [x]: lowercase hexadecimal - [X]: uppercase hexadecimal Supported flags are: - [+]: prefix positive numbers with a [+] sign - space: prefix positive numbers with a space - [-]: left-justify (default is right justification) - [0]: pad with zeroes (instead of spaces) - [#]: alternate formatting (actually, simply output a literal-like prefix: [0x], [0b], [0o]) Unlike the classic [printf], all numbers are signed (even hexadecimal ones), there is no precision field, and characters that are not part of the format are simply ignored (and not copied in the output). *) external fits_int: t -> bool = "ml_z_fits_int" [@@noalloc] (** Whether the argument fits in a regular [int]. *) external fits_int32: t -> bool = "ml_z_fits_int32" [@@noalloc] (** Whether the argument fits in an [int32]. *) external fits_int64: t -> bool = "ml_z_fits_int64" [@@noalloc] (** Whether the argument fits in an [int64]. *) (** {1 Printing} *) val pp_print: Format.formatter -> t -> unit (** Prints the argument on the specified formatter. Can be used as [%a] format printer in [Format.printf] and as argument to [#install_printer] in the top-level. *) (** {1 Ordering} *) external compare: t -> t -> int = "ml_z_compare" [@@noalloc] (** Comparison. [compare x y] returns 0 if [x] equals [y], -1 if [x] is smaller than [y], and 1 if [x] is greater than [y]. Note that Pervasive.compare can be used to compare reliably two integers only on OCaml 3.12.1 and later versions. *) external equal: t -> t -> bool = "ml_z_equal" [@@noalloc] (** Equality test. *) val leq: t -> t -> bool (** Less than or equal. *) val geq: t -> t -> bool (** Greater than or equal. *) val lt: t -> t -> bool (** Less than (and not equal). *) val gt: t -> t -> bool (** Greater than (and not equal). *) external sign: t -> int = "ml_z_sign" [@@noalloc] (** Returns -1, 0, or 1 when the argument is respectively negative, null, or positive. *) val min: t -> t -> t (** Returns the minimum of its arguments. *) val max: t -> t -> t (** Returns the maximum of its arguments. *) val is_even: t -> bool (** Returns true if the argument is even (divisible by 2), false if odd. *) val is_odd: t -> bool (** Returns true if the argument is odd, false if even. *) (** {1 Powers} *) external pow: t -> int -> t = "ml_z_pow" (** [pow base exp] raises [base] to the [exp] power. [exp] must be nonnegative. Note that only exponents fitting in a machine integer are supported, as larger exponents would surely make the result's size overflow the address space. *) external sqrt: t -> t = "ml_z_sqrt" (** Returns the square root. The result is truncated (rounded down to an integer). Raises an [Invalid_argument] on negative arguments. *) external sqrt_rem: t -> (t * t) = "ml_z_sqrt_rem" (** Returns the square root truncated, and the remainder. Raises an [Invalid_argument] on negative arguments. *) external root: t -> int -> t = "ml_z_root" (** [root x n] computes the [n]-th root of [x]. [n] must be positive and, if [n] is even, then [x] must be nonnegative. Otherwise, an [Invalid_argument] is raised. *) external rootrem: t -> int -> t * t = "ml_z_rootrem" (** [rootrem x n] computes the [n]-th root of [x] and the remainder [x-root**n]. [n] must be positive and, if [n] is even, then [x] must be nonnegative. Otherwise, an [Invalid_argument] is raised. *) external perfect_power: t -> bool = "ml_z_perfect_power" (** True if the argument has the form [a^b], with [b>1] *) external perfect_square: t -> bool = "ml_z_perfect_square" (** True if the argument has the form [a^2]. *) val log2: t -> int (** Returns the base-2 logarithm of its argument, rounded down to an integer. If [x] is positive, [log2 x] returns the largest [n] such that [2^n <= x]. If [x] is negative or zero, [log2 x] raise the [Invalid_argument] exception. *) val log2up: t -> int (** Returns the base-2 logarithm of its argument, rounded up to an integer. If [x] is positive, [log2up x] returns the smallest [n] such that [x <= 2^n]. If [x] is negative or zero, [log2up x] raise the [Invalid_argument] exception. *) (** {1 Representation} *) external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) external extract: t -> int -> int -> t = "ml_z_extract" (** [extract a off len] returns a nonnegative number corresponding to bits [off] to [off]+[len]-1 of [b]. Negative [a] are considered in infinite-length 2's complement representation. *) val signed_extract: t -> int -> int -> t (** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], as [extract] does, then sign-extends bit [len-1] of the result (that is, bit [off + len - 1] of [a]). The result is between [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), and equal to [extract a off len] modulo [2{^len}]. *) external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, corresponding to the binary representation of the absolute value of the argument in little endian ordering. The sign is not stored in the string. *) external of_bits: string -> t = "ml_z_of_bits" (** Constructs a number from a binary string representation. The string is interpreted as a sequence of bytes in little endian order, and the result is always positive. We have the identity: [of_bits (to_bits x) = abs x]. However, we can have [to_bits (of_bits s) <> s] due to the presence of trailing zeros in s. *) end # 26 "v3.in.ml" module Lwt : sig # 1 "v3/lwt.mli" (* This file is part of Lwt, released under the MIT license. See LICENSE.md for details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. *) (** {2 Fundamentals} *) (** {3 Promises} *) type +'a t (** Promises for values of type ['a]. A {b promise} is a memory cell that is always in one of three {b states}: - {e fulfilled}, and containing one value of type ['a], - {e rejected}, and containing one exception, or - {e pending}, in which case it may become fulfilled or rejected later. A {e resolved} promise is one that is either fulfilled or rejected, i.e. not pending. Once a promise is resolved, its content cannot change. So, promises are {e write-once references}. The only possible state changes are (1) from pending to fulfilled and (2) from pending to rejected. Promises are typically “read” by attaching {b callbacks} to them. The most basic functions for that are {!Lwt.bind}, which attaches a callback that is called when a promise becomes fulfilled, and {!Lwt.catch}, for rejection. Promise variables of this type, ['a Lwt.t], are actually {b read-only} in Lwt. Separate {e resolvers} of type ['a ]{!Lwt.u} are used to write to them. Promises and their resolvers are created together by calling {!Lwt.wait}. There is one exception to this: most promises can be {e canceled} by calling {!Lwt.cancel}, without going through a resolver. *) val return : 'a -> 'a t (** [Lwt.return v] creates a new {{: #TYPEt} promise} that is {e already fulfilled} with value [v]. This is needed to satisfy the type system in some cases. For example, in a [match] expression where one case evaluates to a promise, the other cases have to evaluate to promises as well: {[ match need_input with | true -> Lwt_io.(read_line stdin) (* Has type string Lwt.t... *) | false -> Lwt.return "" (* ...so wrap empty string in a promise. *) ]} Another typical usage is in {{: #VALbind} [let%lwt]}. The expression after the “[in]” has to evaluate to a promise. So, if you compute an ordinary value instead, you have to wrap it: {[ let%lwt line = Lwt_io.(read_line stdin) in Lwt.return (line ^ ".") ]} *) (** {3 Callbacks} *) val bind : 'a t -> ('a -> 'b t) -> 'b t (** [Lwt.bind p_1 f] makes it so that [f] will run when [p_1] is {{: #TYPEt} {e fulfilled}}. When [p_1] is fulfilled with value [v_1], the callback [f] is called with that same value [v_1]. Eventually, after perhaps starting some I/O or other computation, [f] returns promise [p_2]. [Lwt.bind] itself returns immediately. It only attaches the callback [f] to [p_1] – it does not wait for [p_2]. {e What} [Lwt.bind] returns is yet a third promise, [p_3]. Roughly speaking, fulfillment of [p_3] represents both [p_1] and [p_2] becoming fulfilled, one after the other. A minimal example of this is an echo program: {[ let () = let p_3 = Lwt.bind Lwt_io.(read_line stdin) (fun line -> Lwt_io.printl line) in Lwt_main.run p_3 (* ocamlfind opt -linkpkg -thread -package lwt.unix code.ml && ./a.out *) ]} Rejection of [p_1] and [p_2], and raising an exception in [f], are all forwarded to rejection of [p_3]. {b Precise behavior} [Lwt.bind] returns a promise [p_3] immediately. [p_3] starts out pending, and is resolved as follows: - The first condition to wait for is that [p_1] becomes resolved. It does not matter whether [p_1] is already resolved when [Lwt.bind] is called, or becomes resolved later – the rest of the behavior is the same. - If and when [p_1] becomes resolved, it will, by definition, be either fulfilled or rejected. - If [p_1] is rejected, [p_3] is rejected with the same exception. - If [p_1] is fulfilled, with value [v], [f] is applied to [v]. - [f] may finish by returning the promise [p_2], or raising an exception. - If [f] raises an exception, [p_3] is rejected with that exception. - Finally, the remaining case is when [f] returns [p_2]. From that point on, [p_3] is effectively made into a reference to [p_2]. This means they have the same state, undergo the same state changes, and performing any operation on one is equivalent to performing it on the other. {b Syntactic sugar} [Lwt.bind] is almost never written directly, because sequences of [Lwt.bind] result in growing indentation and many parentheses: {[ let () = Lwt_main.run begin Lwt.bind Lwt_io.(read_line stdin) (fun line -> Lwt.bind (Lwt_unix.sleep 1.) (fun () -> Lwt_io.printf "One second ago, you entered %s\n" line)) end (* ocamlfind opt -linkpkg -thread -package lwt.unix code.ml && ./a.out *) ]} The recommended way to write [Lwt.bind] is using the [let%lwt] syntactic sugar: {[ let () = Lwt_main.run begin let%lwt line = Lwt_io.(read_line stdin) in let%lwt () = Lwt_unix.sleep 1. in Lwt_io.printf "One second ago, you entered %s\n" line end (* ocamlfind opt -linkpkg -thread -package lwt_ppx,lwt.unix code.ml && ./a.out *) ]} This uses the Lwt {{: Ppx_lwt.html} PPX} (preprocessor). Note that we had to add package [lwt_ppx] to the command line for building this program. We will do that throughout this manual. Another way to write [Lwt.bind], that you may encounter while reading code, is with the [>>=] operator: {[ open Lwt.Infix let () = Lwt_main.run begin Lwt_io.(read_line stdin) >>= fun line -> Lwt_unix.sleep 1. >>= fun () -> Lwt_io.printf "One second ago, you entered %s\n" line end (* ocamlfind opt -linkpkg -thread -package lwt.unix code.ml && ./a.out *) ]} The [>>=] operator comes from the module {!Lwt.Infix}, which is why we opened it at the beginning of the program. See also {!Lwt.map}. *) (** {2 Convenience} *) (** {3 Callback helpers} *) val map : ('a -> 'b) -> 'a t -> 'b t (** [Lwt.map f p_1] is similar to {!Lwt.bind}[ p_1 f], but [f] is not expected to return a promise. This function is more convenient that {!Lwt.bind} when [f] inherently does not return a promise. An example is [Stdlib.int_of_string]: {[ let read_int : unit -> int Lwt.t = fun () -> Lwt.map int_of_string Lwt_io.(read_line stdin) let () = Lwt_main.run begin let%lwt number = read_int () in Lwt_io.printf "%i\n" number end (* ocamlfind opt -linkpkg -thread -package lwt_ppx,lwt.unix code.ml && ./a.out *) ]} By comparison, the {!Lwt.bind} version is more awkward: {[ let read_int : unit -> int Lwt.t = fun () -> Lwt.bind Lwt_io.(read_line stdin) (fun line -> Lwt.return (int_of_string line)) ]} As with {!Lwt.bind}, sequences of calls to [Lwt.map] result in excessive indentation and parentheses. The recommended syntactic sugar for avoiding this is the {{: #VAL(>|=)} [>|=]} operator, which comes from module [Lwt.Infix]: {[ open Lwt.Infix let read_int : unit -> int Lwt.t = fun () -> Lwt_io.(read_line stdin) >|= int_of_string ]} The detailed operation follows. For consistency with the promises in {!Lwt.bind}, the {e two} promises involved are named [p_1] and [p_3]: - [p_1] is the promise passed to [Lwt.map]. - [p_3] is the promise returned by [Lwt.map]. [Lwt.map] returns a promise [p_3]. [p_3] starts out pending. It is resolved as follows: - [p_1] may be, or become, resolved. In that case, by definition, it will become fulfilled or rejected. Fulfillment is the interesting case, but the behavior on rejection is simpler, so we focus on rejection first. - When [p_1] becomes rejected, [p_3] is rejected with the same exception. - When [p_1] instead becomes fulfilled, call the value it is fulfilled with [v]. - [f v] is applied. If this finishes, it may either return another value, or raise an exception. - If [f v] returns another value [v'], [p_3] is fulfilled with [v']. - If [f v] raises exception [exn], [p_3] is rejected with [exn]. *) (** {3 Pre-allocated promises} *) val return_unit : unit t (** [Lwt.return_unit] is defined as {!Lwt.return}[ ()], but this definition is evaluated only once, during initialization of module [Lwt], at the beginning of your program. This means the promise is allocated only once. By contrast, each time {!Lwt.return}[ ()] is evaluated, it allocates a new promise. It is recommended to use [Lwt.return_unit] only where you know the allocations caused by an instance of {!Lwt.return}[ ()] are a performance bottleneck. Generally, the cost of I/O tends to dominate the cost of {!Lwt.return}[ ()] anyway. In future Lwt, we hope to perform this optimization, of using a single, pre-allocated promise, automatically, wherever {!Lwt.return}[ ()] is written. *) val return_none : (_ option) t (** [Lwt.return_none] is like {!Lwt.return_unit}, but for {!Lwt.return}[ None]. *) val return_nil : (_ list) t (** [Lwt.return_nil] is like {!Lwt.return_unit}, but for {!Lwt.return}[ []]. *) val return_true : bool t (** [Lwt.return_true] is like {!Lwt.return_unit}, but for {!Lwt.return}[ true]. *) val return_false : bool t (** [Lwt.return_false] is like {!Lwt.return_unit}, but for {!Lwt.return}[ false]. *) end # 28 "v3.in.ml" module Data_encoding : sig # 1 "v3/data_encoding.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** In memory JSON data *) type json = [ `O of (string * json) list | `Bool of bool | `Float of float | `A of json list | `Null | `String of string ] type json_schema type 'a t type 'a encoding = 'a t val classify : 'a encoding -> [`Fixed of int | `Dynamic | `Variable] val splitted : json:'a encoding -> binary:'a encoding -> 'a encoding val null : unit encoding val empty : unit encoding val unit : unit encoding val constant : string -> unit encoding val int8 : int encoding val uint8 : int encoding val int16 : int encoding val uint16 : int encoding val int31 : int encoding val int32 : int32 encoding val int64 : int64 encoding val n : Z.t encoding val z : Z.t encoding val bool : bool encoding val string : string encoding val bytes : bytes encoding val option : 'a encoding -> 'a option encoding val string_enum : (string * 'a) list -> 'a encoding module Fixed : sig val string : int -> string encoding val bytes : int -> bytes encoding val add_padding : 'a encoding -> int -> 'a encoding end module Variable : sig val string : string encoding val bytes : bytes encoding val array : ?max_length:int -> 'a encoding -> 'a array encoding val list : ?max_length:int -> 'a encoding -> 'a list encoding end module Bounded : sig val string : int -> string encoding val bytes : int -> bytes encoding end val dynamic_size : ?kind:[`Uint30 | `Uint16 | `Uint8] -> 'a encoding -> 'a encoding val json : json encoding val json_schema : json_schema encoding type 'a field val req : ?title:string -> ?description:string -> string -> 't encoding -> 't field val opt : ?title:string -> ?description:string -> string -> 't encoding -> 't option field val varopt : ?title:string -> ?description:string -> string -> 't encoding -> 't option field val dft : ?title:string -> ?description:string -> string -> 't encoding -> 't -> 't field val obj1 : 'f1 field -> 'f1 encoding val obj2 : 'f1 field -> 'f2 field -> ('f1 * 'f2) encoding val obj3 : 'f1 field -> 'f2 field -> 'f3 field -> ('f1 * 'f2 * 'f3) encoding val obj4 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> ('f1 * 'f2 * 'f3 * 'f4) encoding val obj5 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> 'f5 field -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5) encoding val obj6 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> 'f5 field -> 'f6 field -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6) encoding val obj7 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> 'f5 field -> 'f6 field -> 'f7 field -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7) encoding val obj8 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> 'f5 field -> 'f6 field -> 'f7 field -> 'f8 field -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7 * 'f8) encoding val obj9 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> 'f5 field -> 'f6 field -> 'f7 field -> 'f8 field -> 'f9 field -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7 * 'f8 * 'f9) encoding val obj10 : 'f1 field -> 'f2 field -> 'f3 field -> 'f4 field -> 'f5 field -> 'f6 field -> 'f7 field -> 'f8 field -> 'f9 field -> 'f10 field -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7 * 'f8 * 'f9 * 'f10) encoding val tup1 : 'f1 encoding -> 'f1 encoding val tup2 : 'f1 encoding -> 'f2 encoding -> ('f1 * 'f2) encoding val tup3 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> ('f1 * 'f2 * 'f3) encoding val tup4 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> ('f1 * 'f2 * 'f3 * 'f4) encoding val tup5 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> 'f5 encoding -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5) encoding val tup6 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> 'f5 encoding -> 'f6 encoding -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6) encoding val tup7 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> 'f5 encoding -> 'f6 encoding -> 'f7 encoding -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7) encoding val tup8 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> 'f5 encoding -> 'f6 encoding -> 'f7 encoding -> 'f8 encoding -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7 * 'f8) encoding val tup9 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> 'f5 encoding -> 'f6 encoding -> 'f7 encoding -> 'f8 encoding -> 'f9 encoding -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7 * 'f8 * 'f9) encoding val tup10 : 'f1 encoding -> 'f2 encoding -> 'f3 encoding -> 'f4 encoding -> 'f5 encoding -> 'f6 encoding -> 'f7 encoding -> 'f8 encoding -> 'f9 encoding -> 'f10 encoding -> ('f1 * 'f2 * 'f3 * 'f4 * 'f5 * 'f6 * 'f7 * 'f8 * 'f9 * 'f10) encoding val merge_objs : 'o1 encoding -> 'o2 encoding -> ('o1 * 'o2) encoding val merge_tups : 'a1 encoding -> 'a2 encoding -> ('a1 * 'a2) encoding val array : ?max_length:int -> 'a encoding -> 'a array encoding val list : ?max_length:int -> 'a encoding -> 'a list encoding val assoc : 'a encoding -> (string * 'a) list encoding type case_tag = Tag of int | Json_only type 't case val case : title:string -> ?description:string -> case_tag -> 'a encoding -> ('t -> 'a option) -> ('a -> 't) -> 't case type match_result type 'a matching_function = 'a -> match_result (* [tag_size] is not declared in the upstream library, instead, the expanded polymorphic-variant type-expression is used as is. We include it in the protocol environment to help coq-of-ocaml process the files. *) type tag_size = [`Uint8 | `Uint16] val matched : ?tag_size:tag_size -> int -> 'a encoding -> 'a -> match_result val matching : ?tag_size:tag_size -> 't matching_function -> 't case list -> 't encoding val union : ?tag_size:tag_size -> 't case list -> 't encoding val def : string -> ?title:string -> ?description:string -> 't encoding -> 't encoding val conv : ('a -> 'b) -> ('b -> 'a) -> ?schema:json_schema -> 'b encoding -> 'a encoding val conv_with_guard : ('a -> 'b) -> ('b -> ('a, string) result) -> ?schema:json_schema -> 'b encoding -> 'a encoding val with_decoding_guard : ('a -> (unit, string) result) -> 'a encoding -> 'a encoding val mu : string -> ?title:string -> ?description:string -> ('a encoding -> 'a encoding) -> 'a encoding type 'a lazy_t val lazy_encoding : 'a encoding -> 'a lazy_t encoding val force_decode : 'a lazy_t -> 'a option val force_bytes : 'a lazy_t -> bytes val make_lazy : 'a encoding -> 'a -> 'a lazy_t val apply_lazy : fun_value:('a -> 'b) -> fun_bytes:(bytes -> 'b) -> fun_combine:('b -> 'b -> 'b) -> 'a lazy_t -> 'b module Json : sig val schema : ?definitions_path:string -> 'a encoding -> json_schema val construct : 't encoding -> 't -> json val destruct : 't encoding -> json -> 't (** JSON Error *) type path = path_item list and path_item = [ `Field of string (** A field in an object. *) | `Index of int (** An index in an array. *) | `Star (** Any / every field or index. *) | `Next (** The next element after an array. *) ] (** Exception raised by destructors, with the location in the original JSON structure and the specific error. *) exception Cannot_destruct of (path * exn) (** Unexpected kind of data encountered (w/ the expectation). *) exception Unexpected of string * string (** Some {!union} couldn't be destructed, w/ the reasons for each {!case}. *) exception No_case_matched of exn list (** Array of unexpected size encountered (w/ the expectation). *) exception Bad_array_size of int * int (** Missing field in an object. *) exception Missing_field of string (** Supernumerary field in an object. *) exception Unexpected_field of string val print_error : ?print_unknown:(Format.formatter -> exn -> unit) -> Format.formatter -> exn -> unit (** Helpers for writing encoders. *) val cannot_destruct : ('a, Format.formatter, unit, 'b) format4 -> 'a val wrap_error : ('a -> 'b) -> 'a -> 'b val pp : Format.formatter -> json -> unit end module Binary : sig val fixed_length : 'a encoding -> int option val maximum_length : 'a encoding -> int option val length : 'a encoding -> 'a -> int val to_bytes_opt : ?buffer_size:int -> 'a encoding -> 'a -> bytes option val to_bytes_exn : ?buffer_size:int -> 'a encoding -> 'a -> bytes val of_bytes_opt : 'a encoding -> bytes -> 'a option val to_string_opt : ?buffer_size:int -> 'a encoding -> 'a -> string option val to_string_exn : ?buffer_size:int -> 'a encoding -> 'a -> string val of_string_opt : 'a encoding -> string -> 'a option end (** [check_size size encoding] ensures that the binary encoding of a value will not be allowed to exceed [size] bytes. The reader and the writer fails otherwise. This function do not modify the JSON encoding. *) val check_size : int -> 'a encoding -> 'a encoding end # 30 "v3.in.ml" module Raw_hashes : sig # 1 "v3/raw_hashes.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) val blake2b : bytes -> bytes val sha256 : bytes -> bytes val sha512 : bytes -> bytes val keccak256 : bytes -> bytes val sha3_256 : bytes -> bytes val sha3_512 : bytes -> bytes end # 32 "v3.in.ml" module Compare : sig # 1 "v3/compare.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) module type COMPARABLE = sig type t val compare : t -> t -> int end module type S = sig type t val ( = ) : t -> t -> bool val ( <> ) : t -> t -> bool val ( < ) : t -> t -> bool val ( <= ) : t -> t -> bool val ( >= ) : t -> t -> bool val ( > ) : t -> t -> bool val compare : t -> t -> int val equal : t -> t -> bool val max : t -> t -> t val min : t -> t -> t end module Make (P : COMPARABLE) : S with type t := P.t module Char : S with type t = char module Bool : S with type t = bool module Int : S with type t = int module Int32 : S with type t = int32 module Uint32 : S with type t = int32 module Int64 : S with type t = int64 module Uint64 : S with type t = int64 module String : S with type t = string module Bytes : S with type t = bytes module Z : S with type t = Z.t module List (P : COMPARABLE) : S with type t = P.t list module Option (P : COMPARABLE) : S with type t = P.t option end # 34 "v3.in.ml" module Time : sig # 1 "v3/time.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type t include Compare.S with type t := t val add : t -> int64 -> t val diff : t -> t -> int64 val of_seconds : int64 -> t val to_seconds : t -> int64 val of_notation : string -> t option val of_notation_exn : string -> t val to_notation : t -> string val encoding : t Data_encoding.t val rfc_encoding : t Data_encoding.t val pp_hum : Format.formatter -> t -> unit end # 36 "v3.in.ml" module TzEndian : sig # 1 "v3/tzEndian.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2019 Nomadic Labs, <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) val get_int32 : bytes -> int -> int32 val get_int32_string : string -> int -> int32 val set_int32 : bytes -> int -> int32 -> unit val set_int8 : bytes -> int -> int -> unit val get_int8 : bytes -> int -> int val get_int8_string : string -> int -> int val set_int16 : bytes -> int -> int -> unit val get_int16 : bytes -> int -> int val get_int16_string : string -> int -> int val set_int64 : bytes -> int -> int64 -> unit val get_int64 : bytes -> int -> int64 val get_int64_string : string -> int -> int64 val get_uint8 : bytes -> int -> int val get_uint8_string : string -> int -> int val set_uint8 : bytes -> int -> int -> unit val get_uint16 : bytes -> int -> int val get_uint16_string : string -> int -> int val set_uint16 : bytes -> int -> int -> unit end # 38 "v3.in.ml" module Bits : sig # 1 "v3/bits.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Nomadic Labs. <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Assuming [x >= 0], [numbits x] is the number of bits needed to represent [x]. This is also the unique [k] such that [2^{k - 1} <= x < 2^k] if [x > 0] and [0] otherwise. *) val numbits : int -> int end # 40 "v3.in.ml" module Equality_witness : sig # 1 "v3/equality_witness.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Nomadic Labs. <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** This module provides support for type equalities and runtime type identifiers. For two types [a] and [b], [(a, b) eq] is a witness that [a = b]. This is a standard generalized algebraic datatype on top of which type-level programming techniques can be implemented. Given a type [a], an inhabitant of [a t] is a dynamic identifier for [a]. Identifiers can be compared for equality. They are also equipped with a hash function. WARNING: the hash function changes at every run. Therefore, the result of the hash function should never be stored. Notice that dynamic identifiers are not unique: two identifiers for [a] can have distinct hash and can be physically distinct. Hence, only [eq] can decide if two type identifiers correspond to the same type. *) (** A proof witness that two types are equal. *) type (_, _) eq = Refl : ('a, 'a) eq (** A dynamic representation for ['a]. *) type 'a t (** [make ()] is a dynamic representation for ['a]. A fresh identifier is returned each time [make ()] is evaluated. *) val make : unit -> 'a t (** [eq ida idb] returns a proof that [a = b] if [ida] and [idb] identify the same type. *) val eq : 'a t -> 'b t -> ('a, 'b) eq option (** [hash id] returns a hash for [id]. *) val hash : 'a t -> int end # 42 "v3.in.ml" module FallbackArray : sig # 1 "v3/fallbackArray.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** This module implements arrays equipped with accessors that cannot raise exceptions. Reading out of the bounds of the arrays return a fallback value fixed at array construction time, writing out of the bounds of the arrays is ignored. *) (** The type for array containing values of type ['a]. *) type 'a t (** [make len v] builds an array [a] initialized [len] cells with [v]. The value [v] is the fallback value for [a]. *) val make : int -> 'a -> 'a t (** [fallback a] returns the fallback value for [a]. *) val fallback : 'a t -> 'a (** [length a] returns the length of [a]. *) val length : 'a t -> int (** [get a idx] returns the contents of the cell of index [idx] in [a]. If [idx] < 0 or [idx] >= [length a], [get a idx] = [fallback a]. *) val get : 'a t -> int -> 'a (** [set a idx value] updates the cell of index [idx] with [value]. If [idx] < 0 or [idx] >= [length a], [a] is unchanged. *) val set : 'a t -> int -> 'a -> unit (** [iter f a] iterates [f] over the cells of [a] from the cell indexed [0] to the cell indexed [length a - 1]. *) val iter : ('a -> unit) -> 'a t -> unit (** [map f a] computes a new array obtained by applying [f] to each cell contents of [a]. Notice that the fallback value of the new array is [f (fallback a)]. *) val map : ('a -> 'b) -> 'a t -> 'b t (** [fold a init f] traverses [a] from the cell indexed [0] to the cell indexed [length a - 1] and transforms [accu] into [f accu x] where [x] is the content of the cell under focus. [accu] is [init] on the first iteration. *) val fold : ('b -> 'a -> 'b) -> 'a t -> 'b -> 'b end # 44 "v3.in.ml" module Error_monad : sig # 1 "v3/error_monad.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type error_category = [`Branch | `Temporary | `Permanent] (** CORE : errors *) type error = .. val error_encoding : error Data_encoding.t val pp : Format.formatter -> error -> unit (** EXT : error registration/query *) val register_error_kind : error_category -> id:string -> title:string -> description:string -> ?pp:(Format.formatter -> 'err -> unit) -> 'err Data_encoding.t -> (error -> 'err option) -> ('err -> error) -> unit val classify_error : error -> error_category val json_of_error : error -> Data_encoding.json val error_of_json : Data_encoding.json -> error type error_info = { category : error_category; id : string; title : string; description : string; schema : Data_encoding.json_schema; } val pp_info : Format.formatter -> error_info -> unit (** Retrieves information of registered errors *) val get_registered_errors : unit -> error_info list (** MONAD : trace, monad, etc. *) type 'err trace type 'a tzresult = ('a, error trace) result val make_trace_encoding : 'error Data_encoding.t -> 'error trace Data_encoding.t val trace_encoding : error trace Data_encoding.t val pp_trace : Format.formatter -> error trace -> unit val result_encoding : 'a Data_encoding.t -> 'a tzresult Data_encoding.t val ok : 'a -> ('a, 'trace) result val ok_unit : (unit, 'trace) result val ok_none : ('a option, 'trace) result val ok_some : 'a -> ('a option, 'trace) result val ok_nil : ('a list, 'trace) result val ok_true : (bool, 'trace) result val ok_false : (bool, 'trace) result val return : 'a -> ('a, 'trace) result Lwt.t val return_unit : (unit, 'trace) result Lwt.t val return_none : ('a option, 'trace) result Lwt.t val return_some : 'a -> ('a option, 'trace) result Lwt.t val return_nil : ('a list, 'trace) result Lwt.t val return_true : (bool, 'trace) result Lwt.t val return_false : (bool, 'trace) result Lwt.t val error : 'err -> ('a, 'err trace) result val trace_of_error : 'err -> 'err trace val fail : 'err -> ('a, 'err trace) result Lwt.t val ( >>= ) : 'a Lwt.t -> ('a -> 'b Lwt.t) -> 'b Lwt.t val ( >|= ) : 'a Lwt.t -> ('a -> 'b) -> 'b Lwt.t val ( >>? ) : ('a, 'trace) result -> ('a -> ('b, 'trace) result) -> ('b, 'trace) result val ( >|? ) : ('a, 'trace) result -> ('a -> 'b) -> ('b, 'trace) result val ( >>=? ) : ('a, 'trace) result Lwt.t -> ('a -> ('b, 'trace) result Lwt.t) -> ('b, 'trace) result Lwt.t val ( >|=? ) : ('a, 'trace) result Lwt.t -> ('a -> 'b) -> ('b, 'trace) result Lwt.t val ( >>?= ) : ('a, 'trace) result -> ('a -> ('b, 'trace) result Lwt.t) -> ('b, 'trace) result Lwt.t val ( >|?= ) : ('a, 'trace) result -> ('a -> 'b Lwt.t) -> ('b, 'trace) result Lwt.t val record_trace : 'err -> ('a, 'err trace) result -> ('a, 'err trace) result val trace : 'err -> ('b, 'err trace) result Lwt.t -> ('b, 'err trace) result Lwt.t val record_trace_eval : (unit -> ('err, 'err trace) result) -> ('a, 'err trace) result -> ('a, 'err trace) result val trace_eval : (unit -> ('err, 'err trace) result Lwt.t) -> ('b, 'err trace) result Lwt.t -> ('b, 'err trace) result Lwt.t val error_unless : bool -> 'err -> (unit, 'err trace) result val error_when : bool -> 'err -> (unit, 'err trace) result val fail_unless : bool -> 'err -> (unit, 'err trace) result Lwt.t val fail_when : bool -> 'err -> (unit, 'err trace) result Lwt.t val unless : bool -> (unit -> (unit, 'trace) result Lwt.t) -> (unit, 'trace) result Lwt.t val when_ : bool -> (unit -> (unit, 'trace) result Lwt.t) -> (unit, 'trace) result Lwt.t val dont_wait : (exn -> unit) -> ('trace -> unit) -> (unit -> (unit, 'trace) result Lwt.t) -> unit (** [catch f] executes [f] within a try-with block and wraps exceptions within a [tzresult]. [catch f] is equivalent to [try Ok (f ()) with e -> Error (error_of_exn e)]. If [catch_only] is set, then only exceptions [e] such that [catch_only e] is [true] are caught. Whether [catch_only] is set or not, this function never catches non-deterministic runtime exceptions of OCaml such as {!Stack_overflow} and {!Out_of_memory} nor system-exceptions such as {!Unix.Unix_error} and {!Sys_error}. *) val catch : ?catch_only:(exn -> bool) -> (unit -> 'a) -> 'a tzresult (** [catch_f f handler] is equivalent to [map_error (catch f) handler]. In other words, it catches exceptions in [f ()] and either returns the value in an [Ok] or passes the exception to [handler] for the [Error]. [catch_only] has the same use as with [catch]. The same restriction on catching non-deterministic runtime exceptions applies. *) val catch_f : ?catch_only:(exn -> bool) -> (unit -> 'a) -> (exn -> error) -> 'a tzresult (** [catch_s] is like [catch] but when [f] returns a promise. It is equivalent to {[ Lwt.try_bind f (fun v -> Lwt.return (Ok v)) (fun e -> Lwt.return (Error (error_of_exn e))) ]} If [catch_only] is set, then only exceptions [e] such that [catch_only e] is [true] are caught. Whether [catch_only] is set or not, this function never catches non-deterministic runtime exceptions of OCaml such as {!Stack_overflow} and {!Out_of_memory} nor system-exceptions such as {!Unix.Unix_error} and {!Sys_error}. *) val catch_s : ?catch_only:(exn -> bool) -> (unit -> 'a Lwt.t) -> 'a tzresult Lwt.t (* Synchronisation *) val join_e : (unit, 'err trace) result list -> (unit, 'err trace) result val all_e : ('a, 'err trace) result list -> ('a list, 'err trace) result val both_e : ('a, 'err trace) result -> ('b, 'err trace) result -> ('a * 'b, 'err trace) result (**/**) (* The protocol environment needs to know about shell's tzresult because they are used for in-protocol RPCs. Moreover, some light processing on these results is done in the protocol which requires the type to be concrete. The type is kept private because the environment is sole responsible for wrapping the protocol's errors into the shell's. *) type shell_tztrace type 'a shell_tzresult = ('a, shell_tztrace) result end # 46 "v3.in.ml" open Error_monad module Seq : sig # 1 "v3/seq.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (* From Lwtreslib *) type 'a t = unit -> 'a node and +'a node = Nil | Cons of 'a * 'a t val empty : 'a t val return : 'a -> 'a t val cons : 'a -> 'a t -> 'a t val append : 'a t -> 'a t -> 'a t val map : ('a -> 'b) -> 'a t -> 'b t val filter : ('a -> bool) -> 'a t -> 'a t val filter_map : ('a -> 'b option) -> 'a t -> 'b t val flat_map : ('a -> 'b t) -> 'a t -> 'b t val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a val iter : ('a -> unit) -> 'a t -> unit val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t (** {3 Lwtreslib-specific extensions} *) (** [first s] is [None] if [s] is empty, it is [Some x] where [x] is the first element of [s] otherwise. Note that [first] forces the first element of the sequence, which can have side-effects or be computationally expensive. Consider, e.g., the case where [s = filter (fun …) s']: [first s] can force multiple of the values from [s']. *) val first : 'a t -> 'a option (** Similar to {!fold_left} but wraps the traversal in {!result}. The traversal is interrupted if one of the step returns an [Error _]. *) val fold_left_e : ('a -> 'b -> ('a, 'trace) result) -> 'a -> 'b t -> ('a, 'trace) result (** Similar to {!fold_left} but wraps the traversing in {!Lwt}. Each step of the traversal is started after the previous one has resolved. The traversal is interrupted if one of the promise is rejected. *) val fold_left_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b t -> 'a Lwt.t (** Similar to {!fold_left} but wraps the traversing in [result Lwt.t]. Each step of the traversal is started after the previous one resolved. The traversal is interrupted if one of the step is rejected or is fulfilled with [Error _]. *) val fold_left_es : ('a -> 'b -> ('a, 'trace) result Lwt.t) -> 'a -> 'b t -> ('a, 'trace) result Lwt.t (** Similar to {!iter} but wraps the iteration in {!result}. The iteration is interrupted if one of the step returns an [Error _]. *) val iter_e : ('a -> (unit, 'trace) result) -> 'a t -> (unit, 'trace) result (** Similar to {!iter} but wraps the iteration in {!Lwt}. Each step of the iteration is started after the previous one resolved. The iteration is interrupted if one of the promise is rejected. *) val iter_s : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t (** Similar to {!iter} but wraps the iteration in [result Lwt.t]. Each step of the iteration is started after the previous one resolved. The iteration is interrupted if one of the promise is rejected of fulfilled with an [Error _]. *) val iter_es : ('a -> (unit, 'trace) result Lwt.t) -> 'a t -> (unit, 'trace) result Lwt.t (** Similar to {!iter} but wraps the iteration in [result Lwt.t]. All the steps of the iteration are started concurrently. The promise [iter_ep] resolves once all the promises of the traversal resolve. At this point it either: - is rejected if at least one of the promises is, otherwise - is fulfilled with [Error _] if at least one of the promises is, otherwise - is fulfilled with [Ok ()] if all the promises are. *) val iter_ep : ('a -> (unit, 'error Error_monad.trace) result Lwt.t) -> 'a t -> (unit, 'error Error_monad.trace) result Lwt.t (** Similar to {!iter} but wraps the iteration in {!Lwt}. All the steps of the iteration are started concurrently. The promise [iter_p f s] is resolved only once all the promises of the iteration are. At this point it is either fulfilled if all promises are, or rejected if at least one of them is. *) val iter_p : ('a -> unit Lwt.t) -> 'a t -> unit Lwt.t end # 50 "v3.in.ml" module List : sig # 1 "v3/list.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** {1 List} A replacement for {!Stdlib.List} which: - replaces the exception-raising functions by exception-safe variants, - provides Lwt-, result- and Lwt-result-aware traversors. [List] is intended to shadow both {!Stdlib.List} and {!Lwt_list}. *) (** {2 Basics} Checkout {!Lwtreslib} for an introduction to the naming and semantic convention of Lwtreslib. In a nutshell: - Stdlib functions that raise exceptions are replaced by safe variants (typically returning [option]). - The [_e] suffix is for result-aware traversors ("e" stands for "error"), [_s] and [_p] are for Lwt-aware, and [_es] and [_ep] are for Lwt-result-aware. - [_e], [_s], and [_es] traversors are {i fail-early}: they stop traversal as soon as a failure ([Error] or [Fail]) occurs; [_p] and [_ep] traversors are {i best-effort}: they only resolve once all of the intermediate promises have, even if a failure occurs. *) (** {2 Double-traversal and combine} Note that double-list traversors ([iter2], [map2], etc., and also [combine]) take an additional [when_different_lengths] parameter. This is to control the error that is returned when the two lists passed as arguments have different lengths. This mechanism is a replacement for {!Stdlib.List.iter2} (etc.) raising [Invalid_argument]. Note that, as per the fail-early behaviour mentioned above, [_e], [_s], and [_es] traversors will have already processed the common-prefix before the error is returned. Because the best-effort behaviour of [_p] and [_ep] is unsatisfying for this failure case, double parallel traversors are omitted from this library. (Specifically, it is not obvious whether nor how the [when_different_lengths] error should be composed with the other errors.) To obtain a different behaviour for sequential traversors, or to process two lists in parallel, you can use {!combine} or any of the alternatives that handles the error differently: {!combine_drop}, {!combine_with_leftovers}. Finally, the {!rev_combine} is provided to allow to avoid multiple-reversing. {3 Special considerations} Because they traverse the list from right-to-left, the {!fold_right2} function and all its variants fail with [when_different_lengths] before any of the processing starts. Whilst this is still within the fail-early behaviour, it may be surprising enough that it requires mentioning here. Because they may return early, {!for_all2} and {!exists2} and all their variants may return [Ok _] even though the arguments have different lengths. *) (** {3 Trivial values} *) type 'a t = 'a list = [] | ( :: ) of 'a * 'a list (** in-monad, preallocated nil *) (** [nil] is [[]] *) val nil : 'a list (** [nil_e] is [Ok []] *) val nil_e : ('a list, 'trace) result (** [nil_s] is [Lwt.return_nil] *) val nil_s : 'a list Lwt.t (** [nil_es] is [Lwt.return (Ok [])] *) val nil_es : ('a list, 'trace) result Lwt.t (** {3 Safe wrappers} Shadowing unsafe functions to avoid all exceptions. *) (** {4 Safe lookups, scans, retrievals} Return option rather than raise [Not_found], [Failure _], or [Invalid_argument _] *) (** [hd xs] is the head (first element) of the list or [None] if the list is empty. *) val hd : 'a list -> 'a option (** [tl xs] is the tail of the list (the whole list except the first element) or [None] if the list is empty. *) val tl : 'a list -> 'a list option (** [nth xs n] is the [n]th element of the list or [None] if the list has fewer than [n] elements. [nth xs 0 = hd xs] *) val nth : 'a list -> int -> 'a option (** [nth_opt] is an alias for [nth] provided for backwards compatibility. *) val nth_opt : 'a list -> int -> 'a option (** [last x xs] is the last element of the list [xs] or [x] if [xs] is empty. The primary intended use for [last] is after destructing a list: [match l with | None -> … | Some x :: xs -> last x xs] but it can also be used for a default value: [last default_value_if_empty xs]. *) val last : 'a -> 'a list -> 'a (** [last_opt xs] is the last element of the list [xs] or [None] if the list [xs] is empty. *) val last_opt : 'a list -> 'a option (** [find predicate xs] is the first element [x] of the list [xs] such that [predicate x] is [true] or [None] if the list [xs] has no such element. *) val find : ('a -> bool) -> 'a list -> 'a option (** [find_opt] is an alias for [find] provided for backwards compatibility. *) val find_opt : ('a -> bool) -> 'a list -> 'a option (** [mem ~equal a l] is [true] iff there is an element [e] of [l] such that [equal a e]. *) val mem : equal:('a -> 'a -> bool) -> 'a -> 'a list -> bool (** [assoc ~equal k kvs] is [Some v] such that [(k', v)] is the first pair in the list such that [equal k' k] or [None] if the list contains no such pair. *) val assoc : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> 'b option (** [assoc_opt] is an alias for [assoc] provided for backwards compatibility. *) val assoc_opt : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> 'b option (** [assq k kvs] is the same as [assoc ~equal:Stdlib.( == ) k kvs]: it uses the physical equality. *) val assq : 'a -> ('a * 'b) list -> 'b option (** [assq_opt] is an alias for [assq] provided for backwards compatibility. *) val assq_opt : 'a -> ('a * 'b) list -> 'b option (** [mem_assoc ~equal k l] is equivalent to [Option.is_some @@ assoc ~equal k l]. *) val mem_assoc : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> bool (** [mem_assq k l] is [mem_assoc ~equal:Stdlib.( == ) k l]. *) val mem_assq : 'a -> ('a * 'b) list -> bool (** [remove_assoc ~equal k l] is [l] without the first element [(k', _)] such that [equal k k']. *) val remove_assoc : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> ('a * 'b) list (** [remove_assoq k l] is [remove_assoc ~equal:Stdlib.( == ) k l]. *) val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list (** {4 Initialisation} *) (** [init ~when_negative_length n f] is [Error when_negative_length] if [n] is strictly negative and [Ok (Stdlib.List.init n f)] otherwise. *) val init : when_negative_length:'trace -> int -> (int -> 'a) -> ('a list, 'trace) result (** {4 Basic traversal} *) val length : 'a list -> int val rev : 'a list -> 'a list val concat : 'a list list -> 'a list val append : 'a list -> 'a list -> 'a list val rev_append : 'a list -> 'a list -> 'a list val flatten : 'a list list -> 'a list (** {4 Double-list traversals} These safe-wrappers take an explicit value to handle the case of lists of unequal length. *) (** [combine ~when_different_lengths l1 l2] is either - [Error when_different_lengths] if [List.length l1 <> List.length l2] - a list of pairs of elements from [l1] and [l2] E.g., [combine ~when_different_lengths [] [] = Ok []] E.g., [combine ~when_different_lengths [1; 2] ['a'; 'b'] = Ok [(1,'a'); (2, 'b')]] E.g., [combine ~when_different_lengths:() [1] [] = Error ()] Note: [combine ~when_different_lengths l1 l2] is equivalent to [try Ok (Stdlib.List.combine l1 l2) with Invalid_argument _ -> when_different_lengths] The same equivalence almost holds for the other double traversors below. The notable difference is if the functions passed as argument to the traversors raise the [Invalid_argument _] exception. *) val combine : when_different_lengths:'trace -> 'a list -> 'b list -> (('a * 'b) list, 'trace) result (** [rev_combine ~when_different_lengths xs ys] is [rev (combine ~when_different_lengths xs ys)] but more efficient. *) val rev_combine : when_different_lengths:'trace -> 'a list -> 'b list -> (('a * 'b) list, 'trace) result val split : ('a * 'b) list -> 'a list * 'b list val iter2 : when_different_lengths:'trace -> ('a -> 'b -> unit) -> 'a list -> 'b list -> (unit, 'trace) result val map2 : when_different_lengths:'trace -> ('a -> 'b -> 'c) -> 'a list -> 'b list -> ('c list, 'trace) result val rev_map2 : when_different_lengths:'trace -> ('a -> 'b -> 'c) -> 'a list -> 'b list -> ('c list, 'trace) result val fold_left2 : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> ('a, 'trace) result (** This function is not tail-recursive *) val fold_right2 : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> ('c, 'trace) result val for_all2 : when_different_lengths:'trace -> ('a -> 'b -> bool) -> 'a list -> 'b list -> (bool, 'trace) result val exists2 : when_different_lengths:'trace -> ('a -> 'b -> bool) -> 'a list -> 'b list -> (bool, 'trace) result (** {3 Monad-aware variants} The functions below are strict extensions of the standard {!Stdlib.List} module. It is for result-, lwt- and lwt-result-aware variants. The meaning of the suffix is as described above, in {!Lwtreslib}, and in {!Sigs.Seq}. *) (** {4 Initialisation variants} Note that for asynchronous variants ([_s], [_es], [_p], and [_ep]), if the length parameter is negative, then the promise is returned already fulfilled with [Error when_different_lengths]. *) val init_e : when_negative_length:'trace -> int -> (int -> ('a, 'trace) result) -> ('a list, 'trace) result val init_s : when_negative_length:'trace -> int -> (int -> 'a Lwt.t) -> ('a list, 'trace) result Lwt.t val init_es : when_negative_length:'trace -> int -> (int -> ('a, 'trace) result Lwt.t) -> ('a list, 'trace) result Lwt.t val init_p : when_negative_length:'trace -> int -> (int -> 'a Lwt.t) -> ('a list, 'trace) result Lwt.t (** {4 Query variants} *) val find_e : ('a -> (bool, 'trace) result) -> 'a list -> ('a option, 'trace) result val find_s : ('a -> bool Lwt.t) -> 'a list -> 'a option Lwt.t val find_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> ('a option, 'trace) result Lwt.t val filter : ('a -> bool) -> 'a list -> 'a list (** [rev_filter f l] is [rev (filter f l)] but more efficient. *) val rev_filter : ('a -> bool) -> 'a list -> 'a list val rev_filter_some : 'a option list -> 'a list val filter_some : 'a option list -> 'a list val rev_filter_ok : ('a, 'b) result list -> 'a list val filter_ok : ('a, 'b) result list -> 'a list val rev_filter_error : ('a, 'b) result list -> 'b list val filter_error : ('a, 'b) result list -> 'b list val rev_filter_e : ('a -> (bool, 'trace) result) -> 'a list -> ('a list, 'trace) result val filter_e : ('a -> (bool, 'trace) result) -> 'a list -> ('a list, 'trace) result val rev_filter_s : ('a -> bool Lwt.t) -> 'a list -> 'a list Lwt.t val filter_s : ('a -> bool Lwt.t) -> 'a list -> 'a list Lwt.t val rev_filter_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> ('a list, 'trace) result Lwt.t val filter_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> ('a list, 'trace) result Lwt.t val filter_p : ('a -> bool Lwt.t) -> 'a list -> 'a list Lwt.t val rev_partition : ('a -> bool) -> 'a list -> 'a list * 'a list val partition : ('a -> bool) -> 'a list -> 'a list * 'a list val rev_partition_result : ('a, 'b) result list -> 'a list * 'b list val partition_result : ('a, 'b) result list -> 'a list * 'b list val rev_partition_e : ('a -> (bool, 'trace) result) -> 'a list -> ('a list * 'a list, 'trace) result val partition_e : ('a -> (bool, 'trace) result) -> 'a list -> ('a list * 'a list, 'trace) result val rev_partition_s : ('a -> bool Lwt.t) -> 'a list -> ('a list * 'a list) Lwt.t val partition_s : ('a -> bool Lwt.t) -> 'a list -> ('a list * 'a list) Lwt.t val rev_partition_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> ('a list * 'a list, 'trace) result Lwt.t val partition_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> ('a list * 'a list, 'trace) result Lwt.t val partition_p : ('a -> bool Lwt.t) -> 'a list -> ('a list * 'a list) Lwt.t (** {4 Traversal variants} *) val iter : ('a -> unit) -> 'a list -> unit val iter_e : ('a -> (unit, 'trace) result) -> 'a list -> (unit, 'trace) result val iter_s : ('a -> unit Lwt.t) -> 'a list -> unit Lwt.t val iter_es : ('a -> (unit, 'trace) result Lwt.t) -> 'a list -> (unit, 'trace) result Lwt.t val iter_p : ('a -> unit Lwt.t) -> 'a list -> unit Lwt.t val iteri : (int -> 'a -> unit) -> 'a list -> unit val iteri_e : (int -> 'a -> (unit, 'trace) result) -> 'a list -> (unit, 'trace) result val iteri_s : (int -> 'a -> unit Lwt.t) -> 'a list -> unit Lwt.t val iteri_es : (int -> 'a -> (unit, 'trace) result Lwt.t) -> 'a list -> (unit, 'trace) result Lwt.t val iteri_p : (int -> 'a -> unit Lwt.t) -> 'a list -> unit Lwt.t val map : ('a -> 'b) -> 'a list -> 'b list val map_e : ('a -> ('b, 'trace) result) -> 'a list -> ('b list, 'trace) result val map_s : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val map_es : ('a -> ('b, 'trace) result Lwt.t) -> 'a list -> ('b list, 'trace) result Lwt.t val map_p : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list val mapi_e : (int -> 'a -> ('b, 'trace) result) -> 'a list -> ('b list, 'trace) result val mapi_s : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val mapi_es : (int -> 'a -> ('b, 'trace) result Lwt.t) -> 'a list -> ('b list, 'trace) result Lwt.t val mapi_p : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val rev_map : ('a -> 'b) -> 'a list -> 'b list val rev_mapi : (int -> 'a -> 'b) -> 'a list -> 'b list val rev_map_e : ('a -> ('b, 'trace) result) -> 'a list -> ('b list, 'trace) result val rev_map_s : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val rev_map_es : ('a -> ('b, 'trace) result Lwt.t) -> 'a list -> ('b list, 'trace) result Lwt.t val rev_map_p : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val rev_mapi_e : (int -> 'a -> ('b, 'trace) result) -> 'a list -> ('b list, 'trace) result val rev_mapi_s : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val rev_mapi_es : (int -> 'a -> ('b, 'trace) result Lwt.t) -> 'a list -> ('b list, 'trace) result Lwt.t val rev_mapi_p : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t val rev_filter_map : ('a -> 'b option) -> 'a list -> 'b list val rev_filter_map_e : ('a -> ('b option, 'trace) result) -> 'a list -> ('b list, 'trace) result val filter_map_e : ('a -> ('b option, 'trace) result) -> 'a list -> ('b list, 'trace) result val rev_filter_map_s : ('a -> 'b option Lwt.t) -> 'a list -> 'b list Lwt.t val filter_map : ('a -> 'b option) -> 'a list -> 'b list val filter_map_s : ('a -> 'b option Lwt.t) -> 'a list -> 'b list Lwt.t val rev_filter_map_es : ('a -> ('b option, 'trace) result Lwt.t) -> 'a list -> ('b list, 'trace) result Lwt.t val filter_map_es : ('a -> ('b option, 'trace) result Lwt.t) -> 'a list -> ('b list, 'trace) result Lwt.t val filter_map_p : ('a -> 'b option Lwt.t) -> 'a list -> 'b list Lwt.t val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a val fold_left_e : ('a -> 'b -> ('a, 'trace) result) -> 'a -> 'b list -> ('a, 'trace) result val fold_left_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b list -> 'a Lwt.t val fold_left_es : ('a -> 'b -> ('a, 'trace) result Lwt.t) -> 'a -> 'b list -> ('a, 'trace) result Lwt.t (** This function is not tail-recursive *) val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b (** This function is not tail-recursive *) val fold_right_e : ('a -> 'b -> ('b, 'trace) result) -> 'a list -> 'b -> ('b, 'trace) result (** This function is not tail-recursive *) val fold_right_s : ('a -> 'b -> 'b Lwt.t) -> 'a list -> 'b -> 'b Lwt.t (** This function is not tail-recursive *) val fold_right_es : ('a -> 'b -> ('b, 'trace) result Lwt.t) -> 'a list -> 'b -> ('b, 'trace) result Lwt.t (** {4 Double-traversal variants} As mentioned above, there are no [_p] and [_ep] double-traversors. Use {!combine} (and variants) to circumvent this. *) val iter2_e : when_different_lengths:'trace -> ('a -> 'b -> (unit, 'trace) result) -> 'a list -> 'b list -> (unit, 'trace) result val iter2_s : when_different_lengths:'trace -> ('a -> 'b -> unit Lwt.t) -> 'a list -> 'b list -> (unit, 'trace) result Lwt.t val iter2_es : when_different_lengths:'trace -> ('a -> 'b -> (unit, 'trace) result Lwt.t) -> 'a list -> 'b list -> (unit, 'trace) result Lwt.t val map2_e : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) result) -> 'a list -> 'b list -> ('c list, 'trace) result val map2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) result Lwt.t val map2_es : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) result Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) result Lwt.t val rev_map2_e : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) result) -> 'a list -> 'b list -> ('c list, 'trace) result val rev_map2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) result Lwt.t val rev_map2_es : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) result Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) result Lwt.t val fold_left2_e : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('a, 'trace) result) -> 'a -> 'b list -> 'c list -> ('a, 'trace) result val fold_left2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'a Lwt.t) -> 'a -> 'b list -> 'c list -> ('a, 'trace) result Lwt.t val fold_left2_es : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('a, 'trace) result Lwt.t) -> 'a -> 'b list -> 'c list -> ('a, 'trace) result Lwt.t (** This function is not tail-recursive *) val fold_right2_e : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('c, 'trace) result) -> 'a list -> 'b list -> 'c -> ('c, 'trace) result (** This function is not tail-recursive *) val fold_right2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'c Lwt.t) -> 'a list -> 'b list -> 'c -> ('c, 'trace) result Lwt.t (** This function is not tail-recursive *) val fold_right2_es : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('c, 'trace) result Lwt.t) -> 'a list -> 'b list -> 'c -> ('c, 'trace) result Lwt.t (** {4 Scanning variants} *) val for_all : ('a -> bool) -> 'a list -> bool val for_all_e : ('a -> (bool, 'trace) result) -> 'a list -> (bool, 'trace) result val for_all_s : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t val for_all_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> (bool, 'trace) result Lwt.t val for_all_p : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t val exists : ('a -> bool) -> 'a list -> bool val exists_e : ('a -> (bool, 'trace) result) -> 'a list -> (bool, 'trace) result val exists_s : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t val exists_es : ('a -> (bool, 'trace) result Lwt.t) -> 'a list -> (bool, 'trace) result Lwt.t val exists_p : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t (** {4 Double-scanning variants} As mentioned above, there are no [_p] and [_ep] double-scanners. Use {!combine} (and variants) to circumvent this. *) val for_all2_e : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) result) -> 'a list -> 'b list -> (bool, 'trace) result val for_all2_s : when_different_lengths:'trace -> ('a -> 'b -> bool Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) result Lwt.t val for_all2_es : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) result Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) result Lwt.t val exists2_e : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) result) -> 'a list -> 'b list -> (bool, 'trace) result val exists2_s : when_different_lengths:'trace -> ('a -> 'b -> bool Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) result Lwt.t val exists2_es : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) result Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) result Lwt.t (** {3 Combine variants} These are primarily intended to be used for preprocessing before applying a traversor to the resulting list of pairs. They give alternatives to the [when_different_lengths] mechanism of the immediate double-traversors above. In case the semantic of, say, [map2_es] was unsatisfying, one can use [map_es] on a [combine]-preprocessed pair of lists. The different variants of [combine] give different approaches to different-length handling. *) (** [combine_drop ll lr] is a list [l] of pairs of elements taken from the common-length prefix of [ll] and [lr]. The suffix of whichever list is longer (if any) is dropped. More formally [nth l n] is: - [None] if [n >= min (length ll) (length lr)] - [Some (Option.get @@ nth ll n, Option.get @@ nth lr n)] otherwise *) val combine_drop : 'a list -> 'b list -> ('a * 'b) list (** A type like [result] but which is symmetric *) type ('a, 'b) left_or_right_list = [`Left of 'a list | `Right of 'b list] (** [combine_with_leftovers ll lr] is a tuple [(combined, leftover)] where [combined] is [combine_drop ll lr] and [leftover] is either [`Left lsuffix] or [`Right rsuffix] depending on which of [ll] or [lr] is longer. [leftover] is [None] if the two lists have the same length. *) val combine_with_leftovers : 'a list -> 'b list -> ('a * 'b) list * ('a, 'b) left_or_right_list option (** {3 compare / equal} *) val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int val compare_lengths : 'a list -> 'a list -> int val compare_length_with : 'a list -> int -> int val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool (** {3 Sorting} *) val sort : ('a -> 'a -> int) -> 'a list -> 'a list val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list (** {3 conversion} *) val to_seq : 'a t -> 'a Seq.t val of_seq : 'a Seq.t -> 'a list val init_ep : when_negative_length:'error -> int -> (int -> ('a, 'error Error_monad.trace) result Lwt.t) -> ('a list, 'error Error_monad.trace) result Lwt.t val filter_ep : ('a -> (bool, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('a list, 'error Error_monad.trace) result Lwt.t val partition_ep : ('a -> (bool, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('a list * 'a list, 'error Error_monad.trace) result Lwt.t val iter_ep : ('a -> (unit, 'error Error_monad.trace) result Lwt.t) -> 'a list -> (unit, 'error Error_monad.trace) result Lwt.t val iteri_ep : (int -> 'a -> (unit, 'error Error_monad.trace) result Lwt.t) -> 'a list -> (unit, 'error Error_monad.trace) result Lwt.t val map_ep : ('a -> ('b, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('b list, 'error Error_monad.trace) result Lwt.t val mapi_ep : (int -> 'a -> ('b, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('b list, 'error Error_monad.trace) result Lwt.t val rev_map_ep : ('a -> ('b, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('b list, 'error Error_monad.trace) result Lwt.t val rev_mapi_ep : (int -> 'a -> ('b, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('b list, 'error Error_monad.trace) result Lwt.t val filter_map_ep : ('a -> ('b option, 'error Error_monad.trace) result Lwt.t) -> 'a list -> ('b list, 'error Error_monad.trace) result Lwt.t val for_all_ep : ('a -> (bool, 'error Error_monad.trace) result Lwt.t) -> 'a list -> (bool, 'error Error_monad.trace) result Lwt.t val exists_ep : ('a -> (bool, 'error Error_monad.trace) result Lwt.t) -> 'a list -> (bool, 'error Error_monad.trace) result Lwt.t end # 52 "v3.in.ml" module Set : sig # 1 "v3/set.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (* From Lwtreslib *) module type S = sig type elt type t val empty : t val is_empty : t -> bool val mem : elt -> t -> bool val add : elt -> t -> t val singleton : elt -> t val remove : elt -> t -> t val union : t -> t -> t val inter : t -> t -> t val disjoint : t -> t -> bool val diff : t -> t -> t val compare : t -> t -> int val equal : t -> t -> bool val subset : t -> t -> bool val iter : (elt -> unit) -> t -> unit val iter_e : (elt -> (unit, 'trace) result) -> t -> (unit, 'trace) result val iter_s : (elt -> unit Lwt.t) -> t -> unit Lwt.t val iter_p : (elt -> unit Lwt.t) -> t -> unit Lwt.t val iter_es : (elt -> (unit, 'trace) result Lwt.t) -> t -> (unit, 'trace) result Lwt.t val map : (elt -> elt) -> t -> t val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a val fold_e : (elt -> 'a -> ('a, 'trace) result) -> t -> 'a -> ('a, 'trace) result val fold_s : (elt -> 'a -> 'a Lwt.t) -> t -> 'a -> 'a Lwt.t val fold_es : (elt -> 'a -> ('a, 'trace) result Lwt.t) -> t -> 'a -> ('a, 'trace) result Lwt.t val for_all : (elt -> bool) -> t -> bool val exists : (elt -> bool) -> t -> bool val filter : (elt -> bool) -> t -> t val partition : (elt -> bool) -> t -> t * t val cardinal : t -> int val elements : t -> elt list val min_elt : t -> elt option val max_elt : t -> elt option val choose : t -> elt option val split : elt -> t -> t * bool * t val find : elt -> t -> elt option val find_first : (elt -> bool) -> t -> elt option val find_last : (elt -> bool) -> t -> elt option val of_list : elt list -> t val to_seq_from : elt -> t -> elt Seq.t val to_seq : t -> elt Seq.t val add_seq : elt Seq.t -> t -> t val of_seq : elt Seq.t -> t val iter_ep : (elt -> (unit, 'error Error_monad.trace) result Lwt.t) -> t -> (unit, 'error Error_monad.trace) result Lwt.t end module Make (Ord : Compare.COMPARABLE) : S with type elt = Ord.t end # 54 "v3.in.ml" module Map : sig # 1 "v3/map.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (* From Lwtreslib *) module type S = sig type key type +!'a t val empty : 'a t val is_empty : 'a t -> bool val mem : key -> 'a t -> bool val add : key -> 'a -> 'a t -> 'a t val update : key -> ('a option -> 'a option) -> 'a t -> 'a t val singleton : key -> 'a -> 'a t val remove : key -> 'a t -> 'a t val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool val iter : (key -> 'a -> unit) -> 'a t -> unit (** [iter_e f m] applies [f] to the bindings of [m] one by one in an unspecified order. If all the applications result in [Ok ()], then the result of the iteration is [Ok ()]. If any of the applications results in [Error e] then the iteration stops and the result of the iteration is [Error e]. *) val iter_e : (key -> 'a -> (unit, 'trace) result) -> 'a t -> (unit, 'trace) result val iter_s : (key -> 'a -> unit Lwt.t) -> 'a t -> unit Lwt.t val iter_p : (key -> 'a -> unit Lwt.t) -> 'a t -> unit Lwt.t (** [iter_es f m] applies [f] to the bindings of [m] in an unspecified order, one after the other as the promises resolve. If all the applications result in [Ok ()], then the result of the iteration is [Ok ()]. If any of the applications results in [Error e] then the iteration stops and the result of the iteration is [Error e]. *) val iter_es : (key -> 'a -> (unit, 'trace) result Lwt.t) -> 'a t -> (unit, 'trace) result Lwt.t val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b (** [fold_e f m init] is [f k1 d1 init >>? fun acc -> f k2 d2 acc >>? fun acc -> …] where [kN] is the key bound to [dN] in [m]. *) val fold_e : (key -> 'a -> 'b -> ('b, 'trace) result) -> 'a t -> 'b -> ('b, 'trace) result val fold_s : (key -> 'a -> 'b -> 'b Lwt.t) -> 'a t -> 'b -> 'b Lwt.t (** [fold_es f m init] is [f k1 d1 init >>=? fun acc -> f k2 d2 acc >>=? fun acc -> …] where [kN] is the key bound to [dN] in [m]. *) val fold_es : (key -> 'a -> 'b -> ('b, 'trace) result Lwt.t) -> 'a t -> 'b -> ('b, 'trace) result Lwt.t val for_all : (key -> 'a -> bool) -> 'a t -> bool val exists : (key -> 'a -> bool) -> 'a t -> bool val filter : (key -> 'a -> bool) -> 'a t -> 'a t val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t val cardinal : 'a t -> int val bindings : 'a t -> (key * 'a) list val min_binding : 'a t -> (key * 'a) option val max_binding : 'a t -> (key * 'a) option val choose : 'a t -> (key * 'a) option val split : key -> 'a t -> 'a t * 'a option * 'a t val find : key -> 'a t -> 'a option val find_first : (key -> bool) -> 'a t -> (key * 'a) option val find_last : (key -> bool) -> 'a t -> (key * 'a) option val map : ('a -> 'b) -> 'a t -> 'b t val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t val to_seq : 'a t -> (key * 'a) Seq.t val to_seq_from : key -> 'a t -> (key * 'a) Seq.t val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t val of_seq : (key * 'a) Seq.t -> 'a t val iter_ep : (key -> 'a -> (unit, 'error Error_monad.trace) result Lwt.t) -> 'a t -> (unit, 'error Error_monad.trace) result Lwt.t end module Make (Ord : Compare.COMPARABLE) : S with type key = Ord.t end # 56 "v3.in.ml" module Option : sig # 1 "v3/option.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Signature from Lwtreslib's option module *) type 'a t = 'a option = None | Some of 'a val none : 'a option val none_e : ('a option, 'trace) result val none_s : 'a option Lwt.t val none_es : ('a option, 'trace) result Lwt.t val some : 'a -> 'a option val some_unit : unit option val some_nil : 'a list option val some_e : 'a -> ('a option, 'trace) result val some_s : 'a -> 'a option Lwt.t val some_es : 'a -> ('a option, 'trace) result Lwt.t val value : 'a option -> default:'a -> 'a val value_e : 'a option -> error:'trace -> ('a, 'trace) result val value_f : 'a option -> default:(unit -> 'a) -> 'a val value_fe : 'a option -> error:(unit -> 'trace) -> ('a, 'trace) result val bind : 'a option -> ('a -> 'b option) -> 'b option val join : 'a option option -> 'a option val either : 'a option -> 'a option -> 'a option val map : ('a -> 'b) -> 'a option -> 'b option val map_s : ('a -> 'b Lwt.t) -> 'a option -> 'b option Lwt.t val map_e : ('a -> ('b, 'trace) result) -> 'a option -> ('b option, 'trace) result val map_es : ('a -> ('b, 'trace) result Lwt.t) -> 'a option -> ('b option, 'trace) result Lwt.t val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a val fold_s : none:'a -> some:('b -> 'a Lwt.t) -> 'b option -> 'a Lwt.t val fold_f : none:(unit -> 'a) -> some:('b -> 'a) -> 'b option -> 'a val iter : ('a -> unit) -> 'a option -> unit val iter_s : ('a -> unit Lwt.t) -> 'a option -> unit Lwt.t val iter_e : ('a -> (unit, 'trace) result) -> 'a option -> (unit, 'trace) result val iter_es : ('a -> (unit, 'trace) result Lwt.t) -> 'a option -> (unit, 'trace) result Lwt.t val is_none : 'a option -> bool val is_some : 'a option -> bool val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int val to_result : none:'trace -> 'a option -> ('a, 'trace) result val of_result : ('a, 'e) result -> 'a option val to_list : 'a option -> 'a list val to_seq : 'a option -> 'a Seq.t (** [catch f] is [Some (f ())] if [f] does not raise an exception, it is [None] otherwise. You should only use [catch] when you truly do not care about what exception may be raised during the evaluation of [f ()]. If you need to inspect the raised exception, or if you need to pass it along, consider {!Result.catch} instead. If [catch_only] is set, then only exceptions [e] such that [catch_only e] is [true] are caught. Whether [catch_only] is set or not, you cannot catch non-deterministic runtime exceptions of OCaml such as {!Stack_overflow} and {!Out_of_memory} nor system exceptions such as {!Unix.Unix_error}. *) val catch : ?catch_only:(exn -> bool) -> (unit -> 'a) -> 'a option (** [catch_s f] is a promise that resolves to [Some x] if and when [f ()] resolves to [x]. Alternatively, it resolves to [None] if and when [f ()] is rejected. You should only use [catch_s] when you truly do not care about what exception may be raised during the evaluation of [f ()]. If you need to inspect the raised exception, or if you need to pass it along, consider {!Result.catch_s} instead. If [catch_only] is set, then only exceptions [e] such that [catch_only e] is [true] are caught. Whether [catch_only] is set or not, you cannot catch non-deterministic runtime exceptions of OCaml such as {!Stack_overflow} and {!Out_of_memory} nor system exceptions such as {!Unix.Unix_error}. *) val catch_s : ?catch_only:(exn -> bool) -> (unit -> 'a Lwt.t) -> 'a option Lwt.t end # 58 "v3.in.ml" module Result : sig # 1 "v3/result.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type ('a, 'e) t = ('a, 'e) result = Ok of 'a | Error of 'e (***) val ok : 'a -> ('a, 'e) result val ok_s : 'a -> ('a, 'e) result Lwt.t val error : 'e -> ('a, 'e) result val error_s : 'e -> ('a, 'e) result Lwt.t val value : ('a, 'e) result -> default:'a -> 'a val value_f : ('a, 'e) result -> default:(unit -> 'a) -> 'a val bind : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result val bind_s : ('a, 'e) result -> ('a -> ('b, 'e) result Lwt.t) -> ('b, 'e) result Lwt.t val bind_error : ('a, 'e) result -> ('e -> ('a, 'f) result) -> ('a, 'f) result val bind_error_s : ('a, 'e) result -> ('e -> ('a, 'f) result Lwt.t) -> ('a, 'f) result Lwt.t val join : (('a, 'e) result, 'e) result -> ('a, 'e) result val map : ('a -> 'b) -> ('a, 'e) result -> ('b, 'e) result (* NOTE: [map_e] is [bind] *) val map_e : ('a -> ('b, 'e) result) -> ('a, 'e) result -> ('b, 'e) result val map_s : ('a -> 'b Lwt.t) -> ('a, 'e) result -> ('b, 'e) result Lwt.t (* NOTE: [map_es] is [bind_s] *) val map_es : ('a -> ('b, 'e) result Lwt.t) -> ('a, 'e) result -> ('b, 'e) result Lwt.t val map_error : ('e -> 'f) -> ('a, 'e) result -> ('a, 'f) result (* NOTE: [map_error_e] is [bind_error] *) val map_error_e : ('e -> ('a, 'f) result) -> ('a, 'e) result -> ('a, 'f) result val map_error_s : ('e -> 'f Lwt.t) -> ('a, 'e) result -> ('a, 'f) result Lwt.t (* NOTE: [map_error_es] is [bind_error_s] *) val map_error_es : ('e -> ('a, 'f) result Lwt.t) -> ('a, 'e) result -> ('a, 'f) result Lwt.t val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'c val iter : ('a -> unit) -> ('a, 'e) result -> unit val iter_s : ('a -> unit Lwt.t) -> ('a, 'e) result -> unit Lwt.t val iter_error : ('e -> unit) -> ('a, 'e) result -> unit val iter_error_s : ('e -> unit Lwt.t) -> ('a, 'e) result -> unit Lwt.t val is_ok : ('a, 'e) result -> bool val is_error : ('a, 'e) result -> bool val equal : ok:('a -> 'a -> bool) -> error:('e -> 'e -> bool) -> ('a, 'e) result -> ('a, 'e) result -> bool val compare : ok:('a -> 'a -> int) -> error:('e -> 'e -> int) -> ('a, 'e) result -> ('a, 'e) result -> int val to_option : ('a, 'e) result -> 'a option val of_option : error:'e -> 'a option -> ('a, 'e) result val to_list : ('a, 'e) result -> 'a list val to_seq : ('a, 'e) result -> 'a Seq.t (** [catch f] is [try Ok (f ()) with e -> Error e]: it is [Ok x] if [f ()] evaluates to [x], and it is [Error e] if [f ()] raises [e]. See {!WithExceptions.S.Result.to_exn} for a converse function. If [catch_only] is set, then only exceptions [e] such that [catch_only e] is [true] are caught. Whether [catch_only] is set or not, you cannot catch non-deterministic runtime exceptions of OCaml such as {!Stack_overflow} and {!Out_of_memory} nor system exceptions such as {!Unix.Unix_error}. *) val catch : ?catch_only:(exn -> bool) -> (unit -> 'a) -> ('a, exn) result (** [catch_f f handler] is equivalent to [map_error (catch f) handler]. In other words, it catches exceptions in [f ()] and either returns the value in an [Ok] or passes the exception to [handler] for the [Error]. [catch_only] has the same use as with [catch]. The same restriction on catching non-deterministic runtime exceptions applies. *) val catch_f : ?catch_only:(exn -> bool) -> (unit -> 'a) -> (exn -> 'error) -> ('a, 'error) result (** [catch_s] is [catch] but for Lwt promises. Specifically, [catch_s f] returns a promise that resolves to [Ok x] if and when [f ()] resolves to [x], or to [Error exc] if and when [f ()] is rejected with [exc]. If [catch_only] is set, then only exceptions [e] such that [catch_only e] is [true] are caught. Whether [catch_only] is set or not, you cannot catch non-deterministic runtime exceptions of OCaml such as {!Stack_overflow} and {!Out_of_memory} nor system exceptions such as {!Unix.Unix_error}. *) val catch_s : ?catch_only:(exn -> bool) -> (unit -> 'a Lwt.t) -> ('a, exn) result Lwt.t end # 60 "v3.in.ml" module RPC_arg : sig # 1 "v3/RPC_arg.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type 'a t type 'a arg = 'a t val make : ?descr:string -> name:string -> destruct:(string -> ('a, string) result) -> construct:('a -> string) -> unit -> 'a arg type descr = {name : string; descr : string option} val descr : 'a arg -> descr val bool : bool arg val int : int arg val int32 : int32 arg val int64 : int64 arg val string : string arg val like : 'a arg -> ?descr:string -> string -> 'a arg type ('a, 'b) eq = Eq : ('a, 'a) eq val eq : 'a arg -> 'b arg -> ('a, 'b) eq option end # 62 "v3.in.ml" module RPC_path : sig # 1 "v3/RPC_path.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type ('prefix, 'params) t type ('prefix, 'params) path = ('prefix, 'params) t type 'prefix context = ('prefix, 'prefix) path val root : unit context val open_root : 'a context val add_suffix : ('prefix, 'params) path -> string -> ('prefix, 'params) path val ( / ) : ('prefix, 'params) path -> string -> ('prefix, 'params) path val add_arg : ('prefix, 'params) path -> 'a RPC_arg.t -> ('prefix, 'params * 'a) path val ( /: ) : ('prefix, 'params) path -> 'a RPC_arg.t -> ('prefix, 'params * 'a) path val add_final_args : ('prefix, 'params) path -> 'a RPC_arg.t -> ('prefix, 'params * 'a list) path val ( /:* ) : ('prefix, 'params) path -> 'a RPC_arg.t -> ('prefix, 'params * 'a list) path end # 64 "v3.in.ml" module RPC_query : sig # 1 "v3/RPC_query.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type 'a t type 'a query = 'a t val empty : unit query type ('a, 'b) field val field : ?descr:string -> string -> 'a RPC_arg.t -> 'a -> ('b -> 'a) -> ('b, 'a) field val opt_field : ?descr:string -> string -> 'a RPC_arg.t -> ('b -> 'a option) -> ('b, 'a option) field val flag : ?descr:string -> string -> ('b -> bool) -> ('b, bool) field val multi_field : ?descr:string -> string -> 'a RPC_arg.t -> ('b -> 'a list) -> ('b, 'a list) field type ('a, 'b, 'c) open_query val query : 'b -> ('a, 'b, 'b) open_query val ( |+ ) : ('a, 'b, 'c -> 'd) open_query -> ('a, 'c) field -> ('a, 'b, 'd) open_query val seal : ('a, 'b, 'a) open_query -> 'a t type untyped = (string * string) list exception Invalid of string val parse : 'a query -> untyped -> 'a end # 66 "v3.in.ml" module RPC_service : sig # 1 "v3/RPC_service.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** HTTP methods. *) type meth = [`GET | `POST | `DELETE | `PUT | `PATCH] type (+'meth, 'prefix, 'params, 'query, 'input, 'output) t constraint 'meth = [< meth] type (+'meth, 'prefix, 'params, 'query, 'input, 'output) service = ('meth, 'prefix, 'params, 'query, 'input, 'output) t val get_service : ?description:string -> query:'query RPC_query.t -> output:'output Data_encoding.t -> ('prefix, 'params) RPC_path.t -> ([`GET], 'prefix, 'params, 'query, unit, 'output) service val post_service : ?description:string -> query:'query RPC_query.t -> input:'input Data_encoding.t -> output:'output Data_encoding.t -> ('prefix, 'params) RPC_path.t -> ([`POST], 'prefix, 'params, 'query, 'input, 'output) service val delete_service : ?description:string -> query:'query RPC_query.t -> output:'output Data_encoding.t -> ('prefix, 'params) RPC_path.t -> ([`DELETE], 'prefix, 'params, 'query, unit, 'output) service val patch_service : ?description:string -> query:'query RPC_query.t -> input:'input Data_encoding.t -> output:'output Data_encoding.t -> ('prefix, 'params) RPC_path.t -> ([`PATCH], 'prefix, 'params, 'query, 'input, 'output) service val put_service : ?description:string -> query:'query RPC_query.t -> input:'input Data_encoding.t -> output:'output Data_encoding.t -> ('prefix, 'params) RPC_path.t -> ([`PUT], 'prefix, 'params, 'query, 'input, 'output) service end # 68 "v3.in.ml" module RPC_answer : sig # 1 "v3/RPC_answer.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Return type for service handler *) type 'o t = [ `Ok of 'o (* 200 *) | `OkChunk of 'o (* 200 but send answer as chunked transfer encoding *) | `OkStream of 'o stream (* 200 *) | `Created of string option (* 201 *) | `No_content (* 204 *) | `Unauthorized of error list option (* 401 *) | `Forbidden of error list option (* 403 *) | `Not_found of error list option (* 404 *) | `Conflict of error list option (* 409 *) | `Error of error list option (* 500 *) ] and 'a stream = {next : unit -> 'a option Lwt.t; shutdown : unit -> unit} val return : 'o -> 'o t Lwt.t (** [return_chunked] is identical to [return] but it indicates to the server that the result might be long and that the serialisation should be done in mutliple chunks. You should use [return_chunked] when returning an (unbounded or potentially large) list, array, map, or other such set. *) val return_chunked : 'o -> 'o t Lwt.t val return_stream : 'o stream -> 'o t Lwt.t val not_found : 'o t Lwt.t val fail : error list -> 'a t Lwt.t end # 70 "v3.in.ml" module RPC_directory : sig # 1 "v3/RPC_directory.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Dispatch tree *) type 'prefix t type 'prefix directory = 'prefix t (** Empty list of dispatch trees *) val empty : 'prefix directory val map : ('a -> 'b Lwt.t) -> 'b directory -> 'a directory val prefix : ('pr, 'p) RPC_path.path -> 'p directory -> 'pr directory val merge : 'a directory -> 'a directory -> 'a directory (** Possible error while registering services. *) type step = | Static of string | Dynamic of RPC_arg.descr | DynamicTail of RPC_arg.descr type conflict = | CService of RPC_service.meth | CDir | CBuilder | CTail | CTypes of RPC_arg.descr * RPC_arg.descr | CType of RPC_arg.descr * string list exception Conflict of step list * conflict (** Registering handler in service tree. The [chunked] parameter controls whether the answer to the RPC is chunk encoded (i.e., the serialisation is split and the caller receives the answer in multiple chunks) or not. Defaults to [false]. Set to [true] for RPCs that return potentially large collections (e.g., unbounded lists). *) val register : chunked:bool -> 'prefix directory -> ('meth, 'prefix, 'params, 'query, 'input, 'output) RPC_service.t -> ('params -> 'query -> 'input -> 'output tzresult Lwt.t) -> 'prefix directory val opt_register : chunked:bool -> 'prefix directory -> ('meth, 'prefix, 'params, 'query, 'input, 'output) RPC_service.t -> ('params -> 'query -> 'input -> 'output option tzresult Lwt.t) -> 'prefix directory val gen_register : 'prefix directory -> ('meth, 'prefix, 'params, 'query, 'input, 'output) RPC_service.t -> ('params -> 'query -> 'input -> [< 'output RPC_answer.t] Lwt.t) -> 'prefix directory val lwt_register : chunked:bool -> 'prefix directory -> ('meth, 'prefix, 'params, 'query, 'input, 'output) RPC_service.t -> ('params -> 'query -> 'input -> 'output Lwt.t) -> 'prefix directory (** Registering handler in service tree. Curryfied variant. *) val register0 : chunked:bool -> unit directory -> ('m, unit, unit, 'q, 'i, 'o) RPC_service.t -> ('q -> 'i -> 'o tzresult Lwt.t) -> unit directory val register1 : chunked:bool -> 'prefix directory -> ('m, 'prefix, unit * 'a, 'q, 'i, 'o) RPC_service.t -> ('a -> 'q -> 'i -> 'o tzresult Lwt.t) -> 'prefix directory val register2 : chunked:bool -> 'prefix directory -> ('m, 'prefix, (unit * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'q -> 'i -> 'o tzresult Lwt.t) -> 'prefix directory val register3 : chunked:bool -> 'prefix directory -> ('m, 'prefix, ((unit * 'a) * 'b) * 'c, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'q -> 'i -> 'o tzresult Lwt.t) -> 'prefix directory val register4 : chunked:bool -> 'prefix directory -> ('m, 'prefix, (((unit * 'a) * 'b) * 'c) * 'd, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'q -> 'i -> 'o tzresult Lwt.t) -> 'prefix directory val register5 : chunked:bool -> 'prefix directory -> ('m, 'prefix, ((((unit * 'a) * 'b) * 'c) * 'd) * 'e, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'e -> 'q -> 'i -> 'o tzresult Lwt.t) -> 'prefix directory val opt_register0 : chunked:bool -> unit directory -> ('m, unit, unit, 'q, 'i, 'o) RPC_service.t -> ('q -> 'i -> 'o option tzresult Lwt.t) -> unit directory val opt_register1 : chunked:bool -> 'prefix directory -> ('m, 'prefix, unit * 'a, 'q, 'i, 'o) RPC_service.t -> ('a -> 'q -> 'i -> 'o option tzresult Lwt.t) -> 'prefix directory val opt_register2 : chunked:bool -> 'prefix directory -> ('m, 'prefix, (unit * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'q -> 'i -> 'o option tzresult Lwt.t) -> 'prefix directory val opt_register3 : chunked:bool -> 'prefix directory -> ('m, 'prefix, ((unit * 'a) * 'b) * 'c, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'q -> 'i -> 'o option tzresult Lwt.t) -> 'prefix directory val opt_register4 : chunked:bool -> 'prefix directory -> ('m, 'prefix, (((unit * 'a) * 'b) * 'c) * 'd, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'q -> 'i -> 'o option tzresult Lwt.t) -> 'prefix directory val opt_register5 : chunked:bool -> 'prefix directory -> ('m, 'prefix, ((((unit * 'a) * 'b) * 'c) * 'd) * 'e, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'e -> 'q -> 'i -> 'o option tzresult Lwt.t) -> 'prefix directory val gen_register0 : unit directory -> ('m, unit, unit, 'q, 'i, 'o) RPC_service.t -> ('q -> 'i -> [< 'o RPC_answer.t] Lwt.t) -> unit directory val gen_register1 : 'prefix directory -> ('m, 'prefix, unit * 'a, 'q, 'i, 'o) RPC_service.t -> ('a -> 'q -> 'i -> [< 'o RPC_answer.t] Lwt.t) -> 'prefix directory val gen_register2 : 'prefix directory -> ('m, 'prefix, (unit * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'q -> 'i -> [< 'o RPC_answer.t] Lwt.t) -> 'prefix directory val gen_register3 : 'prefix directory -> ('m, 'prefix, ((unit * 'a) * 'b) * 'c, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'q -> 'i -> [< 'o RPC_answer.t] Lwt.t) -> 'prefix directory val gen_register4 : 'prefix directory -> ('m, 'prefix, (((unit * 'a) * 'b) * 'c) * 'd, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'q -> 'i -> [< 'o RPC_answer.t] Lwt.t) -> 'prefix directory val gen_register5 : 'prefix directory -> ('m, 'prefix, ((((unit * 'a) * 'b) * 'c) * 'd) * 'e, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'e -> 'q -> 'i -> [< 'o RPC_answer.t] Lwt.t) -> 'prefix directory val lwt_register0 : chunked:bool -> unit directory -> ('m, unit, unit, 'q, 'i, 'o) RPC_service.t -> ('q -> 'i -> 'o Lwt.t) -> unit directory val lwt_register1 : chunked:bool -> 'prefix directory -> ('m, 'prefix, unit * 'a, 'q, 'i, 'o) RPC_service.t -> ('a -> 'q -> 'i -> 'o Lwt.t) -> 'prefix directory val lwt_register2 : chunked:bool -> 'prefix directory -> ('m, 'prefix, (unit * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'q -> 'i -> 'o Lwt.t) -> 'prefix directory val lwt_register3 : chunked:bool -> 'prefix directory -> ('m, 'prefix, ((unit * 'a) * 'b) * 'c, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'q -> 'i -> 'o Lwt.t) -> 'prefix directory val lwt_register4 : chunked:bool -> 'prefix directory -> ('m, 'prefix, (((unit * 'a) * 'b) * 'c) * 'd, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'q -> 'i -> 'o Lwt.t) -> 'prefix directory val lwt_register5 : chunked:bool -> 'prefix directory -> ('m, 'prefix, ((((unit * 'a) * 'b) * 'c) * 'd) * 'e, 'q, 'i, 'o) RPC_service.t -> ('a -> 'b -> 'c -> 'd -> 'e -> 'q -> 'i -> 'o Lwt.t) -> 'prefix directory (** Registering dynamic subtree. *) val register_dynamic_directory : ?descr:string -> 'prefix directory -> ('prefix, 'a) RPC_path.t -> ('a -> 'a directory Lwt.t) -> 'prefix directory end # 72 "v3.in.ml" module Base58 : sig # 1 "v3/base58.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type 'a encoding val simple_decode : 'a encoding -> string -> 'a option val simple_encode : 'a encoding -> 'a -> string type data = .. val register_encoding : prefix:string -> length:int -> to_raw:('a -> string) -> of_raw:(string -> 'a option) -> wrap:('a -> data) -> 'a encoding val check_encoded_prefix : 'a encoding -> string -> int -> unit val decode : string -> data option end # 74 "v3.in.ml" module S : sig # 1 "v3/s.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2020 Metastate AG <hello@metastate.dev> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Generic interface for a datatype with comparison, pretty-printer and serialization functions. *) module type T = sig type t include Compare.S with type t := t val pp : Format.formatter -> t -> unit val encoding : t Data_encoding.t val to_bytes : t -> bytes val of_bytes : bytes -> t option end (** Generic interface for a datatype with comparison, pretty-printer, serialization functions and a hashing function. *) module type HASHABLE = sig include T type hash val hash : t -> hash val hash_raw : bytes -> hash end (** {2 Hash Types} *) (** The signature of an abstract hash type, as produced by functor {!Make_SHA256}. The {!t} type is abstracted for separating the various kinds of hashes in the system at typing time. Each type is equipped with functions to use it as is of as keys in the database or in memory sets and maps. *) module type MINIMAL_HASH = sig type t val name : string val title : string val pp : Format.formatter -> t -> unit val pp_short : Format.formatter -> t -> unit include Compare.S with type t := t val hash_bytes : ?key:bytes -> bytes list -> t val hash_string : ?key:string -> string list -> t val zero : t end module type RAW_DATA = sig type t val size : int (* in bytes *) val to_bytes : t -> bytes val of_bytes_opt : bytes -> t option val of_bytes_exn : bytes -> t end module type B58_DATA = sig type t val to_b58check : t -> string val to_short_b58check : t -> string val of_b58check_exn : string -> t val of_b58check_opt : string -> t option type Base58.data += Data of t val b58check_encoding : t Base58.encoding end module type ENCODER = sig type t val encoding : t Data_encoding.t val rpc_arg : t RPC_arg.t end module type INDEXES_SET = sig include Set.S val random_elt : t -> elt val encoding : t Data_encoding.t end module type INDEXES_MAP = sig include Map.S val encoding : 'a Data_encoding.t -> 'a t Data_encoding.t end module type INDEXES = sig type t module Set : INDEXES_SET with type elt = t module Map : INDEXES_MAP with type key = t end module type HASH = sig include MINIMAL_HASH include RAW_DATA with type t := t include B58_DATA with type t := t include ENCODER with type t := t include INDEXES with type t := t end module type MERKLE_TREE = sig type elt include HASH val compute : elt list -> t val empty : t type path = Left of path * t | Right of t * path | Op val compute_path : elt list -> int -> path val check_path : path -> elt -> t * int val path_encoding : path Data_encoding.t end module type SIGNATURE_PUBLIC_KEY_HASH = sig type t val pp : Format.formatter -> t -> unit val pp_short : Format.formatter -> t -> unit include Compare.S with type t := t include RAW_DATA with type t := t include B58_DATA with type t := t include ENCODER with type t := t include INDEXES with type t := t val zero : t end module type SIGNATURE_PUBLIC_KEY = sig type t val pp : Format.formatter -> t -> unit include Compare.S with type t := t include B58_DATA with type t := t include ENCODER with type t := t type public_key_hash_t val hash : t -> public_key_hash_t val size : t -> int (* in bytes *) val of_bytes_without_validation : bytes -> t option end module type SIGNATURE = sig module Public_key_hash : SIGNATURE_PUBLIC_KEY_HASH module Public_key : SIGNATURE_PUBLIC_KEY with type public_key_hash_t := Public_key_hash.t type t val pp : Format.formatter -> t -> unit include RAW_DATA with type t := t include Compare.S with type t := t include B58_DATA with type t := t include ENCODER with type t := t val zero : t type watermark (** Check a signature *) val check : ?watermark:watermark -> Public_key.t -> t -> bytes -> bool end module type FIELD = sig type t (** The order of the finite field *) val order : Z.t (** minimal number of bytes required to encode a value of the field. *) val size_in_bytes : int (** [check_bytes bs] returns [true] if [bs] is a correct byte representation of a field element *) val check_bytes : Bytes.t -> bool (** The neutral element for the addition *) val zero : t (** The neutral element for the multiplication *) val one : t (** [add a b] returns [a + b mod order] *) val add : t -> t -> t (** [mul a b] returns [a * b mod order] *) val mul : t -> t -> t (** [eq a b] returns [true] if [a = b mod order], else [false] *) val eq : t -> t -> bool (** [negate x] returns [-x mod order]. Equivalently, [negate x] returns the unique [y] such that [x + y mod order = 0] *) val negate : t -> t (** [inverse_opt x] returns [x^-1] if [x] is not [0] as an option, else [None] *) val inverse_opt : t -> t option (** [pow x n] returns [x^n] *) val pow : t -> Z.t -> t (** From a predefined bytes representation, construct a value t. It is not required that to_bytes [(Option.get (of_bytes_opt t)) = t]. By default, little endian encoding is used and the given element is modulo the prime order *) val of_bytes_opt : Bytes.t -> t option (** Convert the value t to a bytes representation which can be used for hashing for instance. It is not required that [to_bytes (Option.get (of_bytes_opt t)) = t]. By default, little endian encoding is used, and length of the resulting bytes may vary depending on the order. *) val to_bytes : t -> Bytes.t end (** Module type for the prime fields GF(p) *) module type PRIME_FIELD = sig include FIELD (** [of_z x] builds an element t from the Zarith element [x]. [mod order] is applied if [x >= order] or [x < 0]. *) val of_z : Z.t -> t (** [to_z x] builds a Zarith element, using the decimal representation. Arithmetic on the result can be done using the modular functions on integers *) val to_z : t -> Z.t end module type CURVE = sig (** The type of the element in the elliptic curve *) type t (** The size of a point representation, in bytes *) val size_in_bytes : int module Scalar : FIELD (** Check if a point, represented as a byte array, is on the curve **) val check_bytes : Bytes.t -> bool (** Attempt to construct a point from a byte array *) val of_bytes_opt : Bytes.t -> t option (** Return a representation in bytes *) val to_bytes : t -> Bytes.t (** Zero of the elliptic curve *) val zero : t (** A fixed generator of the elliptic curve *) val one : t (** Return the addition of two element *) val add : t -> t -> t (** Double the element *) val double : t -> t (** Return the opposite of the element *) val negate : t -> t (** Return [true] if the two elements are algebraically the same *) val eq : t -> t -> bool (** Multiply an element by a scalar *) val mul : t -> Scalar.t -> t end module type PAIRING = sig module Gt : FIELD module G1 : CURVE module G2 : CURVE val miller_loop : (G1.t * G2.t) list -> Gt.t val final_exponentiation_opt : Gt.t -> Gt.t option val pairing : G1.t -> G2.t -> Gt.t end end # 76 "v3.in.ml" module Blake2B : sig # 1 "v3/blake2B.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Builds a new Hash type using Blake2B. *) (** The parameters for creating a new Hash type using {!Make_Blake2B}. Both {!name} and {!title} are only informative, used in error messages and serializers. *) module type Name = sig val name : string val title : string val size : int option end module type PrefixedName = sig include Name val b58check_prefix : string end module Make_minimal (Name : Name) : S.MINIMAL_HASH module type Register = sig val register_encoding : prefix:string -> length:int -> to_raw:('a -> string) -> of_raw:(string -> 'a option) -> wrap:('a -> Base58.data) -> 'a Base58.encoding end module Make (Register : Register) (Name : PrefixedName) : S.HASH end # 78 "v3.in.ml" module Bls12_381 : sig # 1 "v3/bls12_381.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Metastate AG <hello@metastate.ch> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) module Fr : S.PRIME_FIELD module Fq12 : S.FIELD include S.PAIRING with type Gt.t = Fq12.t and type G1.Scalar.t = Fr.t and type G2.Scalar.t = Fr.t end # 80 "v3.in.ml" module Ed25519 : sig # 1 "v3/ed25519.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Tezos - Ed25519 cryptography *) include S.SIGNATURE with type watermark := bytes end # 82 "v3.in.ml" module Secp256k1 : sig # 1 "v3/secp256k1.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Tezos - Secp256k1 cryptography *) include S.SIGNATURE with type watermark := bytes end # 84 "v3.in.ml" module P256 : sig # 1 "v3/p256.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Tezos - P256 cryptography *) include S.SIGNATURE with type watermark := bytes end # 86 "v3.in.ml" module Chain_id : sig # 1 "v3/chain_id.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) include S.HASH end # 88 "v3.in.ml" module Signature : sig # 1 "v3/signature.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type public_key_hash = | Ed25519 of Ed25519.Public_key_hash.t | Secp256k1 of Secp256k1.Public_key_hash.t | P256 of P256.Public_key_hash.t type public_key = | Ed25519 of Ed25519.Public_key.t | Secp256k1 of Secp256k1.Public_key.t | P256 of P256.Public_key.t type watermark = | Block_header of Chain_id.t | Endorsement of Chain_id.t | Generic_operation | Custom of bytes include S.SIGNATURE with type Public_key_hash.t = public_key_hash and type Public_key.t = public_key and type watermark := watermark end # 90 "v3.in.ml" module Block_hash : sig # 1 "v3/block_hash.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Blocks hashes / IDs. *) include S.HASH end # 92 "v3.in.ml" module Operation_hash : sig # 1 "v3/operation_hash.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Operations hashes / IDs. *) include S.HASH end # 94 "v3.in.ml" module Operation_list_hash : sig # 1 "v3/operation_list_hash.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Blocks hashes / IDs. *) include S.MERKLE_TREE with type elt = Operation_hash.t end # 96 "v3.in.ml" module Operation_list_list_hash : sig # 1 "v3/operation_list_list_hash.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Blocks hashes / IDs. *) include S.MERKLE_TREE with type elt = Operation_list_hash.t end # 98 "v3.in.ml" module Protocol_hash : sig # 1 "v3/protocol_hash.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Protocol hashes / IDs. *) include S.HASH end # 100 "v3.in.ml" module Context_hash : sig # 1 "v3/context_hash.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Committed context hashes / IDs. *) include S.HASH (** The module for representing the hash version of a context *) module Version : sig (** The type for hash versions. *) type t = private int include Compare.S with type t := t (** [pp] is the pretty-printer for hash versions. *) val pp : Format.formatter -> t -> unit (** [encoding] is the data encoding for hash versions. *) val encoding : t Data_encoding.t (** [of_int i] is the hash version equivalent to [i]. This function raises [Invalid_argument] if [i] is not an unsigned 16-bit integer. *) val of_int : int -> t end type version = Version.t end # 102 "v3.in.ml" module Sapling : sig # 1 "v3/sapling.mli" (* The MIT License (MIT) * * Copyright (c) 2019-2020 Nomadic Labs <contact@nomadic-labs.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. *) module Ciphertext : sig type t val encoding : t Data_encoding.t val get_memo_size : t -> int end module Commitment : sig type t val encoding : t Data_encoding.t val valid_position : int64 -> bool end module CV : sig type t val encoding : t Data_encoding.t end module Hash : sig type t val compare : t -> t -> int val encoding : t Data_encoding.t val to_bytes : t -> Bytes.t val of_bytes_exn : Bytes.t -> t val uncommitted : height:int -> t val merkle_hash : height:int -> t -> t -> t val of_commitment : Commitment.t -> t val to_commitment : t -> Commitment.t end module Nullifier : sig type t val encoding : t Data_encoding.t val compare : t -> t -> int end module UTXO : sig type rk type spend_proof type spend_sig type output_proof type input = { cv : CV.t; nf : Nullifier.t; rk : rk; proof_i : spend_proof; signature : spend_sig; } val input_encoding : input Data_encoding.t type output = { cm : Commitment.t; proof_o : output_proof; ciphertext : Ciphertext.t; } val output_encoding : output Data_encoding.t type binding_sig type transaction = { inputs : input list; outputs : output list; binding_sig : binding_sig; balance : Int64.t; root : Hash.t; } val transaction_encoding : transaction Data_encoding.t val binding_sig_encoding : binding_sig Data_encoding.t end module Verification : sig type t val with_verification_ctx : (t -> 'a) -> 'a val check_spend : t -> UTXO.input -> Hash.t -> string -> bool val check_output : t -> UTXO.output -> bool val final_check : t -> UTXO.transaction -> string -> bool end end # 104 "v3.in.ml" module Timelock : sig # 1 "v3/timelock.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs, <contact@nomadic-labs.com *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Contains a value (the decryption of the ciphertext) that can be provably recovered in [time] sequential operation or with the rsa secret. *) type chest val chest_encoding : chest Data_encoding.t (** Provably opens a chest in a short time. *) type chest_key val chest_key_encoding : chest_key Data_encoding.t (** Result of the opening of a chest. The opening can fail in two way which we distinguish to blame the right person. One can provide a false unlocked_value or unlocked_proof, in which case we return [Bogus_opening] and the provider of the chest key is at fault. Otherwise, one can lock the wrong key or put garbage in the ciphertext in which case we return [Bogus_cipher] and the provider of the chest is at fault. Otherwise we return [Correct payload] where payload was what had originally been put in the chest. *) type opening_result = Correct of Bytes.t | Bogus_cipher | Bogus_opening (** Takes a chest, chest key and time and tries to recover the underlying plaintext. See the documentation of opening_result. *) val open_chest : chest -> chest_key -> time:int -> opening_result (** Gives the size of the underlying plaintext in a chest in bytes. Used for gas accounting*) val get_plaintext_size : chest -> int end # 106 "v3.in.ml" module Micheline : sig # 1 "v3/micheline.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type annot = string list type ('l, 'p) node = | Int of 'l * Z.t | String of 'l * string | Bytes of 'l * bytes | Prim of 'l * 'p * ('l, 'p) node list * annot | Seq of 'l * ('l, 'p) node list type 'p canonical type canonical_location = int val root : 'p canonical -> (canonical_location, 'p) node val canonical_location_encoding : canonical_location Data_encoding.encoding val canonical_encoding : variant:string -> 'l Data_encoding.encoding -> 'l canonical Data_encoding.encoding val canonical_encoding_v1 : variant:string -> 'l Data_encoding.encoding -> 'l canonical Data_encoding.encoding (* val erased_encoding : variant:string -> 'l -> 'p Data_encoding.encoding -> ('l, 'p) node Data_encoding.encoding val table_encoding : variant:string -> 'l Data_encoding.encoding -> 'p Data_encoding.encoding -> ('l, 'p) node Data_encoding.encoding *) val location : ('l, 'p) node -> 'l val annotations : ('l, 'p) node -> string list val strip_locations : (_, 'p) node -> 'p canonical val extract_locations : ('l, 'p) node -> 'p canonical * (canonical_location * 'l) list val inject_locations : (canonical_location -> 'l) -> 'p canonical -> ('l, 'p) node end # 108 "v3.in.ml" module Block_header : sig # 1 "v3/block_header.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type shell_header = { level : Int32.t; (** The number of preceding block in this chain, i.e. the genesis has level 0. *) proto_level : int; (** The number of preceding protocol change in the chain (modulo 256), i.e. the genesis has proto_level 0. *) predecessor : Block_hash.t; timestamp : Time.t; validation_passes : int; operations_hash : Operation_list_list_hash.t; fitness : Bytes.t list; context : Context_hash.t; } val shell_header_encoding : shell_header Data_encoding.t type t = {shell : shell_header; protocol_data : bytes} include S.HASHABLE with type t := t and type hash := Block_hash.t end # 110 "v3.in.ml" module Fitness : sig # 1 "v3/fitness.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** The fitness of a block is defined as a list of bytes, compared in a lexicographical order (longer list are greater). *) include S.T with type t = bytes list end # 112 "v3.in.ml" module Operation : sig # 1 "v3/operation.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Tezos operations. *) type shell_header = { branch : Block_hash.t; (** The operation is only valid in a branch containing the block [branch]. *) } val shell_header_encoding : shell_header Data_encoding.t type t = {shell : shell_header; proto : bytes} include S.HASHABLE with type t := t and type hash := Operation_hash.t end # 114 "v3.in.ml" module Context : sig # 1 "v3/context.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** View over the context store, restricted to types, access and functional manipulation of an existing context. *) (* Copy/paste of Environment_context_sigs.Context.S *) (** The tree depth of a fold. See the [fold] function for more information. *) type depth = [`Eq of int | `Le of int | `Lt of int | `Ge of int | `Gt of int] module type VIEW = sig (** The type for context views. *) type t (** The type for context keys. *) type key (** The type for context values. *) type value (** The type for context trees. *) type tree (** {2 Getters} *) (** [mem t k] is an Lwt promise that resolves to [true] iff [k] is bound to a value in [t]. *) val mem : t -> key -> bool Lwt.t (** [mem_tree t k] is like {!mem} but for trees. *) val mem_tree : t -> key -> bool Lwt.t (** [find t k] is an Lwt promise that resolves to [Some v] if [k] is bound to the value [v] in [t] and [None] otherwise. *) val find : t -> key -> value option Lwt.t (** [find_tree t k] is like {!find} but for trees. *) val find_tree : t -> key -> tree option Lwt.t (** [list t key] is the list of files and sub-nodes stored under [k] in [t]. The result order is not specified but is stable. [offset] and [length] are used for pagination. *) val list : t -> ?offset:int -> ?length:int -> key -> (string * tree) list Lwt.t (** {2 Setters} *) (** [add t k v] is an Lwt promise that resolves to [c] such that: - [k] is bound to [v] in [c]; - and [c] is similar to [t] otherwise. If [k] was already bound in [t] to a value that is physically equal to [v], the result of the function is a promise that resolves to [t]. Otherwise, the previous binding of [k] in [t] disappears. *) val add : t -> key -> value -> t Lwt.t (** [add_tree] is like {!add} but for trees. *) val add_tree : t -> key -> tree -> t Lwt.t (** [remove t k v] is an Lwt promise that resolves to [c] such that: - [k] is unbound in [c]; - and [c] is similar to [t] otherwise. *) val remove : t -> key -> t Lwt.t (** {2 Folding} *) (** [fold ?depth t root ~init ~f] recursively folds over the trees and values of [t]. The [f] callbacks are called with a key relative to [root]. [f] is never called with an empty key for values; i.e., folding over a value is a no-op. Elements are traversed in lexical order of keys. The depth is 0-indexed. If [depth] is set (by default it is not), then [f] is only called when the conditions described by the parameter is true: - [Eq d] folds over nodes and contents of depth exactly [d]. - [Lt d] folds over nodes and contents of depth strictly less than [d]. - [Le d] folds over nodes and contents of depth less than or equal to [d]. - [Gt d] folds over nodes and contents of depth strictly more than [d]. - [Ge d] folds over nodes and contents of depth more than or equal to [d]. *) val fold : ?depth:depth -> t -> key -> init:'a -> f:(key -> tree -> 'a -> 'a Lwt.t) -> 'a Lwt.t end module Kind : sig type t = [`Value | `Tree] end module type TREE = sig (** [Tree] provides immutable, in-memory partial mirror of the context, with lazy reads and delayed writes. Trees are immutable and non-persistent (they disappear if the host crash), held in memory for efficiency, where reads are done lazily and writes are done only when needed, e.g. on [Context.commit]. If a key is modified twice, only the last value will be written to disk on commit. *) (** The type for context views. *) type t (** The type for context trees. *) type tree include VIEW with type t := tree and type tree := tree (** [empty _] is the empty tree. *) val empty : t -> tree (** [is_empty t] is true iff [t] is [empty _]. *) val is_empty : tree -> bool (** [kind t] is [t]'s kind. It's either a tree node or a leaf value. *) val kind : tree -> Kind.t (** [to_value t] is an Lwt promise that resolves to [Some v] if [t] is a leaf tree and [None] otherwise. It is equivalent to [find t []]. *) val to_value : tree -> value option Lwt.t (** [of_value _ v] is an Lwt promise that resolves to the leaf tree [v]. Is is equivalent to [add (empty _) [] v]. *) val of_value : t -> value -> tree Lwt.t (** [hash t] is [t]'s Merkle hash. *) val hash : tree -> Context_hash.t (** [equal x y] is true iff [x] and [y] have the same Merkle hash. *) val equal : tree -> tree -> bool (** {2 Caches} *) (** [clear ?depth t] clears all caches in the tree [t] for subtrees with a depth higher than [depth]. If [depth] is not set, all of the subtrees are cleared. *) val clear : ?depth:int -> tree -> unit end include VIEW with type key = string list and type value = bytes module Tree : TREE with type t := t and type key := key and type value := value and type tree := tree val register_resolver : 'a Base58.encoding -> (t -> string -> 'a list Lwt.t) -> unit val complete : t -> string -> string list Lwt.t (** Get the hash version used for the context *) val get_hash_version : t -> Context_hash.Version.t (** Set the hash version used for the context. It may recalculate the hashes of the whole context, which can be a long process. Returns an Error if the hash version is unsupported. *) val set_hash_version : t -> Context_hash.Version.t -> t Error_monad.shell_tzresult Lwt.t type cache_key type cache_value = .. module type CACHE = sig (** Type for context view. A context contains a cache. A cache is made of subcaches. Each subcache has its own size limit. The limit of its subcache is called a layout and can be initialized via the [set_cache_layout] function. *) type t (** Size for subcaches and values of the cache. Units are not specified and left to the economic protocol. *) type size (** Index type to index caches. *) type index (** Identifier type for keys. *) type identifier (** A key uniquely identifies a cached [value] in some subcache. *) type key (** Cached values inhabit an extensible type. *) type value = .. (** [key_of_identifier ~cache_index identifier] builds a key from the [cache_index] and the [identifier]. No check are made to ensure the validity of the index. *) val key_of_identifier : cache_index:index -> identifier -> key (** [identifier_of_key key] returns the identifier associated to the [key]. *) val identifier_of_key : key -> identifier (** [pp fmt cache] is a pretty printter for a [cache]. *) val pp : Format.formatter -> t -> unit (** [find ctxt k = Some v] if [v] is the value associated to [k] in in the cache where [k] is. Returns [None] if there is no such value in the cache of [k]. This function is in the Lwt monad because if the value has not been constructed, it is constructed on the fly. *) val find : t -> key -> value option Lwt.t (** [set_cache_layout ctxt layout] sets the caches of [ctxt] to comply with given [layout]. If there was already a cache in [ctxt], it is erased by the new layout. Otherwise, a fresh collection of empty caches is reconstructed from the new [layout]. Notice that cache [key]s are invalidated in that case, i.e., [get t k] will return [None]. *) val set_cache_layout : t -> size list -> t Lwt.t (** [update ctxt k (Some (e, size))] returns a cache where the value [e] of [size] is associated to key [k]. If [k] is already in the cache, the cache entry is updated. [update ctxt k None] removes [k] from the cache. *) val update : t -> key -> (value * size) option -> t (** [sync ctxt ~cache_nonce] updates the context with the domain of the cache computed so far. Such function is expected to be called at the end of the validation of a block, when there is no more accesses to the cache. [cache_nonce] identifies the block that introduced new cache entries. The nonce should identify uniquely the block which modifies this value. It cannot be the block hash for circularity reasons: The value of the nonce is stored onto the context and consequently influences the context hash of the very same block. Such nonce cannot be determined by the shell and its computation is delegated to the economic protocol. *) val sync : t -> cache_nonce:Bytes.t -> t Lwt.t (** [clear ctxt] removes all cache entries. *) val clear : t -> t (** {3 Cache introspection} *) (** [list_keys ctxt ~cache_index] returns the list of cached keys in cache numbered [cache_index] along with their respective [size]. The returned list is sorted in terms of their age in the cache, the oldest coming first. If [cache_index] is invalid, then this function returns [None]. *) val list_keys : t -> cache_index:index -> (key * size) list option (** [key_rank index ctxt key] returns the number of cached value older than the given [key]; or, [None] if the [key] is not a cache key. *) val key_rank : t -> key -> int option (** {3 Cache helpers for RPCs} *) (** [future_cache_expectation ctxt ~time_in_blocks] returns [ctxt] except that the entries of the caches that are presumably too old to still be in the caches in [n_blocks] are removed. This function is based on a heuristic. The context maintains the median of the number of removed entries: this number is multipled by `n_blocks` to determine the entries that are likely to be removed in `n_blocks`. *) val future_cache_expectation : t -> time_in_blocks:int -> t (** [cache_size ctxt ~cache_index] returns an overapproximation of the size of the cache. Returns [None] if [cache_index] is not a valid cache index. *) val cache_size : t -> cache_index:index -> size option (** [cache_size_limit ctxt ~cache_index] returns the maximal size of the cache indexed by [cache_index]. Returns [None] if [cache_index] is not a valid cache index. *) val cache_size_limit : t -> cache_index:index -> size option end module Cache : CACHE with type t := t and type size := int and type index := int and type identifier := string and type key = cache_key and type value = cache_value end # 116 "v3.in.ml" module Updater : sig # 1 "v3/updater.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) (** Tezos Protocol Environment - Protocol updater. *) (** Validation result: the record returned by the protocol on the successful validation of a block. *) type validation_result = { context : Context.t; (** The resulting context, it will be used for the next block. *) fitness : Fitness.t; (** The effective fitness of the block (to be compared with the one 'announced' in the block header). *) message : string option; (** An optional informative message, akin to a 'git commit' message, which can be attached to the [context] when it's being commited. *) max_operations_ttl : int; (** The "time-to-live" of operations for the next block: any operation whose 'branch' is older than 'ttl' blocks in the past cannot be included in the next block. *) last_allowed_fork_level : Int32.t; (** The level of the last block for which the node might consider an alternate branch. The shell should consider as invalid any branch whose fork point is older (has a lower level) than the given value. *) } type quota = { max_size : int; (** The maximum size (in bytes) of the serialized list of operations. *) max_op : int option; (** The maximum number of operations in a block. [None] means no limit. *) } type rpc_context = { block_hash : Block_hash.t; block_header : Block_header.shell_header; context : Context.t; } (** This is the signature of a Tezos protocol implementation. It has access to the standard library and the Environment module. *) module type PROTOCOL = sig (** The maximum size of a block header in bytes. *) val max_block_length : int (** The maximum size of an operation in bytes. *) val max_operation_data_length : int (** Operations quota for each validation pass. The length of the list denotes the number of validation passes. *) val validation_passes : quota list (** The economic protocol-specific type of blocks. *) type block_header_data (** Encoding for economic protocol-specific part of block headers. *) val block_header_data_encoding : block_header_data Data_encoding.t (** A fully parsed block header. *) type block_header = { shell : Block_header.shell_header; protocol_data : block_header_data; } (** Economic protocol-specific side information computed by the protocol during the validation of a block. Should not include information about the evaluation of operations which is handled separately by {!operation_metadata}. To be used as an execution trace by tools (client, indexer). Not necessary for validation. *) type block_header_metadata (** Encoding for economic protocol-specific block metadata. *) val block_header_metadata_encoding : block_header_metadata Data_encoding.t (** The economic protocol-specific type of operations. *) type operation_data (** Economic protocol-specific side information computed by the protocol during the validation of each operation, to be used conjointly with {!block_header_metadata}. *) type operation_receipt (** A fully parsed operation. *) type operation = { shell : Operation.shell_header; protocol_data : operation_data; } (** Encoding for economoic protocol-specific operation data. *) val operation_data_encoding : operation_data Data_encoding.t (** Encoding for eonomic protocol-specific operation receipts. *) val operation_receipt_encoding : operation_receipt Data_encoding.t (** Encoding that mixes an operation data and its receipt. *) val operation_data_and_receipt_encoding : (operation_data * operation_receipt) Data_encoding.t (** [acceptable_passes op] lists the validation passes in which the input operation [op] can appear. For instance, it results in [[0]] if [op] only belongs to the first pass. An answer of [[]] means that the [op] is ill-formed and cannot be included at all in a block. *) val acceptable_passes : operation -> int list (** [relative_position_within_block op1 op2] provides a partial and strict order of operations within a block. It is intended to be used as an argument to {!List.sort} (and other sorting/ordering functions) to arrange a set of operations into a sequence, the order of which is valid for the protocol. A negative (respectively, positive) results means that [op1] should appear before (and, respectively, after) [op2] in a block. This function does not provide a total ordering on the operations: a result of [0] entails that the protocol does not impose any preferences to the order in which [op1] and [op2] should be included in a block. {b Caveat Emptor!} [relative_position_within_block o1 o2 = 0] does NOT imply that [o1] is equal to [o2] in any way. Consequently, it {e MUST NOT} be used as a [compare] component of an {!Stdlib.Map.OrderedType}, or any such collection which relies on a total comparison function. *) val relative_position_within_block : operation -> operation -> int (** A functional state that is transmitted through the steps of a block validation sequence: it can be created by any of the [begin_x] functions below, and its final value is produced by {!finalize_block}. It must retain the current state of the store, and it can also contain additional information that must be remembered during the validation process. Said extra content must however be immutable: validator or baker implementations are allowed to pause, replay or backtrack throughout validation steps. *) type validation_state (** [begin_partial_application cid ctxt] checks that a block is well-formed in a given context. This function should run quickly, as its main use is to reject bad blocks from the chain as early as possible. The input [ancestor_context] is expected to result from the application of an ancestor block of the current head with the same economic protocol. Said ancestor block is also required to be more recent (i.e., it has a greater level), than the current head's "last_allowed_fork_level". The resulting `validation_state` will be used for multi-pass validation. *) val begin_partial_application : chain_id:Chain_id.t -> ancestor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_fitness:Fitness.t -> block_header -> validation_state tzresult Lwt.t (** [begin_application chain_id ... bh] defines the first step in a block validation sequence. It initializes a validation context for validating a block, whose header is [bh]. *) val begin_application : chain_id:Chain_id.t -> predecessor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_fitness:Fitness.t -> block_header -> validation_state tzresult Lwt.t (** [begin_construction] initializes a validation context for constructing a new block, as opposed to validating an existing block. This function can be used in two modes: with and without the optional [protocol_data] argument. With the latter, it is used by bakers to start the process for baking a new block. Without it, is used by the Shell's prevalidator to construct a virtual block, which carries the contents of the pre-applied operations of the mempool. When [protocol_data] is provided, it is not expected to be the final value of the field of the same name in the {!block_header} of the block eventually being baked. Instead, it is expected to construct a protocol-specific, good enough, "prototype" of its final value. For instance, if the economic protocol specifies that its block headers include a signature, [protocol_data] must include a (faked) signature. Moreover, these prototypes should not be distinguishable after the application of [begin_construction]: the function must produce the exact same context regardless of being passed a prototype, or an "equivalent-but-complete" header. *) val begin_construction : chain_id:Chain_id.t -> predecessor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> predecessor:Block_hash.t -> timestamp:Time.t -> ?protocol_data:block_header_data -> unit -> validation_state tzresult Lwt.t (** [apply_operation vs op] applies the input operation [op] on top of the given {!validation_state} [vs]. It must be called after {!begin_application} or {!begin_construction}, and before {!finalize_block}, for each operation in a block. On a successful application, it returns a pair consisting of the resulting [validation_state], and the corresponding [operation_receipt]. *) val apply_operation : validation_state -> operation -> (validation_state * operation_receipt) tzresult Lwt.t (** [finalize_block vs] finalizes the context resulting from the application of the contents of the block being validated. If there is no protocol migration, i.e., if the block being applied is not the last block of the current economic protocol, the resulting context can be used in the future as input for the validation of its successor blocks. *) val finalize_block : validation_state -> Block_header.shell_header option -> (validation_result * block_header_metadata) tzresult Lwt.t (** [rpc_services] provides the list of remote procedures exported by this protocol implementation. *) val rpc_services : rpc_context RPC_directory.t (** [init ctxt hd] initializes the context, or upgrades the context after a protocol amendment. This function receives as arguments the context [ctxt] resulting from the application of the block that triggered the amendment, as well as its header [hd]. This function should fail if the "protocol stitching", i.e., the transition from a valid previous protocol to the one being activated, has not been implemented. *) val init : Context.t -> Block_header.shell_header -> validation_result tzresult Lwt.t (** [value_of_key chain_id predecessor_context predecessor_timestamp predecessor_level predecessor_fitness predecessor timestamp] returns a function to build one value of the cache from its key. This function is used to restore all or part of the cache, for instance when booting a validator to preheat the cache, or when a reorganization happens. This function should never fail, returned errors are fatal. The generated function is passed to [Context.Cache.load_caches] which will use it either immediately a cache-loading time or on-demand, when a given cached value is accessed. *) val value_of_key : chain_id:Chain_id.t -> predecessor_context:Context.t -> predecessor_timestamp:Time.t -> predecessor_level:Int32.t -> predecessor_fitness:Fitness.t -> predecessor:Block_hash.t -> timestamp:Time.t -> (Context.Cache.key -> Context.Cache.value tzresult Lwt.t) tzresult Lwt.t end (** [activate ctxt ph] activates an economic protocol (given by its hash [ph]) from the context [ctxt]. The resulting context is still a context for the current economic protocol, and the migration is not complete until [init] in invoked. *) val activate : Context.t -> Protocol_hash.t -> Context.t Lwt.t end # 118 "v3.in.ml" module RPC_context : sig # 1 "v3/RPC_context.mli" (*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) type t = Updater.rpc_context class type ['pr] simple = object method call_proto_service0 : 'm 'q 'i 'o. (([< RPC_service.meth] as 'm), t, t, 'q, 'i, 'o) RPC_service.t -> 'pr -> 'q -> 'i -> 'o Error_monad.shell_tzresult Lwt.t method call_proto_service1 : 'm 'a 'q 'i 'o. (([< RPC_service.meth] as 'm), t, t * 'a, 'q, 'i, 'o) RPC_service.t -> 'pr -> 'a -> 'q -> 'i -> 'o Error_monad.shell_tzresult Lwt.t method call_proto_service2 : 'm 'a 'b 'q 'i 'o. (([< RPC_service.meth] as 'm), t, (t * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> 'pr -> 'a -> 'b -> 'q -> 'i -> 'o Error_monad.shell_tzresult Lwt.t method call_proto_service3 : 'm 'a 'b 'c 'q 'i 'o. ( ([< RPC_service.meth] as 'm), t, ((t * 'a) * 'b) * 'c, 'q, 'i, 'o ) RPC_service.t -> 'pr -> 'a -> 'b -> 'c -> 'q -> 'i -> 'o Error_monad.shell_tzresult Lwt.t end val make_call0 : ([< RPC_service.meth], t, t, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'q -> 'i -> 'o shell_tzresult Lwt.t val make_call1 : ([< RPC_service.meth], t, t * 'a, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'a -> 'q -> 'i -> 'o shell_tzresult Lwt.t val make_call2 : ([< RPC_service.meth], t, (t * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'a -> 'b -> 'q -> 'i -> 'o shell_tzresult Lwt.t val make_call3 : ([< RPC_service.meth], t, ((t * 'a) * 'b) * 'c, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'a -> 'b -> 'c -> 'q -> 'i -> 'o shell_tzresult Lwt.t val make_opt_call0 : ([< RPC_service.meth], t, t, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'q -> 'i -> 'o option shell_tzresult Lwt.t val make_opt_call1 : ([< RPC_service.meth], t, t * 'a, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'a -> 'q -> 'i -> 'o option shell_tzresult Lwt.t val make_opt_call2 : ([< RPC_service.meth], t, (t * 'a) * 'b, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'a -> 'b -> 'q -> 'i -> 'o option shell_tzresult Lwt.t val make_opt_call3 : ([< RPC_service.meth], t, ((t * 'a) * 'b) * 'c, 'q, 'i, 'o) RPC_service.t -> 'pr #simple -> 'pr -> 'a -> 'b -> 'c -> 'q -> 'i -> 'o option shell_tzresult Lwt.t end # 120 "v3.in.ml" end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>