shithub: mc

Download patch

ref: 4c94aae21c2c2aec19d4fd5871cfe92bc09303a7
parent: dbe9ae0f9dbed30d40952261384b4673766d83ca
author: Ori Bernstein <[email protected]>
date: Sat Jan 27 07:22:19 EST 2018

Remove std.sleq

	We have std.eq. We still export a generic sleq for
	compatibility, but we don't need it or want it.

--- a/lib/crypto/test/aes.myr
+++ b/lib/crypto/test/aes.myr
@@ -40,7 +40,7 @@
 
 	crypto.aeskeysched(&ctx, t.key)
 	crypto.aesencrypt(&ctx, t.inp[:], out[:])
-	if !std.sleq(out[:], t.out[:])
+	if !std.eq(out[:], t.out[:])
 		std.fatal("test failed: got {r}, expected {r}\n", out[:], t.out[:])
 	;;
 }
@@ -51,7 +51,7 @@
 
 	crypto.aeskeysched(&ctx, t.key)
 	crypto.aesdecrypt(&ctx, t.inp[:], out[:])
-	if !std.sleq(out[:], t.out[:])
+	if !std.eq(out[:], t.out[:])
 		std.fatal("test failed: got {r}, expected {r}\n", out[:], t.out[:])
 	;;
 }
@@ -61,7 +61,7 @@
 
 	crypto.aeskeysched(&ctx, t.key)
 	crypto.aesencrypt(&ctx, t.inp[:], out[:])
-	if !std.sleq(out[:], t.out[:])
+	if !std.eq(out[:], t.out[:])
 		std.fatal("test failed: got {r}, expected {r}\n", out[:], t.out[:])
 	;;
 }
@@ -72,7 +72,7 @@
 
 	crypto.aeskeysched(&ctx, t.key)
 	crypto.aesdecrypt(&ctx, t.inp[:], out[:])
-	if !std.sleq(out[:], t.out[:])
+	if !std.eq(out[:], t.out[:])
 		std.fatal("test failed: got {r}, expected {r}\n", out[:], t.out[:])
 	;;
 }
--- a/lib/crypto/test/chacha20.myr
+++ b/lib/crypto/test/chacha20.myr
@@ -854,9 +854,9 @@
 	;;
 
 	crypto.chacha20encrypt(&st, data[:], result[:])
-	std.assert(std.sleq(result[:], chk.stream0), "mismatched stream0")
+	std.assert(std.eq(result[:], chk.stream0), "mismatched stream0")
 
 	crypto.chacha20encrypt(&st, data[:], result[:])
-	std.assert(std.sleq(result[:], chk.stream1), "mismatched stream1")
+	std.assert(std.eq(result[:], chk.stream1), "mismatched stream1")
 }
 
--- a/lib/crypto/test/md5.myr
+++ b/lib/crypto/test/md5.myr
@@ -22,7 +22,7 @@
 		std.sbfmt(sb, "{p=0,w=2,x}", x)
 	;;
 	str = std.sbfin(sb)
-	if (!std.sleq(str, expected))
+	if (!std.eq(str, expected))
 		std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
 	;;
 	std.slfree(str)
--- a/lib/crypto/test/sha1.myr
+++ b/lib/crypto/test/sha1.myr
@@ -22,7 +22,7 @@
 		std.sbfmt(sb, "{p=0,w=2,x}", x)
 	;;
 	str = std.sbfin(sb)
-	if (!std.sleq(str, expected))
+	if (!std.eq(str, expected))
 		std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
 	;;
 	std.slfree(str)
--- a/lib/crypto/test/sha256.myr
+++ b/lib/crypto/test/sha256.myr
@@ -33,7 +33,7 @@
 		std.sbfmt(sb, "{p=0,w=2,x}", x)
 	;;
 	str = std.sbfin(sb)
-	if (!std.sleq(str, expected))
+	if (!std.eq(str, expected))
 		std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
 	;;
 	std.slfree(str)
