From a7d0e34cb75d05c4a0df3871c3b75f9b0879be15 Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Sun, 25 Jan 2026 09:35:39 +1000 Subject: [PATCH] TEMP: add Null type --- nt/primitives/util/bootstrap.nix | 1 + nt/primitives/util/default.nix | 1 + nt/primitives/util/null.nix | 24 ++++++++++++++++++++++++ nt/primitives/util/parse.nix | 1 + 4 files changed, 27 insertions(+) create mode 100644 nt/primitives/util/null.nix diff --git a/nt/primitives/util/bootstrap.nix b/nt/primitives/util/bootstrap.nix index b7f32ba..85313cf 100644 --- a/nt/primitives/util/bootstrap.nix +++ b/nt/primitives/util/bootstrap.nix @@ -5,6 +5,7 @@ let import ./util.nix input // import ./parse.nix input // import ./trapdoor.nix input + // import ./null.nix input // import ./wrap.nix input // import ./enforce.nix input // import ./sig.nix input diff --git a/nt/primitives/util/default.nix b/nt/primitives/util/default.nix index 3f593e4..008e9d7 100644 --- a/nt/primitives/util/default.nix +++ b/nt/primitives/util/default.nix @@ -3,6 +3,7 @@ mix.newMixture inputs (mixture: { includes.public = [ ./enforce.nix ./nt.nix + ./null.nix ./parse.nix ./sig.nix ./trapdoor.nix diff --git a/nt/primitives/util/null.nix b/nt/primitives/util/null.nix new file mode 100644 index 0000000..26ec531 --- /dev/null +++ b/nt/primitives/util/null.nix @@ -0,0 +1,24 @@ +# XXX: TODO: replace Null with the naive Maybe type +{this, ...}: let + inherit + (this) + ntTrapdoorKey + mkTrapdoorSet + ; +in { + # NOTE: This is not good for writing type safe code + # NOTE: it is however efficient for bootstrapping the primitives + Null = + # WARNING: Null skips implementing a Type altogether + # WARNING: Null is an orphaned Type instance + mkTrapdoorSet ntTrapdoorKey { + default = {}; + unlock = { + instance = true; + sig = "nt::Null"; + derive = []; + ops = {}; + req = {}; + }; + }; +} diff --git a/nt/primitives/util/parse.nix b/nt/primitives/util/parse.nix index c8dfd07..1eacd3f 100644 --- a/nt/primitives/util/parse.nix +++ b/nt/primitives/util/parse.nix @@ -1,3 +1,4 @@ +# XXX: TODO: use the custom Null type instance instead of the Wrap type {this, ...}: let inherit (builtins)