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 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 bootstrap = extraInputs: target: let
this = delegate target; this = delegate target;
inputs = {inherit this;} // extraInputs; inputs = {inherit this;} // extraInputs;
@ -30,15 +31,18 @@ let
else target inputs; else target inputs;
in in
this; this;
submods = {
bootstrap = _: bootstrap;
# XXX: TODO: should I rename bootstrap.nix -> default.nix?
prim = ./prim/bootstrap.nix;
naive = ./naive/bootstrap.nix;
};
in in
bootstrap {} [ bootstrap {} [
./nt.nix submods.prim
{ submods.naive
bootstrap = _: bootstrap; ./attrs.nix
std = ./std/bootstrap.nix;
parse = ./parse/bootstrap.nix;
maybe = ./maybe.nix; submods
terminal = ./terminal.nix;
}
] ]

View file

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

View file

@ -1,7 +1,15 @@
{...}: { {...}: {
id = x: x; id = x: x;
# syntactic sugar for curry flipping
flip = f: a: b: f b a; 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... # not sure where else to put this...
nullOr = f: x: nullOr = f: x:
if x != null if x != null