--- a/lib/crypto/test/sha3.myr
+++ b/lib/crypto/test/sha3.myr
@@ -9,7 +9,7 @@
 
 			ret = crypto.keccak224("")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\xf7\x18\x37\x50\x2b\xa8\xe1\x08\x37\xbd\xd8\xd3\x65\xad" \
 					"\xb8\x55\x91\x89\x56\x02\xfc\x55\x2b\x48\xb7\x39\x0a\xbd"), \
@@ -20,7 +20,7 @@
 
 			ret = crypto.keccak256("")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\xC5\xD2\x46\x01\x86\xF7\x23\x3C\x92\x7E\x7D\xB2\xDC\xC7\x03\xC0" \
 					"\xE5\x00\xB6\x53\xCA\x82\x27\x3B\x7B\xFA\xD8\x04\x5D\x85\xA4\x70"), \
@@ -31,7 +31,7 @@
 
 			ret = crypto.keccak384("")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\x2C\x23\x14\x6A\x63\xA2\x9A\xCF" \
 					"\x99\xE7\x3B\x88\xF8\xC2\x4E\xAA" \
@@ -46,7 +46,7 @@
 
 			ret = crypto.keccak512("")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\x0E\xAB\x42\xDE\x4C\x3C\xEB\x92" \
 					"\x35\xFC\x91\xAC\xFF\xE7\x46\xB2" \
@@ -64,7 +64,7 @@
 
 			ret = crypto.keccak224("Keccak-224 Test Hash")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\x30\x04\x5B\x34\x94\x6E\x1B\x2E\x09\x16\x13\x36\x2F\xD2" \
 					"\x2A\xA0\x8E\x2B\xEA\xFE\xC5\xE8\xDA\xEE\x42\xC2\xE6\x65"), \
@@ -75,7 +75,7 @@
 
 			ret = crypto.keccak256("Keccak-256 Test Hash")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\xA8\xD7\x1B\x07\xF4\xAF\x26\xA4\xFF\x21\x02\x7F\x62\xFF\x60\x26"  \
 					"\x7F\xF9\x55\xC9\x63\xF0\x42\xC4\x6D\xA5\x2E\xE3\xCF\xAF\x3D\x3C"), \
@@ -86,7 +86,7 @@
 
 			ret = crypto.keccak384("Keccak-384 Test Hash")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\xE2\x13\xFD\x74\xAF\x0C\x5F\xF9" \
 					"\x1B\x42\x3C\x8B\xCE\xEC\xD7\x01" \
@@ -101,7 +101,7 @@
 
 			ret = crypto.keccak512("Keccak-512 Test Hash")
 			testr.check(ctx, \
-				std.sleq(\
+				std.eq(\
 					ret[:],  \
 					"\x96\xEE\x47\x18\xDC\xBA\x3C\x74" \
 					"\x61\x9B\xA1\xFA\x7F\x57\xDF\xE7" \
--- a/lib/crypto/test/sha512.myr
+++ b/lib/crypto/test/sha512.myr
@@ -34,7 +34,7 @@
 		std.sbfmt(sb, "{p=0,w=2,x}", x)
 	;;
 	str = std.sbfin(sb)
-	if (!std.sleq(str, expected))
+	if (!std.eq(str, expected))
 		std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
 	;;
 	std.slfree(str)
--- a/lib/crypto/util.myr
+++ b/lib/crypto/util.myr
@@ -12,7 +12,7 @@
 		std.sbfmt(sb, "{p=0,w=2,x}", x)
 	;;
 	str = std.sbfin(sb)
-	if (!std.sleq(str, expected))
+	if (!std.eq(str, expected))
 		std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
 	;;
 	std.slfree(str)
--- a/lib/date/parse.myr
+++ b/lib/date/parse.myr
@@ -182,9 +182,9 @@
 		err# = `std.Some `Badzone s
 		-> ""
 	;;
-	if std.sleq(s[:1], "-")
+	if std.eq(s[:1], "-")
 		sgn = -1
-	elif std.sleq(s[:1], "+") 
+	elif std.eq(s[:1], "+") 
 		sgn = 1
 	else
 		err# = `std.Some `Badzone s
@@ -216,7 +216,7 @@
 
 
 const matchstr = {s, str, err
-	if s.len <= str.len || !std.sleq(s[:str.len], str)
+	if s.len <= str.len || !std.eq(s[:str.len], str)
 		err# = `std.Some `Badchar
 		-> s
 	;;
@@ -228,10 +228,10 @@
 		err# = `std.Some `Badampm
 		-> s
 	;;
-	if std.sleq(s[:2], "am") || std.sleq(s[:2], "AM")
+	if std.eq(s[:2], "am") || std.eq(s[:2], "AM")
 		am# = `std.Some true
 		-> s[2:]
-	elif std.sleq(s[:2], "pm") || std.sleq(s[:2], "PM")
+	elif std.eq(s[:2], "pm") || std.eq(s[:2], "PM")
 		am# = `std.Some false
 		-> s[2:]
 	else
--- a/lib/date/test/fmt.myr
+++ b/lib/date/test/fmt.myr
@@ -88,7 +88,7 @@
 }
 
 const eq = {expected, actual
-	if !std.sleq(expected, actual)
+	if !std.eq(expected, actual)
 		std.fatal("expected date {}, got {}\n", expected, actual)
 	;;
 }
--- a/lib/date/test/parse.myr
+++ b/lib/date/test/parse.myr
@@ -49,7 +49,7 @@
 }
 
 const eq = {actual, expected
-	if !std.sleq(expected, actual)
+	if !std.eq(expected, actual)
 		std.fatal("expected date {}, got {}\n", expected, actual)
 	;;
 }
--- a/lib/date/zoneinfo+posixy.myr
+++ b/lib/date/zoneinfo+posixy.myr
@@ -50,9 +50,9 @@
 		zone = z
 	| `std.None:
 		/* load zone */
-		if std.sleq(tz, "") || std.sleq(tz, "UTC")
+		if std.eq(tz, "") || std.eq(tz, "UTC")
 			-> `std.Some 0
-		elif std.sleq(tz, "local")
+		elif std.eq(tz, "local")
 			path = std.sldup("/etc/localtime")
 		else
 			path = ""
--- a/lib/escfmt/test/eschtml.myr
+++ b/lib/escfmt/test/eschtml.myr
@@ -6,22 +6,22 @@
 	testr.run([\
 		[.name="nop", .fn={ctx
 			var s = std.fmt("{}", escfmt.html("word"))
-			testr.check(ctx, std.sleq("word", s), "mismatched escape")
+			testr.check(ctx, std.eq("word", s), "mismatched escape")
 			std.slfree(s)
 		}],
 		[.name="twowords", .fn={ctx
 			var s = std.fmt("{}", escfmt.html("spaced word"))
-			testr.check(ctx, std.sleq("spaced word", s), "mismatched escape")
+			testr.check(ctx, std.eq("spaced word", s), "mismatched escape")
 			std.slfree(s)
 		}],
 		[.name="quoted", .fn={ctx
 			var s = std.fmt("{}", escfmt.html("<stuff>&nbsp;</stuff>"))
-			testr.check(ctx, std.sleq("&lt;stuff&gt;&amp;nbsp;&lt;&#x2f;stuff&gt;", s), std.fmt("mismatched escape {}", s))
+			testr.check(ctx, std.eq("&lt;stuff&gt;&amp;nbsp;&lt;&#x2f;stuff&gt;", s), std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
 		[.name="doublequoted", .fn={ctx
 			var s = std.fmt("{}", escfmt.html("&lt;stuff&gt;&amp;nbsp;&lt;&#x2f;stuff&gt;"))
-			testr.check(ctx, std.sleq("&amp;lt;stuff&amp;gt;&amp;amp;nbsp;&amp;lt;&amp;#x2f;stuff&amp;gt;", s), std.fmt("mismatched escape {}", s))
+			testr.check(ctx, std.eq("&amp;lt;stuff&amp;gt;&amp;amp;nbsp;&amp;lt;&amp;#x2f;stuff&amp;gt;", s), std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
 	][:])
--- a/lib/escfmt/test/escre.myr
+++ b/lib/escfmt/test/escre.myr
@@ -6,13 +6,13 @@
 	testr.run([\
 		[.name="unchanged", .fn={ctx
 			var s = std.fmt("{}", escfmt.url("word"))
-			testr.check(ctx, std.sleq("word", s), std.fmt("mismatched escape {}", s))
+			testr.check(ctx, std.eq("word", s), std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
 		[.name="randomcrud", .fn={ctx
 			var s = std.fmt("{}", escfmt.re("^:/?#[]@!$&'()*+,;=%"))
 			testr.check(ctx, \
-				std.sleq("\\^:/\\?#\\[\\]@!\\$&'\\(\\)\\*\\+,;=%", s), \
+				std.eq("\\^:/\\?#\\[\\]@!\\$&'\\(\\)\\*\\+,;=%", s), \
 				std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
--- a/lib/escfmt/test/escsh.myr
+++ b/lib/escfmt/test/escsh.myr
@@ -6,22 +6,22 @@
 	testr.run([
 		[.name="basic", .fn={ctx
 			var s = std.fmt("{}", escfmt.sh("word"))
-			testr.check(ctx, std.sleq("'word'", s), "mismatched escape")
+			testr.check(ctx, std.eq("'word'", s), "mismatched escape")
 			std.slfree(s)
 		}],
 		[.name="twowords", .fn={ctx
 			var s = std.fmt("{}", escfmt.sh("two words"))
-			testr.check(ctx, std.sleq("'two words'", s), "mismatched escape")
+			testr.check(ctx, std.eq("'two words'", s), "mismatched escape")
 			std.slfree(s)
 		}],
 		[.name="simplequote", .fn={ctx
 			var s = std.fmt("{}", escfmt.sh("two'words"))
-			testr.check(ctx, std.sleq("'two'\\''words'", s), "mismatched escape")
+			testr.check(ctx, std.eq("'two'\\''words'", s), "mismatched escape")
 			std.slfree(s)
 		}],
 		[.name="quotequote", .fn={ctx
 			var s = std.fmt("{}", escfmt.sh("two'\\''words"))
-			testr.check(ctx, std.sleq("'two'\\''\\'\\'''\\''words'", s), "mismatched escape")
+			testr.check(ctx, std.eq("'two'\\''\\'\\'''\\''words'", s), "mismatched escape")
 			std.slfree(s)
 		}]
 	][:])
--- a/lib/escfmt/test/escurl.myr
+++ b/lib/escfmt/test/escurl.myr
@@ -6,13 +6,13 @@
 	testr.run([\
 		[.name="unchanged", .fn={ctx
 			var s = std.fmt("{}", escfmt.url("word"))
-			testr.check(ctx, std.sleq("word", s), std.fmt("mismatched escape {}", s))
+			testr.check(ctx, std.eq("word", s), std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
 		[.name="allspecials", .fn={ctx
 			var s = std.fmt("{}", escfmt.url(":/?#[]@!$&'()*+,;=%"))
 			testr.check(ctx, \
-				std.sleq("%3a%2f%3f%23%5b%5d%40%21%24%26%27%28%29%2a%2b%2c%3b%3d%25", s), \
+				std.eq("%3a%2f%3f%23%5b%5d%40%21%24%26%27%28%29%2a%2b%2c%3b%3d%25", s), \
 				std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
@@ -19,7 +19,7 @@
 		[.name="unicodes", .fn={ctx
 			var s = std.fmt("{}", escfmt.url("᚛᚛ᚉᚑᚅᚔᚉᚉᚔ"))
 			testr.check(ctx, \
-				std.sleq("%e1%9a%9b%e1%9a%9b%e1%9a%89%e1%9a%91%e1%9a%85%e1%9a%94%e1%9a%89%e1%9a%89%e1%9a%94", s), \
+				std.eq("%e1%9a%9b%e1%9a%9b%e1%9a%89%e1%9a%91%e1%9a%85%e1%9a%94%e1%9a%89%e1%9a%89%e1%9a%94", s), \
 					std.fmt("mismatched escape {}", s))
 			std.slfree(s)
 		}],
--- a/lib/inifile/test/inifile.myr
+++ b/lib/inifile/test/inifile.myr
@@ -57,7 +57,7 @@
 const checkval = {ini, sect, key, expected
 	match inifile.get(ini, sect, key)
 	| `std.Some val:
-		if !std.sleq(val, expected)
+		if !std.eq(val, expected)
 			std.fatal("{}.{}: expected {}, got {}\n", sect, key, expected, val)
 		;;
 	| `std.None:
--- a/lib/inifile/write.myr
+++ b/lib/inifile/write.myr
@@ -45,8 +45,7 @@
 
 	oldsect = ""
 	for (sect, key) : keys
-		std.put("sect={}, oldsect={}\n", sect, oldsect)
-		if !std.sleq(sect, oldsect)
+		if !std.eq(sect, oldsect)
 			bio.put(f, "[{}]\n", sect)
 		;;
 		oldsect = sect
--- a/lib/json/test/parse.myr
+++ b/lib/json/test/parse.myr
@@ -124,7 +124,7 @@
 		| 'i':
 			std.put("ignoring implementation defined test {}\n", f)
 		| wat:
-			if !std.sleq(f, "LICENSE")
+			if !std.eq(f, "LICENSE")
 				std.fatal("unknown test '{}': needs to start with y or n\n", f)
 			;;
 		;;
--- a/lib/regex/compile.myr
+++ b/lib/regex/compile.myr
@@ -729,20 +729,20 @@
 	;;
 	s = s[:n]
 	/* letters */
-	if std.sleq(s, "L") || std.sleq(s, "Letter")
+	if std.eq(s, "L") || std.eq(s, "Letter")
 		tab = _ranges.tabalpha[:]
-	elif std.sleq(s, "Lu") || std.sleq(s, "Uppercase_Letter")
+	elif std.eq(s, "Lu") || std.eq(s, "Uppercase_Letter")
 		tab = _ranges.tabupper[:]
-	elif std.sleq(s, "Ll") || std.sleq(s, "Lowercase_Letter")
+	elif std.eq(s, "Ll") || std.eq(s, "Lowercase_Letter")
 		tab = _ranges.tablower[:]
-	elif std.sleq(s, "Lt") || std.sleq(s, "Titlecase_Letter")
+	elif std.eq(s, "Lt") || std.eq(s, "Titlecase_Letter")
 		tab = _ranges.tablower[:]
 	/* numbers (incomplete) */
-	elif std.sleq(s, "N") || std.sleq(s, "Number")
+	elif std.eq(s, "N") || std.eq(s, "Number")
 		tab = _ranges.tabdigit[:]
-	elif std.sleq(s, "Z") || std.sleq(s, "Separator")
+	elif std.eq(s, "Z") || std.eq(s, "Separator")
 		tab = _ranges.tabspace[:]
-	elif std.sleq(s, "Zs") || std.sleq(s, "Space_Separator")
+	elif std.eq(s, "Zs") || std.eq(s, "Space_Separator")
 		tab = _ranges.tabblank[:]
 	else
 		-> `Err (`Badrange s)
--- a/lib/regex/test/testmatch.myr
+++ b/lib/regex/test/testmatch.myr
@@ -79,7 +79,7 @@
 		std.put("res: {}\n", res)
 		match expected
 		| `std.Some e:
-			if !std.sleq(res, e)
+			if !std.eq(res, e)
 				std.fatal("bad subst: expected {}, got {}\n", e, res)
 			;;
 		| `std.None:
@@ -157,7 +157,7 @@
 				std.put("\t{}: {}\n", i, res[i])
 			;;
 		| `std.Some exp:
-			if !search && !std.sleq(res[0], text)
+			if !search && !std.eq(res[0], text)
 				std.put("whole match does not match text!\n")
 				std.fatal("failed matching {} over {}\n", pat, text)
 			;;
@@ -167,7 +167,7 @@
 				std.fatal("failed matching {} over {}\n", pat, text)
 			;;
 			for i = 0; i < exp.len; i++
-				if !std.sleq(res[i], exp[i])
+				if !std.eq(res[i], exp[i])
 					std.put("mismatch on {}: expected {}, got {}\n", i, exp[i], res[i])
 					std.fatal("failed matching {} over {}\n", pat, text)
 				;;
--- a/lib/std/dial+plan9.myr
+++ b/lib/std/dial+plan9.myr
@@ -6,7 +6,6 @@
 use "option"
 use "pathjoin"
 use "result"
-use "sleq"
 use "strfind"
 use "strstrip"
 use "syswrap"
--- a/lib/std/dial+posixy.myr
+++ b/lib/std/dial+posixy.myr
@@ -8,7 +8,6 @@
 use "option"
 use "result"
 use "slcp"
-use "sleq"
 use "strfind"
 use "striter"
 use "syswrap"
--- a/lib/std/dialparse+posixy.myr
+++ b/lib/std/dialparse+posixy.myr
@@ -2,14 +2,15 @@
 use "chartype"
 use "hasprefix"
 use "intparse"
+use "ipparse"
+use "option"
+use "resolve"
+use "result"
 use "slcp"
 use "sleq"
 use "strfind"
 use "striter"
-use "option"
-use "result"
-use "ipparse"
-use "resolve"
+use "traits"
 
 pkg std =
 	pkglocal const parseport	: (port : byte[:] -> option(uint16))
@@ -22,13 +23,13 @@
 	| `Some n:	-> `Some n
 	| `None:
 		/* a small number of hardcoded ports */
-		if sleq(port, "http")
+		if eq(port, "http")
 			-> `Some 80
-		elif sleq(port, "https")
+		elif eq(port, "https")
 			-> `Some 443
-		elif sleq(port, "ircd")
+		elif eq(port, "ircd")
 			-> `Some 6667
-		elif sleq(port, "dns")
+		elif eq(port, "dns")
 			-> `Some 53
 		;;
 	;;
--- a/lib/std/env+plan9.myr
+++ b/lib/std/env+plan9.myr
@@ -9,7 +9,6 @@
 use "result"
 use "slcp"
 use "sldup"
-use "sleq"
 use "slpush"
 use "slurp"
 use "blat"
@@ -27,7 +26,7 @@
 const envfind = {key
 	lock(envlck)
 	for var i = 0; i < envkey.len; i++
-		if std.sleq(envkey[i], key)
+		if std.eq(envkey[i], key)
 			unlock(envlck)
 			-> `Some envval[i]
 		;;
--- a/lib/std/env+posixy.myr
+++ b/lib/std/env+posixy.myr
@@ -5,13 +5,14 @@
 use "die"
 use "extremum"
 use "fmt"
+use "sleq"
 use "memops"
 use "option"
-use "sldup"
 use "slcp"
-use "sleq"
+use "sldup"
 use "slpush"
 use "threadhooks"
+use "traits"
 
 pkg std =
 	const getenv	: (name : byte[:] -> option(byte[:]))
@@ -32,7 +33,7 @@
 		if envp != Zenvp
 			env = cstrconvp(envp)
 			n = min(name.len, env.len)
-			if sleq(name, env[:n]) && sleq(env[n:n+1], "=")
+			if eq(name, env[:n]) && eq(env[n:n+1], "=")
 				-> `Some env[n+1:]
 			;;
 		;;
@@ -61,7 +62,7 @@
 		if envp != Zenvp
 			env = cstrconvp(envp)
 			n = min(name.len, env.len - 1)
-			if sleq(name, env[:n]) && env[n] == ('=' : byte)
+			if eq(name, env[:n]) && env[n] == ('=' : byte)
 				found = true
 				break
 			;;
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -13,8 +13,8 @@
 use "option"
 use "result"
 use "sldup"
-use "sleq"
 use "slpush"
+use "sleq"
 use "strbuf"
 use "strfind"
 use "striter"
--- a/lib/std/hashfuncs.myr
+++ b/lib/std/hashfuncs.myr
@@ -2,20 +2,15 @@
 use "chartype"
 use "die"
 use "getint"
-use "sleq"
 use "slpush"
 use "traits"
 use "types"
 use "utf"
+use "memops"
+use "sleq"
 
 pkg std =
 	const siphash24	: (data : byte[:], seed : byte[16] -> uint64)
-
-	impl equatable @a[:] =
-		eq = {a, b
-			-> sleq(a, b)
-		}
-	;;
 
 	impl hashable @a[:] =
 		hash = {a
--- a/lib/std/hassuffix.myr
+++ b/lib/std/hassuffix.myr
@@ -1,3 +1,4 @@
+use "traits"
 use "sleq"
 
 pkg std =
@@ -9,7 +10,7 @@
 
 	if suff.len <= s.len
 		tail = s[s.len - suff.len:]
-		-> sleq(tail, suff)
+		-> eq(tail, suff)
 	;;
 	-> false
 }
--- a/lib/std/ipparse.myr
+++ b/lib/std/ipparse.myr
@@ -1,13 +1,14 @@
 use "chartype"
 use "die"
 use "fmt"
+use "sleq"
 use "intparse"
 use "option"
 use "slcp"
-use "sleq"
 use "slfill"
 use "strfind"
 use "striter"
+use "traits"
 use "types"
 
  /* FIXME: needed for decls which should be pulled in as hidden */
@@ -60,7 +61,7 @@
 	ok = true
 	expand = false
 	split = 0
-	if ip.len > 2 && std.sleq(ip[:2], "::")
+	if ip.len > 2 && eq(ip[:2], "::")
 		expand = true
 		split = 0
 	;;
--- a/lib/std/listen+posixy.myr
+++ b/lib/std/listen+posixy.myr
@@ -14,6 +14,7 @@
 use "strfind"
 use "striter"
 use "syswrap"
+use "traits"
 use "utf"
 
 pkg std =
@@ -61,7 +62,7 @@
 	| `None:	-> `Err("invalid port")
 	;;
 
-	if std.sleq(hoststr, "*")
+	if eq(hoststr, "*")
 		sa6=[.fam=sys.Afinet6, .port=hosttonet(port)]
 		sa = (&sa6 : sys.sockaddr#)
 		sz = sizeof(sys.sockaddr_in6)
--- a/lib/std/optparse.myr
+++ b/lib/std/optparse.myr
@@ -2,12 +2,13 @@
 use "die"
 use "extremum"
 use "fmt"
-use "strbuf"
-use "option"
 use "sleq"
+use "option"
 use "slpush"
-use "syswrap-ss"
+use "strbuf"
 use "syswrap"
+use "syswrap-ss"
+use "traits"
 use "types"
 use "utf"
 
@@ -166,7 +167,7 @@
 
 	for i = ctx.argidx + 1; i < ctx.optargs.len; i++
 		if !ctx.optdone && decode(ctx.optargs[i]) == '-'
-			if sleq(ctx.optargs[i], "--")
+			if eq(ctx.optargs[i], "--")
 				ctx.optdone = true
 			else
 				goto foundopt
--- a/lib/std/pathjoin.myr
+++ b/lib/std/pathjoin.myr
@@ -1,13 +1,14 @@
 use "alloc"
+use "die"
 use "extremum"
-use "strjoin"
-use "strsplit"
+use "fmt"
 use "sleq"
-use "sljoin"
-use "sldup"
 use "slcp"
-use "die"
-use "fmt"
+use "sldup"
+use "sljoin"
+use "strjoin"
+use "strsplit"
+use "traits"
 
 pkg std =
 	const pathcat	: (a : byte[:], b : byte[:] -> byte[:])
@@ -45,7 +46,7 @@
 	and remove it later on.
 	*/
 	for i = 0; i < comps.len; i++
-		if sleq(comps[i], ".")
+		if eq(comps[i], ".")
 			comps[i] = ""
 		;;
 	;;
@@ -59,11 +60,11 @@
 	get mangled.
 	*/
 	for i = 0; i < comps.len; i++
-		if !sleq(comps[i], "..")
+		if !eq(comps[i], "..")
 			continue
 		;;
 		for del = 1; del <= i; del++
-			if comps[i - del].len > 0 && !sleq(comps[i-del], "..")
+			if comps[i - del].len > 0 && !eq(comps[i-del], "..")
 				comps[i - del] = ""
 				comps[i] = ""
 				break
@@ -85,9 +86,9 @@
 	make it absolute. If we have an empty path, return
 	".". Otherwise, just return the path.
 	*/
-	if p.len > 0 && sleq(p[:1], "/")
+	if p.len > 0 && eq(p[:1], "/")
 		for i = 0; i < comps.len; i++
-			if !sleq(comps[i], "..")
+			if !eq(comps[i], "..")
 				break
 			;;
 		;;
--- a/lib/std/sleq.myr
+++ b/lib/std/sleq.myr
@@ -1,14 +1,91 @@
 use "types"
+use "traits"
 use "memops"
 
 pkg std =
-	generic sleq	: (a : @a[:], b : @a[:] -> bool)
+	impl equatable @a[:]
+	impl equatable bool[:]
+	impl equatable byte[:]
+	impl equatable char[:]
+	impl equatable int8[:]
+	impl equatable int16[:]
+	impl equatable int[:]
+	impl equatable int32[:]
+	impl equatable int64[:]
+	impl equatable uint8[:]
+	impl equatable uint16[:]
+	impl equatable uint[:]
+	impl equatable uint32[:]
+	impl equatable uint64[:]
+	generic sleq    : (a : @a[:], b : @a[:] -> bool)
 ;;
 
+/* for compatibility */
 generic sleq = {a, b
-	if a.len == b.len
-		-> memeq((a : byte#), (b : byte#), a.len * sizeof(@a))
+	-> eq(a, b)
+}
+
+impl equatable @a[:] =
+	eq = {a, b
+		if a.len == b.len
+			-> false
+		;;
+		/* can't use memeq because of padding */
+		for var i = 0; i < a.len; i++
+			if a[i] != b[i]
+				-> false
+			;;
+		;;
+		-> true
+	}
+;;
+
+impl equatable bool[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(bool))}
+;;
+impl equatable byte[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(byte))}
+;;
+impl equatable char[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(char))}
+;;
+impl equatable int8[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int8))}
+;;
+impl equatable int16[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int16))}
+;;
+impl equatable int[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int))}
+;;
+impl equatable int32[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int32))}
+;;
+impl equatable int64[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int64))}
+;;
+impl equatable uint8[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint8))}
+;;
+impl equatable uint16[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint16))}
+;;
+impl equatable uint[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint))}
+;;
+impl equatable uint32[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint32))}
+;;
+
+impl equatable uint64[:] = 
+	eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint64))}
+;;
+
+const primsleq = {a, b, na, nb, sz
+	if na == nb
+		-> memeq((a : byte#), (b : byte#), na * sz)
 	else
 		-> false
 	;;
 }
+
--- a/lib/std/test/bigint.myr
+++ b/lib/std/test/bigint.myr
@@ -35,7 +35,7 @@
 	std.bigfree(e)
 
 	n = std.bigbfmt(buf[:], a, 0)
-	std.assert(std.sleq(buf[:n], "517347321949036993306"), "simple smoke test failed")
+	std.assert(std.eq(buf[:n], "517347321949036993306"), "simple smoke test failed")
 
 	/* some comparison tests */
 	a = try(std.bigparse("1234_5678_1234_6789_6666_7777_8888"))
@@ -119,7 +119,7 @@
 
 	v = eval(e)
 	n = std.bigbfmt(buf[:], v, 0)
-	if !std.sleq(buf[:n], res)
+	if !std.eq(buf[:n], res)
 		std.fatal("{} != {}\n", buf[:n], res)
 	;;
 }
--- a/lib/std/test/chomp.myr
+++ b/lib/std/test/chomp.myr
@@ -11,6 +11,6 @@
 
 	r = sl
 	std.chomp(&r, pfx)
-	std.assert(std.sleq(r, expected), \
+	std.assert(std.eq(r, expected), \
 		"expected chomp({}, {}) => {}, got {}\n", sl, pfx, expected, r)
 }
--- a/lib/std/test/dirname.myr
+++ b/lib/std/test/dirname.myr
@@ -17,7 +17,7 @@
 }
 
 const eq = {a, e
-	if !std.sleq(e, a)
+	if !std.eq(e, a)
 		std.fatal("expected '{}', got '{}'\n", e, a)
 	;;
 }
--- a/lib/std/test/fmt.myr
+++ b/lib/std/test/fmt.myr
@@ -21,7 +21,7 @@
 
 	ap = std.vastart(&args)
 	sl = std.bfmtv(buf[:], fmt, &ap)
-	if !std.sleq(expected, sl)
+	if !std.eq(expected, sl)
 		std.fatal("mismatched fmt: got \"{}\", expected \"{}\"\n", sl, expected)
 	;;
 }
--- a/lib/std/test/ipparse.myr
+++ b/lib/std/test/ipparse.myr
@@ -66,7 +66,7 @@
 	parsed = std.ipparse(ip)
 	p = ipbytes(parsed)
 	e = ipbytes(expected)
-	if !std.sleq(p, e)
+	if !std.eq(p, e)
 		std.fput(1, "misparsed ip {}\n", ip)
 		std.put("parsed: ")
 		for b : p
--- a/lib/std/test/netaddr.myr
+++ b/lib/std/test/netaddr.myr
@@ -16,7 +16,7 @@
 	var s
 
 	s = std.netaddr(addr, net, port)
-	testr.check(ctx, std.sleq(expected, s), \
+	testr.check(ctx, std.eq(expected, s), \
 		"mismatch: expected {}, got {} from ({}, {}, {})\n", \
 		expected, s, addr, net, port)
 	std.slfree(s)
--- a/lib/std/test/pathjoin.myr
+++ b/lib/std/test/pathjoin.myr
@@ -49,7 +49,7 @@
 	var p
 
 	p = std.pathnorm(a)
-	if !std.sleq(p, b)
+	if !std.eq(p, b)
 		std.fatal("mismatched paths: '{}' => '{}' != '{}'\n", a, p, b)
 	;;
 	std.slfree(p)
@@ -56,7 +56,7 @@
 }
 
 const eq = {a, b
-	if !std.sleq(a, b)
+	if !std.eq(a, b)
 		std.fatal("mismatched paths: '{}' != '{}'\n", a, b)
 	;;
 }
--- a/lib/std/test/slcp.myr
+++ b/lib/std/test/slcp.myr
@@ -18,7 +18,7 @@
 	std.slcp(a[:a.len-2], a[2:])
 	std.slcp(b[2:], b[:b.len-2])
 	std.slcp(c[1:15], c[0:14])
-	std.assert(std.sleq(a[:], a_cped[:]), "slcp of a failed: got {}, wanted {}", a[:], a_cped[:])
-	std.assert(std.sleq(b[:], b_cped[:]), "slcp of b failed: got {}, wanted {}", b[:], b_cped[:])
-	std.assert(std.sleq(c[:], c_cped[:]), "slcp of b failed: got {r}, wanted {r}", c[:], c_cped[:])
+	std.assert(std.eq(a[:], a_cped[:]), "slcp of a failed: got {}, wanted {}", a[:], a_cped[:])
+	std.assert(std.eq(b[:], b_cped[:]), "slcp of b failed: got {}, wanted {}", b[:], b_cped[:])
+	std.assert(std.eq(c[:], c_cped[:]), "slcp of b failed: got {r}, wanted {r}", c[:], c_cped[:])
 }
--- a/lib/std/test/sleq.myr
+++ b/lib/std/test/sleq.myr
@@ -12,14 +12,14 @@
 const wide = {c
 	var a : uint[3] = [ 0, 1, 2]
 	var b : uint[3] = [ 0, 1, 3]
-	testr.check(c, !std.sleq(a[:], b[:]), "expected {} != {} as uint[:]", a, b)
+	testr.check(c, !std.eq(a[:], b[:]), "expected {} != {} as uint[:]", a, b)
 }
 
 const slices = {c
 	var a : int8[8] = [ 0, 0, 3, 1, 0, 3, 1, 2 ]
 	var b : int8[3] = [ 1, 0, 3]
-	testr.check(c, std.sleq(a[1:4], a[4:7]), "expected {} = {}", a[1:4], a[4:7])
-	testr.check(c, !std.sleq(a[0:4], a[3:7]), "expected {} = {}", a[0:4], a[3:7])
-	testr.check(c, !std.sleq(a[:], b[:]), "expected {} = {}", a, b)
-	testr.check(c, !std.sleq(a[3:7], b[:]), "expected {} = {}", a[3:7], b)
+	testr.check(c, std.eq(a[1:4], a[4:7]), "expected {} = {}", a[1:4], a[4:7])
+	testr.check(c, !std.eq(a[0:4], a[3:7]), "expected {} = {}", a[0:4], a[3:7])
+	testr.check(c, !std.eq(a[:], b[:]), "expected {} = {}", a, b)
+	testr.check(c, !std.eq(a[3:7], b[:]), "expected {} = {}", a[3:7], b)
 }
--- a/lib/std/test/sort.myr
+++ b/lib/std/test/sort.myr
@@ -12,16 +12,16 @@
 
 	/* with custom intcmp */
 	std.sort(a[:], intcmp)
-	std.assert(std.sleq(a[:], a_sorted[:]), "a was missorted")
+	std.assert(std.eq(a[:], a_sorted[:]), "a was missorted")
 
 	/* with libstd generic numcmp */
 	std.sort(b[:], std.numcmp)
-	std.assert(std.sleq(b[:], b_sorted[:]), "b was missorted")
+	std.assert(std.eq(b[:], b_sorted[:]), "b was missorted")
 
 	/* string sorting */
 	std.sort(c[:], std.strcmp)
 	for i = 0; i < c.len; i++
-		std.assert(std.sleq(c[i], c_sorted[i]), "c was missorted")
+		std.assert(std.eq(c[i], c_sorted[i]), "c was missorted")
 	;;
 }
 
--- a/lib/std/test/strbuf.myr
+++ b/lib/std/test/strbuf.myr
@@ -5,22 +5,22 @@
 	var buf : byte[16]
 
 	sb = std.mksb()
-	std.assert(std.sleq(std.sbpeek(sb), ""), "mismatched empty str\n")
+	std.assert(std.eq(std.sbpeek(sb), ""), "mismatched empty str\n")
 	std.sbputs(sb, "hello")
-	std.assert(std.sleq(std.sbpeek(sb), "hello"), "mismatched hello\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello"), "mismatched hello\n")
 	std.sbputs(sb, ", hello")
