diff --git a/docs/README.md b/docs/README.md
index 0ca96ef8..49a3eca4 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -17,6 +17,7 @@
- [Psl\Channel](./component/channel.md)
- [Psl\Class](./component/class.md)
- [Psl\Collection](./component/collection.md)
+- [Psl\Comparison](./component/comparison.md)
- [Psl\DataStructure](./component/data-structure.md)
- [Psl\Dict](./component/dict.md)
- [Psl\Encoding\Base64](./component/encoding-base64.md)
diff --git a/docs/component/comparison.md b/docs/component/comparison.md
new file mode 100644
index 00000000..8820f0ea
--- /dev/null
+++ b/docs/component/comparison.md
@@ -0,0 +1,33 @@
+
+
+[*index](./../README.md)
+
+---
+
+### `Psl\Comparison` Component
+
+#### `Functions`
+
+- [compare](./../../src/Psl/Comparison/compare.php#L19)
+- [equal](./../../src/Psl/Comparison/equal.php#L13)
+- [greater](./../../src/Psl/Comparison/greater.php#L13)
+- [greater_or_equal](./../../src/Psl/Comparison/greater_or_equal.php#L13)
+- [less](./../../src/Psl/Comparison/less.php#L13)
+- [less_or_equal](./../../src/Psl/Comparison/less_or_equal.php#L13)
+- [not_equal](./../../src/Psl/Comparison/not_equal.php#L13)
+- [sort](./../../src/Psl/Comparison/sort.php#L17)
+
+#### `Interfaces`
+
+- [Comparable](./../../src/Psl/Comparison/Comparable.php#L12)
+- [Equable](./../../src/Psl/Comparison/Equable.php#L10)
+
+#### `Enums`
+
+- [Order](./../../src/Psl/Comparison/Order.php#L7)
+
+
diff --git a/docs/component/option.md b/docs/component/option.md
index a1083dd1..439dba7a 100644
--- a/docs/component/option.md
+++ b/docs/component/option.md
@@ -18,6 +18,6 @@
#### `Classes`
-- [Option](./../../src/Psl/Option/Option.php#L12)
+- [Option](./../../src/Psl/Option/Option.php#L16)
diff --git a/docs/documenter.php b/docs/documenter.php
index fc59868a..e9802ea7 100644
--- a/docs/documenter.php
+++ b/docs/documenter.php
@@ -189,6 +189,7 @@ function get_all_components(): array
'Psl\\Channel',
'Psl\\Class',
'Psl\\Collection',
+ 'Psl\\Comparison',
'Psl\\DataStructure',
'Psl\\Dict',
'Psl\\Encoding\\Base64',
diff --git a/src/Psl/Comparison/Comparable.php b/src/Psl/Comparison/Comparable.php
new file mode 100644
index 00000000..e2aa21a0
--- /dev/null
+++ b/src/Psl/Comparison/Comparable.php
@@ -0,0 +1,20 @@
+compare($b);
+ }
+
+ return Order::from($a <=> $b);
+}
diff --git a/src/Psl/Comparison/equal.php b/src/Psl/Comparison/equal.php
new file mode 100644
index 00000000..e5d42039
--- /dev/null
+++ b/src/Psl/Comparison/equal.php
@@ -0,0 +1,16 @@
+value;
+}
diff --git a/src/Psl/Internal/Loader.php b/src/Psl/Internal/Loader.php
index f1c3af90..39e400d1 100644
--- a/src/Psl/Internal/Loader.php
+++ b/src/Psl/Internal/Loader.php
@@ -57,6 +57,14 @@ final class Loader
];
public const FUNCTIONS = [
+ 'Psl\\Comparison\\compare' => 'Psl/Comparison/compare.php',
+ 'Psl\\Comparison\\equal' => 'Psl/Comparison/equal.php',
+ 'Psl\\Comparison\\greater' => 'Psl/Comparison/greater.php',
+ 'Psl\\Comparison\\greater_or_equal' => 'Psl/Comparison/greater_or_equal.php',
+ 'Psl\\Comparison\\less' => 'Psl/Comparison/less.php',
+ 'Psl\\Comparison\\less_or_equal' => 'Psl/Comparison/less_or_equal.php',
+ 'Psl\\Comparison\\not_equal' => 'Psl/Comparison/not_equal.php',
+ 'Psl\\Comparison\\sort' => 'Psl/Comparison/sort.php',
'Psl\\Dict\\associate' => 'Psl/Dict/associate.php',
'Psl\\Dict\\count_values' => 'Psl/Dict/count_values.php',
'Psl\\Dict\\drop' => 'Psl/Dict/drop.php',
@@ -514,6 +522,8 @@ final class Loader
];
public const INTERFACES = [
+ 'Psl\\Comparison\\Comparable' => 'Psl/Comparison/Comparable.php',
+ 'Psl\\Comparison\\Equable' => 'Psl/Comparison/Equable.php',
'Psl\\DataStructure\\PriorityQueueInterface' => 'Psl/DataStructure/PriorityQueueInterface.php',
'Psl\\DataStructure\\QueueInterface' => 'Psl/DataStructure/QueueInterface.php',
'Psl\\DataStructure\\StackInterface' => 'Psl/DataStructure/StackInterface.php',
@@ -611,6 +621,7 @@ final class Loader
public const CLASSES = [
'Psl\\Ref' => 'Psl/Ref.php',
+ 'Psl\\Comparison\\Exception\\IncomparableException' => 'Psl/Comparison/Exception/IncomparableException.php',
'Psl\\DataStructure\\PriorityQueue' => 'Psl/DataStructure/PriorityQueue.php',
'Psl\\DataStructure\\Queue' => 'Psl/DataStructure/Queue.php',
'Psl\\DataStructure\\Stack' => 'Psl/DataStructure/Stack.php',
@@ -805,6 +816,7 @@ final class Loader
];
public const ENUMS = [
+ 'Psl\\Comparison\\Order' => 'Psl/Comparison/Order.php',
'Psl\\Encoding\\Base64\\Variant' => 'Psl/Encoding/Base64/Variant.php',
'Psl\\File\\LockType' => 'Psl/File/LockType.php',
'Psl\\File\\WriteMode' => 'Psl/File/WriteMode.php',
diff --git a/src/Psl/Option/Option.php b/src/Psl/Option/Option.php
index d7dc521f..17b17c07 100644
--- a/src/Psl/Option/Option.php
+++ b/src/Psl/Option/Option.php
@@ -5,11 +5,15 @@
namespace Psl\Option;
use Closure;
+use Psl\Comparison;
/**
* @template T
+ *
+ * @implements Comparison\Comparable