From 3c8ccea4a1be11bbe44c77319403c1c74a6d54cc Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Wed, 28 Jan 2026 12:07:25 +1000 Subject: [PATCH] clean maybe.nix --- nt/primitives/bootstrap/maybe.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nt/primitives/bootstrap/maybe.nix b/nt/primitives/bootstrap/maybe.nix index 72f04ae..6f34774 100644 --- a/nt/primitives/bootstrap/maybe.nix +++ b/nt/primitives/bootstrap/maybe.nix @@ -7,9 +7,7 @@ typeOf ; in rec { - # NOTE: Maybe intentionally doesn't use the NixTypes. - # NOTE: Maybe is used to aid in parsing and bootstrapping. - # NOTE: It is intentionally left simple for speed gains. + # Naive Maybe Type Maybe = some: value: { _some = some; _value = value; @@ -19,6 +17,10 @@ in rec { # Type Checking isMaybe = T: isAttrs T && attrNames T == ["_some" "_value"]; + # XXX: TODO: make a pretty toString function + # XXX: TODO: make a pretty toString function + # XXX: TODO: make a pretty toString function + # XXX: TODO: make a pretty toString function enfIsMaybe = T: msg: let throw' = got: throw "${msg}: expected naive type Maybe but got ${got}"; attrs = @@ -47,7 +49,8 @@ in rec { # Unwrap Operations # Lift a value out of the monadic context. unwrapMaybe = T: - assert enfIsMaybe T "unwrapMaybe"; T._value; + assert enfIsMaybe T "unwrapMaybe"; + T._value; # Map Operations # Lift a value out of the monadic context and expect a new monadic.