-	std.assert(std.sleq(std.sbpeek(sb), "hello, hello"), "mismatched double hello\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello, hello"), "mismatched double hello\n")
 	std.sbtrim(sb, 7)
-	std.assert(std.sleq(std.sbpeek(sb), "hello, "), "mismatched trim\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello, "), "mismatched trim\n")
 	std.sbputs(sb, "world")
-	std.assert(std.sleq(std.sbpeek(sb), "hello, world"), "mismatched hello world\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello, world"), "mismatched hello world\n")
 	std.sbtrim(sb, -5)
-	std.assert(std.sleq(std.sbpeek(sb), "hello, "), "mismatched rtrim\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello, "), "mismatched rtrim\n")
 	std.sbputc(sb, '世')
 	std.sbputc(sb, '界')
-	std.assert(std.sleq(std.sbpeek(sb), "hello, 世界"), "mismatched unicode\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello, 世界"), "mismatched unicode\n")
 	std.sbputb(sb, 10)
-	std.assert(std.sleq(std.sbpeek(sb), "hello, 世界\n"), "mismatched byte\n")
+	std.assert(std.eq(std.sbpeek(sb), "hello, 世界\n"), "mismatched byte\n")
 
 	sb = std.mkbufsb(buf[:])
 	std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 5 characters */
