completely restruct bootstrap

This commit is contained in:
Emile Clark-Boman 2026-01-28 12:55:12 +10:00
parent 100de72342
commit 0b554315e9
12 changed files with 25 additions and 11 deletions

View file

@ -11,7 +11,8 @@ let
mapAttrs
;
# NOTE: bootstrap does the equivalent to mix's `include.public` option.
# NOTE: bootstrap can do the equivalent of mix's
# NOTE: `include.public` & `submods.public` options.
bootstrap = extraInputs: target: let
this = delegate target;
inputs = {inherit this;} // extraInputs;
@ -30,15 +31,18 @@ let
else target inputs;
in
this;
submods = {
bootstrap = _: bootstrap;
# XXX: TODO: should I rename bootstrap.nix -> default.nix?
prim = ./prim/bootstrap.nix;
naive = ./naive/bootstrap.nix;
};
in
bootstrap {} [
./nt.nix
{
bootstrap = _: bootstrap;
std = ./std/bootstrap.nix;
parse = ./parse/bootstrap.nix;
submods.prim
submods.naive
./attrs.nix
maybe = ./maybe.nix;
terminal = ./terminal.nix;
}
submods
]

View file

@ -2,6 +2,8 @@
# WARNING: this file is strictly for bootstrapping nt
{this, ...} @ inputs:
this.bootstrap inputs [
./parse.nix
./sig.nix
{
maybe = ./maybe.nix;
terminal = ./terminal.nix;
}
]

View file

@ -1,7 +1,15 @@
{...}: {
id = x: x;
# syntactic sugar for curry flipping
flip = f: a: b: f b a;
# syntactic sugar for recursive definitions
recdef = def: let
Self = def Self;
in
Self;
# not sure where else to put this...
nullOr = f: x:
if x != null