hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit e34b4c6eb9f4b2c598bbca6b40c12ee8e3e5fee1
parent 9761fd06e2d4cd37ea1ff6a1b7e877c2bcd39ee5
Author: Sebastian <sebastian@sebsite.pw>
Date:   Tue, 22 Feb 2022 18:49:21 -0500

fs: move strerror from util.ha to types.ha

This is more consistent with where other modules place their strerror
functions.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mfs/types.ha | 18++++++++++++++++++
Mfs/util.ha | 18------------------
2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/fs/types.ha b/fs/types.ha @@ -30,6 +30,24 @@ export type error = !( cannotrename | io::error); +// Returns a human-friendly representation of an error. +export fn strerror(err: error) const str = match (err) { +case wrongtype => + yield "Wrong entry type for requested operation"; +case cannotrename => + yield "Unable to perform rename operation (try move instead)"; +case errors::noentry => + yield "File or directory not found"; +case errors::noaccess => + yield "Permission denied"; +case errors::exists => + yield "File or directory exists"; +case errors::invalid => + yield "Invalid argument"; +case let err: io::error => + yield io::strerror(err); +}; + // File mode information. These bits do not necessarily reflect the underlying // operating system's mode representation, though they were chosen to be // consistent with typical Unix file permissions. All implementations shall diff --git a/fs/util.ha b/fs/util.ha @@ -8,24 +8,6 @@ use io; use path; use strings; -// Returns a human-friendly representation of an error. -export fn strerror(err: error) const str = match (err) { -case wrongtype => - yield "Wrong entry type for requested operation"; -case cannotrename => - yield "Unable to perform rename operation (try move instead)"; -case errors::noentry => - yield "File or directory not found"; -case errors::noaccess => - yield "Permission denied"; -case errors::exists => - yield "File or directory exists"; -case errors::invalid => - yield "Invalid argument"; -case let err: io::error => - yield io::strerror(err); -}; - // Converts a mode into a Unix-like mode string (e.g. "-rw-r--r--"). The string // is statically allocated, use [[strings::dup]] to duplicate it or it will be // overwritten on subsequent calls.