@@ -27,14 +27,14 @@
 	std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 10 characters */
 	std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 15 characters */
 	std.assert(!std.sbputs(sb, "hello"), "erronous success\n") /* 16 characters */
-	std.assert(std.sleq(std.sbpeek(sb), "hellohellohelloh"), "failed to copy as much as possible\n")
+	std.assert(std.eq(std.sbpeek(sb), "hellohellohelloh"), "failed to copy as much as possible\n")
 	std.sbtrim(sb, -1)
-	std.assert(std.sleq(std.sbpeek(sb), "hellohellohello"), "failed rtrim\n")
+	std.assert(std.eq(std.sbpeek(sb), "hellohellohello"), "failed rtrim\n")
 	std.sbputc(sb, '世')
-	std.assert(std.sleq(std.sbpeek(sb), "hellohellohello"), "modified overflowed putc\n")
+	std.assert(std.eq(std.sbpeek(sb), "hellohellohello"), "modified overflowed putc\n")
 	std.sbtrim(sb, -2)
-	std.assert(std.sleq(std.sbpeek(sb), "hellohellohel"), "failed rtrim\n")
+	std.assert(std.eq(std.sbpeek(sb), "hellohellohel"), "failed rtrim\n")
 	std.sbputc(sb, '世')
-	std.assert(std.sleq(std.sbpeek(sb), "hellohellohel世"), "failed to append with putc\n")
+	std.assert(std.eq(std.sbpeek(sb), "hellohellohel世"), "failed to append with putc\n")
 }
 
