···441441 )
442442 end
443443444444+ # The unit type is a type that matches only the same object
445445+ def _Unit(object)
446446+ UnitType.new(object)
447447+ end
448448+449449+ # Nilable version of `_Unit`
450450+ def _Unit?(...)
451451+ _Nilable(
452452+ _Unit(...)
453453+ )
454454+ end
455455+444456 def _Void
445457 VoidType::Instance
446458 end
+30
lib/literal/types/unit_type.rb
···11+# frozen_string_literal: true
22+33+# @api private
44+class Literal::Types::UnitType
55+ include Literal::Type
66+77+ EQUAL_METHOD = BasicObject.instance_method(:equal?)
88+99+ def initialize(object)
1010+ @object = object
1111+ freeze
1212+ end
1313+1414+ attr_reader :object
1515+1616+ def ===(value)
1717+ EQUAL_METHOD.bind_call(@object, value)
1818+ end
1919+2020+ def >=(other)
2121+ case other
2222+ when Literal::Types::UnitType
2323+ EQUAL_METHOD.bind_call(@object, other.object)
2424+ else
2525+ false
2626+ end
2727+ end
2828+2929+ freeze
3030+end