From df86da4200cc4fe5e565f73dda4efef19d3da486 Mon Sep 17 00:00:00 2001 From: Oscar Spencer Date: Thu, 28 Mar 2024 12:23:03 -0500 Subject: [PATCH] chore: Remove old sys modules markdown (#364) --- src/stdlib/sys/file.md | 953 -------------------------------------- src/stdlib/sys/process.md | 141 ------ src/stdlib/sys/random.md | 66 --- src/stdlib/sys/time.md | 74 --- 4 files changed, 1234 deletions(-) delete mode 100644 src/stdlib/sys/file.md delete mode 100644 src/stdlib/sys/process.md delete mode 100644 src/stdlib/sys/random.md delete mode 100644 src/stdlib/sys/time.md diff --git a/src/stdlib/sys/file.md b/src/stdlib/sys/file.md deleted file mode 100644 index 1e6eebd5..00000000 --- a/src/stdlib/sys/file.md +++ /dev/null @@ -1,953 +0,0 @@ ---- -title: File ---- - -Utilities for accessing the filesystem & working with files. - -Many of the functions in this module are not intended to be used directly, but rather for other libraries to be built on top of them. - -```grain -import File from "sys/file" -``` - -## Types - -Type declarations included in the File module. - -### File.**FileDescriptor** - -```grain -enum FileDescriptor { - FileDescriptor(Number), -} -``` - -Represents a handle to an open file on the system. - -### File.**LookupFlag** - -```grain -enum LookupFlag { - SymlinkFollow, -} -``` - -Flags that determine how paths should be resolved when looking up a file or directory. - -### File.**OpenFlag** - -```grain -enum OpenFlag { - Create, - Directory, - Exclusive, - Truncate, -} -``` - -Flags that determine how a file or directory should be opened. - -### File.**Rights** - -```grain -enum Rights { - FdDatasync, - FdRead, - FdSeek, - FdSetFlags, - FdSync, - FdTell, - FdWrite, - FdAdvise, - FdAllocate, - PathCreateDirectory, - PathCreateFile, - PathLinkSource, - PathLinkTarget, - PathOpen, - FdReaddir, - PathReadlink, - PathRenameSource, - PathRenameTarget, - PathFilestats, - PathSetSize, - PathSetTimes, - FdFilestats, - FdSetSize, - FdSetTimes, - PathSymlink, - PathRemoveDirectory, - PathUnlinkFile, - PollFdReadwrite, - SockShutdown, -} -``` - -Flags that determine which rights a `FileDescriptor` should have -and which rights new `FileDescriptor`s should inherit from it. - -### File.**FdFlag** - -```grain -enum FdFlag { - Append, - Dsync, - Nonblock, - Rsync, - Sync, -} -``` - -Flags that determine the mode(s) that a `FileDescriptor` operates in. - -### File.**Filetype** - -```grain -enum Filetype { - Unknown, - BlockDevice, - CharacterDevice, - Directory, - RegularFile, - SocketDatagram, - SocketStream, - SymbolicLink, -} -``` - -The type of file a `FileDescriptor` refers to. - -### File.**Whence** - -```grain -enum Whence { - Set, - Current, - End, -} -``` - -Flags that determine where seeking should begin in a file. - -### File.**Stats** - -```grain -record Stats { - filetype: Filetype, - flags: List, - rights: List, - rightsInheriting: List, -} -``` - -Information about a `FileDescriptor`. - -### File.**Filestats** - -```grain -record Filestats { - device: Int64, - inode: Int64, - filetype: Filetype, - linkcount: Int64, - size: Int64, - accessed: Int64, - modified: Int64, - changed: Int64, -} -``` - -Information about the file that a `FileDescriptor` refers to. - -### File.**DirectoryEntry** - -```grain -record DirectoryEntry { - inode: Int64, - filetype: Filetype, - path: String, -} -``` - -An entry in a directory. - -## Values - -Functions and constants included in the File module. - -### File.**stdin** - -```grain -stdin : FileDescriptor -``` - -The `FileDescriptor` for `stdin`. - -### File.**stdout** - -```grain -stdout : FileDescriptor -``` - -The `FileDescriptor` for `stdout`. - -### File.**stderr** - -```grain -stderr : FileDescriptor -``` - -The `FileDescriptor` for `stderr`. - -### File.**pwdfd** - -```grain -pwdfd : FileDescriptor -``` - -The `FileDescriptor` for the current working directory of the process. - -### File.**pathOpen** - -```grain -pathOpen : - (FileDescriptor, List, String, List, List, - List, List) -> Result -``` - -Open a file or directory. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`dirFd`|`FileDescriptor`|The directory in which path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`path`|`String`|The path to the file or directory| -|`openFlags`|`List`|Flags that decide how the path will be opened| -|`rights`|`List`|The rights that dictate what may be done with the returned file descriptor| -|`rightsInheriting`|`List`|The rights that dictate what may be done with file descriptors derived from this file descriptor| -|`flags`|`List`|Flags which affect read/write operations on this file descriptor| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(fd)` of the opened file or directory if successful or `Err(exception)` otherwise| - -### File.**fdRead** - -```grain -fdRead : (FileDescriptor, Number) -> Result<(String, Number), Exception> -``` - -Read from a file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to read from| -|`size`|`Number`|The maximum number of bytes to read from the file descriptor| - -Returns: - -|type|description| -|----|-----------| -|`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of bytes read and the number of bytes read if successful or `Err(exception)` otherwise| - -### File.**fdPread** - -```grain -fdPread : - (FileDescriptor, Int64, Number) -> Result<(String, Number), Exception> -``` - -Read from a file descriptor without updating the file descriptor's offset. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to read from| -|`offset`|`Int64`|The position within the file to begin reading| -|`size`|`Number`|The maximum number of bytes to read from the file descriptor| - -Returns: - -|type|description| -|----|-----------| -|`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of bytes read and the number of bytes read if successful or `Err(exception)` otherwise| - -### File.**fdWrite** - -```grain -fdWrite : (FileDescriptor, String) -> Result -``` - -Write to a file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to which data will be written| -|`data`|`String`|The data to be written| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(numBytes)` of the number of bytes written if successful or `Err(Exception)` otherwise| - -### File.**fdPwrite** - -```grain -fdPwrite : (FileDescriptor, String, Int64) -> Result -``` - -Write to a file descriptor without updating the file descriptor's offset. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to which data will be written| -|`data`|`String`|The data to be written| -|`offset`|`Int64`|The position within the file to begin writing| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(numBytes)` of the number of bytes written if successful or `Err(exception)` otherwise| - -### File.**fdAllocate** - -```grain -fdAllocate : (FileDescriptor, Int64, Int64) -> Result -``` - -Allocate space within a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor in which space will be allocated| -|`offset`|`Int64`|The position within the file to begin writing| -|`size`|`Int64`|The number of bytes to allocate| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdClose** - -```grain -fdClose : FileDescriptor -> Result -``` - -Close a file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to close| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdDatasync** - -```grain -fdDatasync : FileDescriptor -> Result -``` - -Synchronize the data of a file to disk. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to synchronize| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSync** - -```grain -fdSync : FileDescriptor -> Result -``` - -Synchronize the data and metadata of a file to disk. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to synchronize| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdStats** - -```grain -fdStats : FileDescriptor -> Result -``` - -Retrieve information about a file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of which to retrieve information| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(stats)` of the `Stats` associated with the file descriptor if successful or `Err(exception)` otherwise| - -### File.**fdSetFlags** - -```grain -fdSetFlags : (FileDescriptor, List) -> Result -``` - -Update the flags associated with a file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to update flags| -|`flags`|`List`|The flags to apply to the file descriptor| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSetRights** - -```grain -fdSetRights : - (FileDescriptor, List, List) -> Result -``` - -Update the rights associated with a file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to update rights| -|`rights`|`List`|Rights to apply to the file descriptor| -|`rightsInheriting`|`List`|Inheriting rights to apply to the file descriptor| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdFilestats** - -```grain -fdFilestats : FileDescriptor -> Result -``` - -Retrieve information about a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the file to retrieve information| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(info)` of the `Filestats` associated with the file descriptor if successful or `Err(exception)` otherwise| - -### File.**fdSetSize** - -```grain -fdSetSize : (FileDescriptor, Int64) -> Result -``` - -Set (truncate) the size of a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the file to truncate| -|`size`|`Int64`|The number of bytes to retain in the file| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSetAccessTime** - -```grain -fdSetAccessTime : (FileDescriptor, Int64) -> Result -``` - -Set the access (created) time of a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the file to update| -|`timestamp`|`Int64`|The time to set| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSetAccessTimeNow** - -```grain -fdSetAccessTimeNow : FileDescriptor -> Result -``` - -Set the access (created) time of a file to the current time. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the file to update| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSetModifiedTime** - -```grain -fdSetModifiedTime : (FileDescriptor, Int64) -> Result -``` - -Set the modified time of a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the file to update| -|`timestamp`|`Int64`|The time to set| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSetModifiedTimeNow** - -```grain -fdSetModifiedTimeNow : FileDescriptor -> Result -``` - -Set the modified time of a file to the current time. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the file to update| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdReaddir** - -```grain -fdReaddir : FileDescriptor -> Result, Exception> -``` - -Read the entires of a directory. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The directory to read| - -Returns: - -|type|description| -|----|-----------| -|`Result, Exception>`|`Ok(dirEntries)` of an array of `DirectoryEntry` for each entry in the directory if successful or `Err(exception)` otherwise| - -### File.**fdRenumber** - -```grain -fdRenumber : (FileDescriptor, FileDescriptor) -> Result -``` - -Atomically replace a file descriptor by renumbering another file descriptor. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fromFd`|`FileDescriptor`|The file descriptor to renumber| -|`toFd`|`FileDescriptor`|The file descriptor to overwrite| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**fdSeek** - -```grain -fdSeek : (FileDescriptor, Int64, Whence) -> Result -``` - -Update a file descriptor's offset. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to operate on| -|`offset`|`Int64`|The number of bytes to move the offset| -|`whence`|`Whence`|The location from which the offset is relative| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(offset)` of the new offset of the file descriptor, relative to the start of the file, if successful or `Err(exception)` otherwise| - -### File.**fdTell** - -```grain -fdTell : FileDescriptor -> Result -``` - -Read a file descriptor's offset. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor to read the offset| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(offset)` of the offset of the file descriptor, relative to the start of the file, if successful or `Err(exception)` otherwise| - -### File.**pathCreateDirectory** - -```grain -pathCreateDirectory : (FileDescriptor, String) -> Result -``` - -Create a directory. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`path`|`String`|The path to the new directory| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathFilestats** - -```grain -pathFilestats : - (FileDescriptor, List, String) -> Result -``` - -Retrieve information about a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`path`|`String`|The path to retrieve information about| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(info)` of the `Filestats` associated with the file descriptor if successful or `Err(exception)` otherwise| - -### File.**pathSetAccessTime** - -```grain -pathSetAccessTime : - (FileDescriptor, List, String, Int64) -> - Result -``` - -Set the access (created) time of a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`path`|`String`|The path to set the time| -|`timestamp`|`Int64`|The time to set| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathSetAccessTimeNow** - -```grain -pathSetAccessTimeNow : - (FileDescriptor, List, String) -> Result -``` - -Set the access (created) time of a file to the current time. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`path`|`String`|The path to set the time| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathSetModifiedTime** - -```grain -pathSetModifiedTime : - (FileDescriptor, List, String, Int64) -> - Result -``` - -Set the modified time of a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`path`|`String`|The path to set the time| -|`timestamp`|`Int64`|The time to set| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathSetModifiedTimeNow** - -```grain -pathSetModifiedTimeNow : - (FileDescriptor, List, String) -> Result -``` - -Set the modified time of a file to the current time. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`path`|`String`|The path to set the time| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathLink** - -```grain -pathLink : - (FileDescriptor, List, String, FileDescriptor, String) -> - Result -``` - -Create a hard link. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`sourceFd`|`FileDescriptor`|The file descriptor of the directory in which the source path resolution starts| -|`dirFlags`|`List`|Flags which affect path resolution| -|`sourcePath`|`String`|The path to the source of the link| -|`targetFd`|`FileDescriptor`|The file descriptor of the directory in which the target path resolution starts| -|`targetPath`|`String`|The path to the target of the link| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathSymlink** - -```grain -pathSymlink : (FileDescriptor, String, String) -> Result -``` - -Create a symlink. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`sourcePath`|`String`|The path to the source of the link| -|`targetPath`|`String`|The path to the target of the link| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathUnlink** - -```grain -pathUnlink : (FileDescriptor, String) -> Result -``` - -Unlink a file. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`path`|`String`|The path of the file to unlink| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathReadlink** - -```grain -pathReadlink : - (FileDescriptor, String, Number) -> Result<(String, Number), Exception> -``` - -Read the contents of a symbolic link. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`path`|`String`|The path to the symlink| -|`size`|`Number`|The number of bytes to read| - -Returns: - -|type|description| -|----|-----------| -|`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of the bytes read and the number of bytes read if successful or `Err(exception)` otherwise| - -### File.**pathRemoveDirectory** - -```grain -pathRemoveDirectory : (FileDescriptor, String) -> Result -``` - -Remove a directory. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`fd`|`FileDescriptor`|The file descriptor of the directory in which path resolution starts| -|`path`|`String`|The path to the directory to remove| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### File.**pathRename** - -```grain -pathRename : - (FileDescriptor, String, FileDescriptor, String) -> Result -``` - -Rename a file or directory. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`sourceFd`|`FileDescriptor`|The file descriptor of the directory in which the source path resolution starts| -|`sourcePath`|`String`|The path of the file to rename| -|`targetFd`|`FileDescriptor`|The file descriptor of the directory in which the target path resolution starts| -|`targetPath`|`String`|The new path of the file| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - diff --git a/src/stdlib/sys/process.md b/src/stdlib/sys/process.md deleted file mode 100644 index 6be32e73..00000000 --- a/src/stdlib/sys/process.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Process ---- - -Utilities for accessing functionality and information about the Grain program's process. - -This includes things like accessing environment variables and sending signals. - -```grain -import Process from "sys/process" -``` - -## Types - -Type declarations included in the Process module. - -### Process.**Signal** - -```grain -enum Signal { - HUP, - INT, - QUIT, - ILL, - TRAP, - ABRT, - BUS, - FPE, - KILL, - USR1, - SEGV, - USR2, - PIPE, - ALRM, - TERM, - CHLD, - CONT, - STOP, - TSTP, - TTIN, - TTOU, - URG, - XCPU, - XFSZ, - VTALRM, - PROF, - WINCH, - POLL, - PWR, - SYS, -} -``` - -Signals that can be sent to the host system. - -## Values - -Functions and constants included in the Process module. - -### Process.**argv** - -```grain -argv : () -> Result, Exception> -``` - -Access command line arguments. - -Returns: - -|type|description| -|----|-----------| -|`Result, Exception>`|`Ok(args)` of an array containing positional string arguments to the process if successful or `Err(exception)` otherwise| - -### Process.**env** - -```grain -env : () -> Result, Exception> -``` - -Access environment variables. - -Returns: - -|type|description| -|----|-----------| -|`Result, Exception>`|`Ok(vars)` of an array containing environment variables supplied to the process if successful or `Err(exception)` otherwise| - -### Process.**exit** - -```grain -exit : Number -> Result -``` - -Terminate the process normally. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`code`|`Number`|The value to exit with. An exit code of 0 is considered normal, with other values having meaning depending on the platform| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Err(exception)` if unsuccessful. Will not actually return a value if successful, as the process has ended| - -### Process.**sigRaise** - -```grain -sigRaise : Signal -> Result -``` - -Send a signal to the process of the calling thread. - -Parameters: - -|param|type|description| -|-----|----|-----------| -|`signal`|`Signal`|The signal to send| - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - -### Process.**schedYield** - -```grain -schedYield : () -> Result -``` - -Yield execution to the calling thread. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(void)` if successful or `Err(exception)` otherwise| - diff --git a/src/stdlib/sys/random.md b/src/stdlib/sys/random.md deleted file mode 100644 index e03cd461..00000000 --- a/src/stdlib/sys/random.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Random ---- - -System access to random values. - -```grain -import Random from "sys/random" -``` - -## Values - -Functions and constants included in the Random module. - -### Random.**randomInt32** - -
-Added in 0.5.0 -No other changes yet. -
- -```grain -randomInt32 : () -> Result -``` - -Produce a random 32-bit integer. This function can be slow, so it's best to seed a generator if lots of random data is needed. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(num)` of a random Int32 if successful or `Err(exception)` otherwise| - -### Random.**randomInt64** - -
-Added in 0.5.0 -No other changes yet. -
- -```grain -randomInt64 : () -> Result -``` - -Produce a random 64-bit integer. This function can be slow, so it's best to seed a generator if lots of random data is needed. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(num)` of a random Int64 if successful or `Err(exception)` otherwise| - -### Random.**random** - -```grain -random : () -> Result -``` - -Produce a random number. This function can be slow, so it's best to seed a generator if lots of random data is needed. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(num)` of a random number if successful or `Err(exception)` otherwise| - diff --git a/src/stdlib/sys/time.md b/src/stdlib/sys/time.md deleted file mode 100644 index 6d1f9645..00000000 --- a/src/stdlib/sys/time.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Time ---- - -Access to system clocks. - -```grain -import Time from "sys/time" -``` - -## Values - -Functions and constants included in the Time module. - -### Time.**realTime** - -```grain -realTime : () -> Result -``` - -Get the current time, in nanoseconds. -Time value 0 corresponds with 1970-01-01T00:00:00Z. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(time)` of the current time if successful or `Err(exception)` otherwise| - -### Time.**monotonicTime** - -```grain -monotonicTime : () -> Result -``` - -Get the time of the system's high-resolution clock, in nanoseconds. -This system clock cannot be adjusted and cannot have negative time jumps. -The epoch of this clock is undefined, and thus time value 0 is meaningless. -Useful for calculation of precise time intervals. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(time)` of the current time if successful or `Err(exception)` otherwise| - -### Time.**processCpuTime** - -```grain -processCpuTime : () -> Result -``` - -Get the number of nanoseconds elapsed since the process began. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(elapsed)` of the elapsed nanoseconds if successful or `Err(exception)` otherwise| - -### Time.**threadCpuTime** - -```grain -threadCpuTime : () -> Result -``` - -Get the number of nanoseconds elapsed since the thread began. - -Returns: - -|type|description| -|----|-----------| -|`Result`|`Ok(elapsed)` of the elapsed nanoseconds if successful or `Err(exception)` otherwise| -