| 1 |
= BasisLibrary |
| 2 |
:toc: |
| 3 |
|
| 4 |
The <<StandardML#,Standard ML>> Basis Library is a collection of modules |
| 5 |
dealing with basic types, input/output, OS interfaces, and simple |
| 6 |
datatypes. It is intended as a portable library usable across all |
| 7 |
implementations of SML. For the official online version of the Basis |
| 8 |
Library specification, see https://smlfamily.github.io/Basis. |
| 9 |
<<References#GansnerReppy04,The Standard ML Basis Library>> is a book |
| 10 |
version that includes all of the online version and more. For a |
| 11 |
reverse chronological list of changes to the specification, see |
| 12 |
https://smlfamily.github.io/Basis/history.html. |
| 13 |
|
| 14 |
MLton implements all of the required portions of the Basis Library. |
| 15 |
MLton also implements many of the optional structures. In the future, |
| 16 |
MLton will also implement |
| 17 |
https://github.com/SMLFamily/BasisLibrary/wiki[proposed improvements] |
| 18 |
to the Basis Library. |
| 19 |
|
| 20 |
You can obtain a complete and current list of what's available using |
| 21 |
`mlton -show-basis` (see <<ShowBasis#>>). By default, MLton makes the |
| 22 |
Basis Library available to user programs. You can also |
| 23 |
<<MLBasisAvailableLibraries#,access the Basis Library>> from |
| 24 |
<<MLBasis#,ML Basis>> files. |
| 25 |
|
| 26 |
MLton purposefully hides the representation of unspecified Basis |
| 27 |
Library types with opaque signature matching. That is, unless the |
| 28 |
Basis Library specifies that a structure's type is equal to some other |
| 29 |
type, the type will be opaque and will not be seen as equal to any |
| 30 |
type but itself. |
| 31 |
|
| 32 |
Below is a complete list of what MLton implements. |
| 33 |
|
| 34 |
== Top-level types and constructors |
| 35 |
|
| 36 |
`eqtype 'a array` |
| 37 |
|
| 38 |
`datatype bool = false | true` |
| 39 |
|
| 40 |
`eqtype char` |
| 41 |
|
| 42 |
`type exn` |
| 43 |
|
| 44 |
`eqtype int` |
| 45 |
|
| 46 |
`datatype 'a list = nil | {two-colons} of ('a * 'a list)` |
| 47 |
|
| 48 |
`datatype 'a option = NONE | SOME of 'a` |
| 49 |
|
| 50 |
`datatype order = EQUAL | GREATER | LESS` |
| 51 |
|
| 52 |
`type real` |
| 53 |
|
| 54 |
`datatype 'a ref = ref of 'a` |
| 55 |
|
| 56 |
`eqtype string` |
| 57 |
|
| 58 |
`type substring` |
| 59 |
|
| 60 |
`eqtype unit` |
| 61 |
|
| 62 |
`eqtype 'a vector` |
| 63 |
|
| 64 |
`eqtype word` |
| 65 |
|
| 66 |
== Top-level exception constructors |
| 67 |
|
| 68 |
`Bind` |
| 69 |
|
| 70 |
`Chr` |
| 71 |
|
| 72 |
`Div` |
| 73 |
|
| 74 |
`Domain` |
| 75 |
|
| 76 |
`Empty` |
| 77 |
|
| 78 |
`Fail of string` |
| 79 |
|
| 80 |
`Match` |
| 81 |
|
| 82 |
`Option` |
| 83 |
|
| 84 |
`Overflow` |
| 85 |
|
| 86 |
`Size` |
| 87 |
|
| 88 |
`Span` |
| 89 |
|
| 90 |
`Subscript` |
| 91 |
|
| 92 |
== Top-level values |
| 93 |
|
| 94 |
MLton does not implement the optional top-level value |
| 95 |
`use: string \-> unit`, which conflicts with whole-program |
| 96 |
compilation because it allows new code to be loaded dynamically. |
| 97 |
|
| 98 |
MLton implements all other top-level values: |
| 99 |
|
| 100 |
`!`, |
| 101 |
`:=`, |
| 102 |
`<>`, |
| 103 |
`=`, |
| 104 |
`@`, |
| 105 |
`^`, |
| 106 |
`app`, |
| 107 |
`before`, |
| 108 |
`ceil`, |
| 109 |
`chr`, |
| 110 |
`concat`, |
| 111 |
`exnMessage`, |
| 112 |
`exnName`, |
| 113 |
`explode`, |
| 114 |
`floor`, |
| 115 |
`foldl`, |
| 116 |
`foldr`, |
| 117 |
`getOpt`, |
| 118 |
`hd`, |
| 119 |
`ignore`, |
| 120 |
`implode`, |
| 121 |
`isSome`, |
| 122 |
`length`, |
| 123 |
`map`, |
| 124 |
`not`, |
| 125 |
`null`, |
| 126 |
`o`, |
| 127 |
`ord`, |
| 128 |
`print`, |
| 129 |
`real`, |
| 130 |
`rev`, |
| 131 |
`round`, |
| 132 |
`size`, |
| 133 |
`str`, |
| 134 |
`substring`, |
| 135 |
`tl`, |
| 136 |
`trunc`, |
| 137 |
`valOf`, |
| 138 |
`vector` |
| 139 |
|
| 140 |
== Overloaded identifiers |
| 141 |
|
| 142 |
`*`, |
| 143 |
`+`, |
| 144 |
`-`, |
| 145 |
`/`, |
| 146 |
`<`, |
| 147 |
`<=`, |
| 148 |
`>`, |
| 149 |
`>=`, |
| 150 |
`~`, |
| 151 |
`abs`, |
| 152 |
`div`, |
| 153 |
`mod` |
| 154 |
|
| 155 |
== Top-level signatures |
| 156 |
|
| 157 |
`ARRAY` |
| 158 |
|
| 159 |
`ARRAY2` |
| 160 |
|
| 161 |
`ARRAY_SLICE` |
| 162 |
|
| 163 |
`BIN_IO` |
| 164 |
|
| 165 |
`BIT_FLAGS` |
| 166 |
|
| 167 |
`BOOL` |
| 168 |
|
| 169 |
`BYTE` |
| 170 |
|
| 171 |
`CHAR` |
| 172 |
|
| 173 |
`COMMAND_LINE` |
| 174 |
|
| 175 |
`DATE` |
| 176 |
|
| 177 |
`GENERAL` |
| 178 |
|
| 179 |
`GENERIC_SOCK` |
| 180 |
|
| 181 |
`IEEE_REAL` |
| 182 |
|
| 183 |
`IMPERATIVE_IO` |
| 184 |
|
| 185 |
`INET_SOCK` |
| 186 |
|
| 187 |
`INTEGER` |
| 188 |
|
| 189 |
`INT_INF` |
| 190 |
|
| 191 |
`IO` |
| 192 |
|
| 193 |
`LIST` |
| 194 |
|
| 195 |
`LIST_PAIR` |
| 196 |
|
| 197 |
`MATH` |
| 198 |
|
| 199 |
`MONO_ARRAY` |
| 200 |
|
| 201 |
`MONO_ARRAY2` |
| 202 |
|
| 203 |
`MONO_ARRAY_SLICE` |
| 204 |
|
| 205 |
`MONO_VECTOR` |
| 206 |
|
| 207 |
`MONO_VECTOR_SLICE` |
| 208 |
|
| 209 |
`NET_HOST_DB` |
| 210 |
|
| 211 |
`NET_PROT_DB` |
| 212 |
|
| 213 |
`NET_SERV_DB` |
| 214 |
|
| 215 |
`OPTION` |
| 216 |
|
| 217 |
`OS` |
| 218 |
|
| 219 |
`OS_FILE_SYS` |
| 220 |
|
| 221 |
`OS_IO` |
| 222 |
|
| 223 |
`OS_PATH` |
| 224 |
|
| 225 |
`OS_PROCESS` |
| 226 |
|
| 227 |
`PACK_REAL` |
| 228 |
|
| 229 |
`PACK_WORD` |
| 230 |
|
| 231 |
`POSIX` |
| 232 |
|
| 233 |
`POSIX_ERROR` |
| 234 |
|
| 235 |
`POSIX_FILE_SYS` |
| 236 |
|
| 237 |
`POSIX_IO` |
| 238 |
|
| 239 |
`POSIX_PROCESS` |
| 240 |
|
| 241 |
`POSIX_PROC_ENV` |
| 242 |
|
| 243 |
`POSIX_SIGNAL` |
| 244 |
|
| 245 |
`POSIX_SYS_DB` |
| 246 |
|
| 247 |
`POSIX_TTY` |
| 248 |
|
| 249 |
`PRIM_IO` |
| 250 |
|
| 251 |
`REAL` |
| 252 |
|
| 253 |
`SOCKET` |
| 254 |
|
| 255 |
`STREAM_IO` |
| 256 |
|
| 257 |
`STRING` |
| 258 |
|
| 259 |
`STRING_CVT` |
| 260 |
|
| 261 |
`SUBSTRING` |
| 262 |
|
| 263 |
`TEXT` |
| 264 |
|
| 265 |
`TEXT_IO` |
| 266 |
|
| 267 |
`TEXT_STREAM_IO` |
| 268 |
|
| 269 |
`TIME` |
| 270 |
|
| 271 |
`TIMER` |
| 272 |
|
| 273 |
`UNIX` |
| 274 |
|
| 275 |
`UNIX_SOCK` |
| 276 |
|
| 277 |
`VECTOR` |
| 278 |
|
| 279 |
`VECTOR_SLICE` |
| 280 |
|
| 281 |
`WORD` |
| 282 |
|
| 283 |
== Top-level structures |
| 284 |
|
| 285 |
`structure Array: ARRAY` |
| 286 |
|
| 287 |
`structure Array2: ARRAY2` |
| 288 |
|
| 289 |
`structure ArraySlice: ARRAY_SLICE` |
| 290 |
|
| 291 |
`structure BinIO: BIN_IO` |
| 292 |
|
| 293 |
`structure BinPrimIO: PRIM_IO` |
| 294 |
|
| 295 |
`structure Bool: BOOL` |
| 296 |
|
| 297 |
`structure BoolArray: MONO_ARRAY` |
| 298 |
|
| 299 |
`structure BoolArray2: MONO_ARRAY2` |
| 300 |
|
| 301 |
`structure BoolArraySlice: MONO_ARRAY_SLICE` |
| 302 |
|
| 303 |
`structure BoolVector: MONO_VECTOR` |
| 304 |
|
| 305 |
`structure BoolVectorSlice: MONO_VECTOR_SLICE` |
| 306 |
|
| 307 |
`structure Byte: BYTE` |
| 308 |
|
| 309 |
`structure Char: CHAR` |
| 310 |
|
| 311 |
* `Char` characters correspond to ISO-8859-1. The `Char` functions do not depend on locale. |
| 312 |
|
| 313 |
`structure CharArray: MONO_ARRAY` |
| 314 |
|
| 315 |
`structure CharArray2: MONO_ARRAY2` |
| 316 |
|
| 317 |
`structure CharArraySlice: MONO_ARRAY_SLICE` |
| 318 |
|
| 319 |
`structure CharVector: MONO_VECTOR` |
| 320 |
|
| 321 |
`structure CharVectorSlice: MONO_VECTOR_SLICE` |
| 322 |
|
| 323 |
`structure CommandLine: COMMAND_LINE` |
| 324 |
|
| 325 |
`structure Date: DATE` |
| 326 |
|
| 327 |
* `Date.fromString` and `Date.scan` accept a space in addition to a zero for the first character of the day of the month. The Basis Library specification only allows a zero. |
| 328 |
|
| 329 |
`structure FixedInt: INTEGER` |
| 330 |
|
| 331 |
`structure General: GENERAL` |
| 332 |
|
| 333 |
`structure GenericSock: GENERIC_SOCK` |
| 334 |
|
| 335 |
`structure IEEEReal: IEEE_REAL` |
| 336 |
|
| 337 |
`structure INetSock: INET_SOCK` |
| 338 |
|
| 339 |
`structure IO: IO` |
| 340 |
|
| 341 |
`structure Int: INTEGER` |
| 342 |
|
| 343 |
`structure Int1: INTEGER` |
| 344 |
|
| 345 |
`structure Int2: INTEGER` |
| 346 |
|
| 347 |
`structure Int3: INTEGER` |
| 348 |
|
| 349 |
`structure Int4: INTEGER` |
| 350 |
|
| 351 |
... |
| 352 |
|
| 353 |
`structure Int31: INTEGER` |
| 354 |
|
| 355 |
`structure Int32: INTEGER` |
| 356 |
|
| 357 |
`structure Int64: INTEGER` |
| 358 |
|
| 359 |
`structure IntArray: MONO_ARRAY` |
| 360 |
|
| 361 |
`structure IntArray2: MONO_ARRAY2` |
| 362 |
|
| 363 |
`structure IntArraySlice: MONO_ARRAY_SLICE` |
| 364 |
|
| 365 |
`structure IntVector: MONO_VECTOR` |
| 366 |
|
| 367 |
`structure IntVectorSlice: MONO_VECTOR_SLICE` |
| 368 |
|
| 369 |
`structure Int8: INTEGER` |
| 370 |
|
| 371 |
`structure Int8Array: MONO_ARRAY` |
| 372 |
|
| 373 |
`structure Int8Array2: MONO_ARRAY2` |
| 374 |
|
| 375 |
`structure Int8ArraySlice: MONO_ARRAY_SLICE` |
| 376 |
|
| 377 |
`structure Int8Vector: MONO_VECTOR` |
| 378 |
|
| 379 |
`structure Int8VectorSlice: MONO_VECTOR_SLICE` |
| 380 |
|
| 381 |
`structure Int16: INTEGER` |
| 382 |
|
| 383 |
`structure Int16Array: MONO_ARRAY` |
| 384 |
|
| 385 |
`structure Int16Array2: MONO_ARRAY2` |
| 386 |
|
| 387 |
`structure Int16ArraySlice: MONO_ARRAY_SLICE` |
| 388 |
|
| 389 |
`structure Int16Vector: MONO_VECTOR` |
| 390 |
|
| 391 |
`structure Int16VectorSlice: MONO_VECTOR_SLICE` |
| 392 |
|
| 393 |
`structure Int32: INTEGER` |
| 394 |
|
| 395 |
`structure Int32Array: MONO_ARRAY` |
| 396 |
|
| 397 |
`structure Int32Array2: MONO_ARRAY2` |
| 398 |
|
| 399 |
`structure Int32ArraySlice: MONO_ARRAY_SLICE` |
| 400 |
|
| 401 |
`structure Int32Vector: MONO_VECTOR` |
| 402 |
|
| 403 |
`structure Int32VectorSlice: MONO_VECTOR_SLICE` |
| 404 |
|
| 405 |
`structure Int64Array: MONO_ARRAY` |
| 406 |
|
| 407 |
`structure Int64Array2: MONO_ARRAY2` |
| 408 |
|
| 409 |
`structure Int64ArraySlice: MONO_ARRAY_SLICE` |
| 410 |
|
| 411 |
`structure Int64Vector: MONO_VECTOR` |
| 412 |
|
| 413 |
`structure Int64VectorSlice: MONO_VECTOR_SLICE` |
| 414 |
|
| 415 |
`structure IntInf: INT_INF` |
| 416 |
|
| 417 |
`structure LargeInt: INTEGER` |
| 418 |
|
| 419 |
`structure LargeIntArray: MONO_ARRAY` |
| 420 |
|
| 421 |
`structure LargeIntArray2: MONO_ARRAY2` |
| 422 |
|
| 423 |
`structure LargeIntArraySlice: MONO_ARRAY_SLICE` |
| 424 |
|
| 425 |
`structure LargeIntVector: MONO_VECTOR` |
| 426 |
|
| 427 |
`structure LargeIntVectorSlice: MONO_VECTOR_SLICE` |
| 428 |
|
| 429 |
`structure LargeReal: REAL` |
| 430 |
|
| 431 |
`structure LargeRealArray: MONO_ARRAY` |
| 432 |
|
| 433 |
`structure LargeRealArray2: MONO_ARRAY2` |
| 434 |
|
| 435 |
`structure LargeRealArraySlice: MONO_ARRAY_SLICE` |
| 436 |
|
| 437 |
`structure LargeRealVector: MONO_VECTOR` |
| 438 |
|
| 439 |
`structure LargeRealVectorSlice: MONO_VECTOR_SLICE` |
| 440 |
|
| 441 |
`structure LargeWord: WORD` |
| 442 |
|
| 443 |
`structure LargeWordArray: MONO_ARRAY` |
| 444 |
|
| 445 |
`structure LargeWordArray2: MONO_ARRAY2` |
| 446 |
|
| 447 |
`structure LargeWordArraySlice: MONO_ARRAY_SLICE` |
| 448 |
|
| 449 |
`structure LargeWordVector: MONO_VECTOR` |
| 450 |
|
| 451 |
`structure LargeWordVectorSlice: MONO_VECTOR_SLICE` |
| 452 |
|
| 453 |
`structure List: LIST` |
| 454 |
|
| 455 |
`structure ListPair: LIST_PAIR` |
| 456 |
|
| 457 |
`structure Math: MATH` |
| 458 |
|
| 459 |
`structure NetHostDB: NET_HOST_DB` |
| 460 |
|
| 461 |
`structure NetProtDB: NET_PROT_DB` |
| 462 |
|
| 463 |
`structure NetServDB: NET_SERV_DB` |
| 464 |
|
| 465 |
`structure OS: OS` |
| 466 |
|
| 467 |
`structure Option: OPTION` |
| 468 |
|
| 469 |
`structure PackReal32Big: PACK_REAL` |
| 470 |
|
| 471 |
`structure PackReal32Little: PACK_REAL` |
| 472 |
|
| 473 |
`structure PackReal64Big: PACK_REAL` |
| 474 |
|
| 475 |
`structure PackReal64Little: PACK_REAL` |
| 476 |
|
| 477 |
`structure PackRealBig: PACK_REAL` |
| 478 |
|
| 479 |
`structure PackRealLittle: PACK_REAL` |
| 480 |
|
| 481 |
`structure PackWord16Big: PACK_WORD` |
| 482 |
|
| 483 |
`structure PackWord16Little: PACK_WORD` |
| 484 |
|
| 485 |
`structure PackWord32Big: PACK_WORD` |
| 486 |
|
| 487 |
`structure PackWord32Little: PACK_WORD` |
| 488 |
|
| 489 |
`structure PackWord64Big: PACK_WORD` |
| 490 |
|
| 491 |
`structure PackWord64Little: PACK_WORD` |
| 492 |
|
| 493 |
`structure Position: INTEGER` |
| 494 |
|
| 495 |
`structure Posix: POSIX` |
| 496 |
|
| 497 |
`structure Real: REAL` |
| 498 |
|
| 499 |
`structure RealArray: MONO_ARRAY` |
| 500 |
|
| 501 |
`structure RealArray2: MONO_ARRAY2` |
| 502 |
|
| 503 |
`structure RealArraySlice: MONO_ARRAY_SLICE` |
| 504 |
|
| 505 |
`structure RealVector: MONO_VECTOR` |
| 506 |
|
| 507 |
`structure RealVectorSlice: MONO_VECTOR_SLICE` |
| 508 |
|
| 509 |
`structure Real32: REAL` |
| 510 |
|
| 511 |
`structure Real32Array: MONO_ARRAY` |
| 512 |
|
| 513 |
`structure Real32Array2: MONO_ARRAY2` |
| 514 |
|
| 515 |
`structure Real32ArraySlice: MONO_ARRAY_SLICE` |
| 516 |
|
| 517 |
`structure Real32Vector: MONO_VECTOR` |
| 518 |
|
| 519 |
`structure Real32VectorSlice: MONO_VECTOR_SLICE` |
| 520 |
|
| 521 |
`structure Real64: REAL` |
| 522 |
|
| 523 |
`structure Real64Array: MONO_ARRAY` |
| 524 |
|
| 525 |
`structure Real64Array2: MONO_ARRAY2` |
| 526 |
|
| 527 |
`structure Real64ArraySlice: MONO_ARRAY_SLICE` |
| 528 |
|
| 529 |
`structure Real64Vector: MONO_VECTOR` |
| 530 |
|
| 531 |
`structure Real64VectorSlice: MONO_VECTOR_SLICE` |
| 532 |
|
| 533 |
`structure Socket: SOCKET` |
| 534 |
|
| 535 |
* The Basis Library specification requires functions like |
| 536 |
`Socket.sendVec` to raise an exception if they fail. However, on some |
| 537 |
platforms, sending to a socket that hasn't yet been connected causes a |
| 538 |
`SIGPIPE` signal, which invokes the default signal handler for |
| 539 |
`SIGPIPE` and causes the program to terminate. If you want the |
| 540 |
exception to be raised, you can ignore `SIGPIPE` by adding the |
| 541 |
following to your program. |
| 542 |
+ |
| 543 |
[source,sml] |
| 544 |
---- |
| 545 |
let |
| 546 |
open MLton.Signal |
| 547 |
in |
| 548 |
setHandler (Posix.Signal.pipe, Handler.ignore) |
| 549 |
end |
| 550 |
---- |
| 551 |
|
| 552 |
`structure String: STRING` |
| 553 |
|
| 554 |
* The `String` functions do not depend on locale. |
| 555 |
|
| 556 |
`structure StringCvt: STRING_CVT` |
| 557 |
|
| 558 |
`structure Substring: SUBSTRING` |
| 559 |
|
| 560 |
`structure SysWord: WORD` |
| 561 |
|
| 562 |
`structure Text: TEXT` |
| 563 |
|
| 564 |
`structure TextIO: TEXT_IO` |
| 565 |
|
| 566 |
`structure TextPrimIO: PRIM_IO` |
| 567 |
|
| 568 |
`structure Time: TIME` |
| 569 |
|
| 570 |
`structure Timer: TIMER` |
| 571 |
|
| 572 |
`structure Unix: UNIX` |
| 573 |
|
| 574 |
`structure UnixSock: UNIX_SOCK` |
| 575 |
|
| 576 |
`structure Vector: VECTOR` |
| 577 |
|
| 578 |
`structure VectorSlice: VECTOR_SLICE` |
| 579 |
|
| 580 |
`structure Word: WORD` |
| 581 |
|
| 582 |
`structure Word1: WORD` |
| 583 |
|
| 584 |
`structure Word2: WORD` |
| 585 |
|
| 586 |
`structure Word3: WORD` |
| 587 |
|
| 588 |
`structure Word4: WORD` |
| 589 |
|
| 590 |
... |
| 591 |
|
| 592 |
`structure Word31: WORD` |
| 593 |
|
| 594 |
`structure Word32: WORD` |
| 595 |
|
| 596 |
`structure Word64: WORD` |
| 597 |
|
| 598 |
`structure WordArray: MONO_ARRAY` |
| 599 |
|
| 600 |
`structure WordArray2: MONO_ARRAY2` |
| 601 |
|
| 602 |
`structure WordArraySlice: MONO_ARRAY_SLICE` |
| 603 |
|
| 604 |
`structure WordVectorSlice: MONO_VECTOR_SLICE` |
| 605 |
|
| 606 |
`structure WordVector: MONO_VECTOR` |
| 607 |
|
| 608 |
`structure Word8Array: MONO_ARRAY` |
| 609 |
|
| 610 |
`structure Word8Array2: MONO_ARRAY2` |
| 611 |
|
| 612 |
`structure Word8ArraySlice: MONO_ARRAY_SLICE` |
| 613 |
|
| 614 |
`structure Word8Vector: MONO_VECTOR` |
| 615 |
|
| 616 |
`structure Word8VectorSlice: MONO_VECTOR_SLICE` |
| 617 |
|
| 618 |
`structure Word16Array: MONO_ARRAY` |
| 619 |
|
| 620 |
`structure Word16Array2: MONO_ARRAY2` |
| 621 |
|
| 622 |
`structure Word16ArraySlice: MONO_ARRAY_SLICE` |
| 623 |
|
| 624 |
`structure Word16Vector: MONO_VECTOR` |
| 625 |
|
| 626 |
`structure Word16VectorSlice: MONO_VECTOR_SLICE` |
| 627 |
|
| 628 |
`structure Word32Array: MONO_ARRAY` |
| 629 |
|
| 630 |
`structure Word32Array2: MONO_ARRAY2` |
| 631 |
|
| 632 |
`structure Word32ArraySlice: MONO_ARRAY_SLICE` |
| 633 |
|
| 634 |
`structure Word32Vector: MONO_VECTOR` |
| 635 |
|
| 636 |
`structure Word32VectorSlice: MONO_VECTOR_SLICE` |
| 637 |
|
| 638 |
`structure Word64Array: MONO_ARRAY` |
| 639 |
|
| 640 |
`structure Word64Array2: MONO_ARRAY2` |
| 641 |
|
| 642 |
`structure Word64ArraySlice: MONO_ARRAY_SLICE` |
| 643 |
|
| 644 |
`structure Word64Vector: MONO_VECTOR` |
| 645 |
|
| 646 |
`structure Word64VectorSlice: MONO_VECTOR_SLICE` |
| 647 |
|
| 648 |
== Top-level functors |
| 649 |
|
| 650 |
`ImperativeIO` |
| 651 |
|
| 652 |
`PrimIO` |
| 653 |
|
| 654 |
`StreamIO` |
| 655 |
|
| 656 |
* MLton's `StreamIO` functor takes structures `ArraySlice` and |
| 657 |
`VectorSlice` in addition to the arguments specified in the Basis |
| 658 |
Library specification. |
| 659 |
|
| 660 |
== Type equivalences |
| 661 |
|
| 662 |
The following types are equivalent. |
| 663 |
---- |
| 664 |
FixedInt = Int64.int |
| 665 |
LargeInt = IntInf.int |
| 666 |
LargeReal.real = Real64.real |
| 667 |
LargeWord = Word64.word |
| 668 |
---- |
| 669 |
|
| 670 |
The default `int`, `real`, and `word` types may be set by the |
| 671 |
``-default-type __type__`` <<CompileTimeOptions#,compile-time option>>. |
| 672 |
By default, the following types are equivalent: |
| 673 |
---- |
| 674 |
int = Int.int = Int32.int |
| 675 |
real = Real.real = Real64.real |
| 676 |
word = Word.word = Word32.word |
| 677 |
---- |
| 678 |
|
| 679 |
== Real and Math functions |
| 680 |
|
| 681 |
The `Real`, `Real32`, and `Real64` modules are implemented |
| 682 |
using the `C` math library, so the SML functions will reflect the |
| 683 |
behavior of the underlying library function. We have made some effort |
| 684 |
to unify the differences between the math libraries on different |
| 685 |
platforms, and in particular to handle exceptional cases according to |
| 686 |
the Basis Library specification. However, there will be differences |
| 687 |
due to different numerical algorithms and cases we may have missed. |
| 688 |
Please submit a <<Bug#,bug report>> if you encounter an error in |
| 689 |
the handling of an exceptional case. |
| 690 |
|
| 691 |
On x86, real arithmetic is implemented internally using 80 bits of |
| 692 |
precision. Using higher precision for intermediate results in |
| 693 |
computations can lead to different results than if all the computation |
| 694 |
is done at 32 or 64 bits. If you require strict IEEE compliance, you |
| 695 |
can compile with `-ieee-fp true`, which will cause intermediate |
| 696 |
results to be stored after each operation. This may cause a |
| 697 |
substantial performance penalty. |