--- a/lib/std/test/strsplit.myr
+++ b/lib/std/test/strsplit.myr
@@ -36,7 +36,7 @@
 		std.fatal("length mismatch: {} != {}: {}\n", a.len, b.len)
 	;;
 	for var i = 0; i < a.len; i++
-		if !std.sleq(a[i], b[i])
+		if !std.eq(a[i], b[i])
 			std.fatal("element {} mismatched: '{}' != '{}'\n", i, a[i], b[i])
 		;;
 	;;
--- a/lib/std/varargs.myr
+++ b/lib/std/varargs.myr
@@ -1,6 +1,5 @@
 use "types"
 use "introspect"
-use "sleq"
 use "die"
 
 pkg std =
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -443,7 +443,7 @@
 		std.slpush(&n.cmd, std.sldup(mt.ldscript))
 	;;
 
-	if mt.runtime.len == 0 || std.sleq(mt.runtime, "none")
+	if mt.runtime.len == 0 || std.eq(mt.runtime, "none")
 		std.slpush(&n.cmd, std.sldup(opt_runtime))
 	else
 		std.slpush(&n.cmd, std.sldup(mt.runtime))
@@ -465,7 +465,7 @@
 	;;
 
 	/* OSX warns if we don't add a version */
-	if std.sleq(opt_sys, "osx")
+	if std.eq(opt_sys, "osx")
 		std.slpush(&n.cmd, std.sldup("-macosx_version_min"))
 		std.slpush(&n.cmd, std.sldup("10.6"))
 	;;
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -158,7 +158,7 @@
 	var dir
 
 	dir = std.getcwd()
-	while dir.len > 0 && !std.sleq(dir, "/")
+	while dir.len > 0 && !std.eq(dir, "/")
 		if std.chdir(dir) && std.fexists("bld.proj")
 			b.basedir = dir
 			break
@@ -165,7 +165,7 @@
 		;;
 		dir = std.dirname(dir)
 	;;
-	if dir.len > 0 && std.sleq(b.basedir, "/")
+	if dir.len > 0 && std.eq(b.basedir, "/")
 		std.fatal("could not find bld.proj\n")
 	;;
 }